From 80d88bff91ff6a42e5df25b4f934b565c721327e Mon Sep 17 00:00:00 2001 From: Vladimir Kalnitsky Date: Thu, 11 Jan 2024 23:01:19 +0400 Subject: [PATCH 01/18] Reduce the scope to only parts used in CTL. Reduce the amount of code by using typeclass abstractions --- README.md | 8 +- code-gen/parse-csl/Makefile | 3 +- code-gen/parse-csl/app/Main.hs | 50 +- .../data/cardano_serialization_lib.js.flow | 815 ++++++++++++++---- code-gen/parse-csl/package.yaml | 2 + code-gen/parse-csl/parse-csl.cabal | 4 +- code-gen/parse-csl/src/Csl.hs | 58 +- code-gen/parse-csl/src/Csl/Gen.hs | 177 ++-- code-gen/parse-csl/src/Csl/Parse.hs | 20 +- flake.lock | 137 +++ flake.nix | 244 ++++++ 11 files changed, 1225 insertions(+), 293 deletions(-) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/README.md b/README.md index 5e78905..b945b16 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,8 @@ Cardano serialization library can be used to work with Cardano types on frontend We can create TX and export them to the form which can then be submitted over wallet or API to the node. -The main ide of the library is to provide thin layer of FFI bindings to the original CSL library. -It does not try to make any abstractions beyond what is provided with CSL. +The main idea of the library is to provide thin layer of FFI bindings to the original CSL library. +It does not try to make any abstractions beyond what is provided with CSL. It gives you solid foundation to build your own abstractions. ## How to use the library @@ -40,7 +40,7 @@ as external dependency. Provide this library with your JS code package manager and also compile the purs code with it as external dep. See the Makefile for example how to do it. We should build with spago -and use esbuild on packaging to js code bundle where we can set up the external +and use esbuild on packaging to js code bundle where we can set up the external dependency on CSL: ``` @@ -77,5 +77,3 @@ or dirty. Submit an issue if you have found an effectful function which is declared like pure and vise versa. See the `code-gen` directory for the source code of the code parser and generator. - - diff --git a/code-gen/parse-csl/Makefile b/code-gen/parse-csl/Makefile index 252c558..d19f12e 100644 --- a/code-gen/parse-csl/Makefile +++ b/code-gen/parse-csl/Makefile @@ -4,4 +4,5 @@ build: stack build run: - stack run + mkdir -p output + stack run -- output diff --git a/code-gen/parse-csl/app/Main.hs b/code-gen/parse-csl/app/Main.hs index 1bd46b4..c40f51d 100644 --- a/code-gen/parse-csl/app/Main.hs +++ b/code-gen/parse-csl/app/Main.hs @@ -1,12 +1,50 @@ module Main (main) where -import Csl +import Csl +import Data.Functor ((<&>)) +import Data.Maybe (mapMaybe) +import System.Directory (createDirectoryIfMissing) +import System.Environment (getArgs) +import System.FilePath (takeDirectory) +import System.IO (IOMode (..), withFile) main :: IO () main = do - exportPursTypes - exportPursClasses - exportPursExportList - exportJsClasses - + exportPath <- (<> "/") . head <$> getArgs + jsLibHeader <- readFile "./fixtures/Lib.js" + importsCode <- readFile "./fixtures/imports.purs" + pursInternalLib <- readFile "./fixtures/Internal.purs" + funs <- getFuns + classes <- getClasses + print funs + -- print classes + let + filteredClasses = classes <&> \(Class name methods) -> Class name $ + filter (not . isCommon . method'fun) methods + nonCommonFuns = filter (not . isCommon) funs + funsJsCode = unlines $ funJs <$> nonCommonFuns + funsPursCode = unlines $ funPurs <$> nonCommonFuns + classesPursCode = unlines $ classPurs <$> classes + classesJsCode = unlines $ classJs <$> filteredClasses + exportsPursCode = exportListPurs nonCommonFuns filteredClasses + createDirectoryIfMissing True $ takeDirectory $ exportPath <> "/" + createDirectoryIfMissing True $ takeDirectory $ exportPath <> "/Lib/" + writeFile (exportPath <> "Lib.purs") $ unlines + [ pursLibHeader ++ exportsPursCode ++ "\n ) where" + , importsCode + , "" + , "-- functions" + , funsPursCode + , "" + , "-- classes" + , "" + , classesPursCode + ] + writeFile (exportPath <> "Lib.js") $ unlines + [ jsLibHeader + , classesJsCode + , funsJsCode + ] + writeFile (exportPath <> "Lib/Internal.purs") pursInternalLib +pursLibHeader = "module Cardano.Serialization.Lib\n ( " diff --git a/code-gen/parse-csl/data/cardano_serialization_lib.js.flow b/code-gen/parse-csl/data/cardano_serialization_lib.js.flow index 9ff299e..2b78249 100644 --- a/code-gen/parse-csl/data/cardano_serialization_lib.js.flow +++ b/code-gen/parse-csl/data/cardano_serialization_lib.js.flow @@ -1,37 +1,10 @@ /** * Flowtype definitions for cardano_serialization_lib * Generated by Flowgen from a Typescript Definition - * Flowgen v1.11.0 + * Flowgen v1.21.0 * @flow */ -/** - * @param {Transaction} tx - * @param {LinearFee} linear_fee - * @returns {BigNum} - */ -declare export function min_fee(tx: Transaction, linear_fee: LinearFee): BigNum; - -/** - * @param {ExUnits} ex_units - * @param {ExUnitPrices} ex_unit_prices - * @returns {BigNum} - */ -declare export function calculate_ex_units_ceil_cost( - ex_units: ExUnits, - ex_unit_prices: ExUnitPrices -): BigNum; - -/** - * @param {Transaction} tx - * @param {ExUnitPrices} ex_unit_prices - * @returns {BigNum} - */ -declare export function min_script_fee( - tx: Transaction, - ex_unit_prices: ExUnitPrices -): BigNum; - /** * @param {string} password * @param {string} salt @@ -194,26 +167,6 @@ declare export function encode_json_str_to_native_script( schema: number ): NativeScript; -/** - * @param {string} json - * @param {number} schema - * @returns {PlutusData} - */ -declare export function encode_json_str_to_plutus_datum( - json: string, - schema: number -): PlutusData; - -/** - * @param {PlutusData} datum - * @param {number} schema - * @returns {string} - */ -declare export function decode_plutus_datum_to_json_str( - datum: PlutusData, - schema: number -): string; - /** * @param {Uint8Array} bytes * @returns {TransactionMetadatum} @@ -250,6 +203,65 @@ declare export function decode_metadatum_to_json_str( schema: number ): string; +/** + * @param {string} json + * @param {number} schema + * @returns {PlutusData} + */ +declare export function encode_json_str_to_plutus_datum( + json: string, + schema: number +): PlutusData; + +/** + * @param {PlutusData} datum + * @param {number} schema + * @returns {string} + */ +declare export function decode_plutus_datum_to_json_str( + datum: PlutusData, + schema: number +): string; + +/** + * @param {Transaction} tx + * @param {LinearFee} linear_fee + * @returns {BigNum} + */ +declare export function min_fee(tx: Transaction, linear_fee: LinearFee): BigNum; + +/** + * @param {ExUnits} ex_units + * @param {ExUnitPrices} ex_unit_prices + * @returns {BigNum} + */ +declare export function calculate_ex_units_ceil_cost( + ex_units: ExUnits, + ex_unit_prices: ExUnitPrices +): BigNum; + +/** + * @param {Transaction} tx + * @param {ExUnitPrices} ex_unit_prices + * @returns {BigNum} + */ +declare export function min_script_fee( + tx: Transaction, + ex_unit_prices: ExUnitPrices +): BigNum; + +/** + * @param {Address} address + * @param {TransactionUnspentOutputs} utxos + * @param {TransactionBuilderConfig} config + * @returns {TransactionBatchList} + */ +declare export function create_send_all( + address: Address, + utxos: TransactionUnspentOutputs, + config: TransactionBuilderConfig +): TransactionBatchList; + /** */ @@ -322,30 +334,32 @@ declare export var NetworkIdKind: {| |}; /** + * Used to choosed the schema for a script JSON string */ -declare export var CoinSelectionStrategyCIP2: {| - +LargestFirst: 0, // 0 - +RandomImprove: 1, // 1 - +LargestFirstMultiAsset: 2, // 2 - +RandomImproveMultiAsset: 3, // 3 +declare export var ScriptSchema: {| + +Wallet: 0, // 0 + +Node: 1, // 1 |}; /** */ -declare export var StakeCredKind: {| - +Key: 0, // 0 - +Script: 1, // 1 +declare export var TransactionMetadatumKind: {| + +MetadataMap: 0, // 0 + +MetadataList: 1, // 1 + +Int: 2, // 2 + +Bytes: 3, // 3 + +Text: 4, // 4 |}; /** - * Used to choosed the schema for a script JSON string */ -declare export var ScriptSchema: {| - +Wallet: 0, // 0 - +Node: 1, // 1 +declare export var MetadataJsonSchema: {| + +NoConversions: 0, // 0 + +BasicConversions: 1, // 1 + +DetailedSchema: 2, // 2 |}; /** @@ -385,8 +399,8 @@ declare export var RedeemerTagKind: {| * All methods here have the following restrictions due to limitations on dependencies: * * JSON numbers above u64::MAX (positive) or below i64::MIN (negative) will throw errors * * Hex strings for bytes don't accept odd-length (half-byte) strings. - * cardano-cli seems to support these however but it seems to be different than just 0-padding - * on either side when tested so proceed with caution + * cardano-cli seems to support these however but it seems to be different than just 0-padding + * on either side when tested so proceed with caution */ declare export var PlutusDatumSchema: {| @@ -397,21 +411,27 @@ declare export var PlutusDatumSchema: {| /** */ -declare export var TransactionMetadatumKind: {| - +MetadataMap: 0, // 0 - +MetadataList: 1, // 1 - +Int: 2, // 2 - +Bytes: 3, // 3 - +Text: 4, // 4 +declare export var CoinSelectionStrategyCIP2: {| + +LargestFirst: 0, // 0 + +RandomImprove: 1, // 1 + +LargestFirstMultiAsset: 2, // 2 + +RandomImproveMultiAsset: 3, // 3 |}; /** */ -declare export var MetadataJsonSchema: {| - +NoConversions: 0, // 0 - +BasicConversions: 1, // 1 - +DetailedSchema: 2, // 2 +declare export var CborContainerType: {| + +Array: 0, // 0 + +Map: 1, // 1 +|}; + +/** + */ + +declare export var StakeCredKind: {| + +Key: 0, // 0 + +Script: 1, // 1 |}; /** @@ -740,6 +760,16 @@ declare export class AuxiliaryData { * @param {PlutusScripts} plutus_scripts */ set_plutus_scripts(plutus_scripts: PlutusScripts): void; + + /** + * @returns {boolean} + */ + prefer_alonzo_format(): boolean; + + /** + * @param {boolean} prefer + */ + set_prefer_alonzo_format(prefer: boolean): void; } /** */ @@ -1060,6 +1090,11 @@ declare export class BigNum { */ less_than(rhs_value: BigNum): boolean; + /** + * @returns {BigNum} + */ + static max_value(): BigNum; + /** * @param {BigNum} a * @param {BigNum} b @@ -1779,22 +1814,6 @@ declare export class ConstrPlutusData { */ static from_hex(hex_str: string): ConstrPlutusData; - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {ConstrPlutusDataJSON} - */ - to_js_value(): ConstrPlutusDataJSON; - - /** - * @param {string} json - * @returns {ConstrPlutusData} - */ - static from_json(json: string): ConstrPlutusData; - /** * @returns {BigNum} */ @@ -2441,6 +2460,114 @@ declare export class ExUnits { */ static new(mem: BigNum, steps: BigNum): ExUnits; } +/** + */ +declare export class FixedTransaction { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {FixedTransaction} + */ + static from_bytes(bytes: Uint8Array): FixedTransaction; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {FixedTransaction} + */ + static from_hex(hex_str: string): FixedTransaction; + + /** + * @param {Uint8Array} raw_body + * @param {Uint8Array} raw_witness_set + * @param {boolean} is_valid + * @returns {FixedTransaction} + */ + static new( + raw_body: Uint8Array, + raw_witness_set: Uint8Array, + is_valid: boolean + ): FixedTransaction; + + /** + * @param {Uint8Array} raw_body + * @param {Uint8Array} raw_witness_set + * @param {Uint8Array} raw_auxiliary_data + * @param {boolean} is_valid + * @returns {FixedTransaction} + */ + static new_with_auxiliary( + raw_body: Uint8Array, + raw_witness_set: Uint8Array, + raw_auxiliary_data: Uint8Array, + is_valid: boolean + ): FixedTransaction; + + /** + * @returns {TransactionBody} + */ + body(): TransactionBody; + + /** + * @returns {Uint8Array} + */ + raw_body(): Uint8Array; + + /** + * @param {Uint8Array} raw_body + */ + set_body(raw_body: Uint8Array): void; + + /** + * @param {Uint8Array} raw_witness_set + */ + set_witness_set(raw_witness_set: Uint8Array): void; + + /** + * @returns {TransactionWitnessSet} + */ + witness_set(): TransactionWitnessSet; + + /** + * @returns {Uint8Array} + */ + raw_witness_set(): Uint8Array; + + /** + * @param {boolean} valid + */ + set_is_valid(valid: boolean): void; + + /** + * @returns {boolean} + */ + is_valid(): boolean; + + /** + * @param {Uint8Array} raw_auxiliary_data + */ + set_auxiliary_data(raw_auxiliary_data: Uint8Array): void; + + /** + * @returns {AuxiliaryData | void} + */ + auxiliary_data(): AuxiliaryData | void; + + /** + * @returns {Uint8Array | void} + */ + raw_auxiliary_data(): Uint8Array | void; +} /** */ declare export class GeneralTransactionMetadata { @@ -2968,6 +3095,62 @@ declare export class HeaderBody { protocol_version: ProtocolVersion ): HeaderBody; } +/** + */ +declare export class InputWithScriptWitness { + free(): void; + + /** + * @param {TransactionInput} input + * @param {NativeScript} witness + * @returns {InputWithScriptWitness} + */ + static new_with_native_script_witness( + input: TransactionInput, + witness: NativeScript + ): InputWithScriptWitness; + + /** + * @param {TransactionInput} input + * @param {PlutusWitness} witness + * @returns {InputWithScriptWitness} + */ + static new_with_plutus_witness( + input: TransactionInput, + witness: PlutusWitness + ): InputWithScriptWitness; + + /** + * @returns {TransactionInput} + */ + input(): TransactionInput; +} +/** + */ +declare export class InputsWithScriptWitness { + free(): void; + + /** + * @returns {InputsWithScriptWitness} + */ + static new(): InputsWithScriptWitness; + + /** + * @param {InputWithScriptWitness} input + */ + add(input: InputWithScriptWitness): void; + + /** + * @param {number} index + * @returns {InputWithScriptWitness} + */ + get(index: number): InputWithScriptWitness; + + /** + * @returns {number} + */ + len(): number; +} /** */ declare export class Int { @@ -3337,6 +3520,11 @@ declare export class Languages { * @param {Language} elem */ add(elem: Language): void; + + /** + * @returns {Languages} + */ + static list(): Languages; } /** */ @@ -3664,11 +3852,20 @@ declare export class Mint { insert(key: ScriptHash, value: MintAssets): MintAssets | void; /** + * !!! DEPRECATED !!! + * Mint can store multiple entries for the same policy id. + * Use `.get_all` instead. * @param {ScriptHash} key * @returns {MintAssets | void} */ get(key: ScriptHash): MintAssets | void; + /** + * @param {ScriptHash} key + * @returns {MintsAssets | void} + */ + get_all(key: ScriptHash): MintsAssets | void; + /** * @returns {ScriptHashes} */ @@ -3697,34 +3894,119 @@ declare export class MintAssets { static new(): MintAssets; /** - * @param {AssetName} key - * @param {Int} value - * @returns {MintAssets} + * @param {AssetName} key + * @param {Int} value + * @returns {MintAssets} + */ + static new_from_entry(key: AssetName, value: Int): MintAssets; + + /** + * @returns {number} + */ + len(): number; + + /** + * @param {AssetName} key + * @param {Int} value + * @returns {Int | void} + */ + insert(key: AssetName, value: Int): Int | void; + + /** + * @param {AssetName} key + * @returns {Int | void} + */ + get(key: AssetName): Int | void; + + /** + * @returns {AssetNames} + */ + keys(): AssetNames; +} +/** + */ +declare export class MintBuilder { + free(): void; + + /** + * @returns {MintBuilder} + */ + static new(): MintBuilder; + + /** + * @param {MintWitness} mint + * @param {AssetName} asset_name + * @param {Int} amount + */ + add_asset(mint: MintWitness, asset_name: AssetName, amount: Int): void; + + /** + * @param {MintWitness} mint + * @param {AssetName} asset_name + * @param {Int} amount + */ + set_asset(mint: MintWitness, asset_name: AssetName, amount: Int): void; + + /** + * @returns {Mint} + */ + build(): Mint; + + /** + * @returns {NativeScripts} + */ + get_native_scripts(): NativeScripts; + + /** + * @returns {PlutusWitnesses} + */ + get_plutus_witnesses(): PlutusWitnesses; + + /** + * @returns {TransactionInputs} + */ + get_ref_inputs(): TransactionInputs; + + /** + * @returns {Redeemers} */ - static new_from_entry(key: AssetName, value: Int): MintAssets; + get_redeeemers(): Redeemers; /** - * @returns {number} + * @returns {boolean} */ - len(): number; + has_plutus_scripts(): boolean; /** - * @param {AssetName} key - * @param {Int} value - * @returns {Int | void} + * @returns {boolean} */ - insert(key: AssetName, value: Int): Int | void; + has_native_scripts(): boolean; +} +/** + */ +declare export class MintWitness { + free(): void; /** - * @param {AssetName} key - * @returns {Int | void} + * @param {NativeScript} native_script + * @returns {MintWitness} */ - get(key: AssetName): Int | void; + static new_native_script(native_script: NativeScript): MintWitness; /** - * @returns {AssetNames} + * @param {PlutusScriptSource} plutus_script + * @param {Redeemer} redeemer + * @returns {MintWitness} */ - keys(): AssetNames; + static new_plutus_script( + plutus_script: PlutusScriptSource, + redeemer: Redeemer + ): MintWitness; +} +/** + */ +declare export class MintsAssets { + free(): void; } /** */ @@ -4258,6 +4540,18 @@ declare export class NetworkInfo { /** * @returns {NetworkInfo} */ + static testnet_preview(): NetworkInfo; + + /** + * @returns {NetworkInfo} + */ + static testnet_preprod(): NetworkInfo; + + /** + * !!! DEPRECATED !!! + * This network does not exist anymore. Use `.testnet_preview()` or `.testnet_preprod()` + * @returns {NetworkInfo} + */ static testnet(): NetworkInfo; /** @@ -4401,6 +4695,33 @@ declare export class OperationalCert { sigma: Ed25519Signature ): OperationalCert; } +/** + */ +declare export class OutputDatum { + free(): void; + + /** + * @param {DataHash} data_hash + * @returns {OutputDatum} + */ + static new_data_hash(data_hash: DataHash): OutputDatum; + + /** + * @param {PlutusData} data + * @returns {OutputDatum} + */ + static new_data(data: PlutusData): OutputDatum; + + /** + * @returns {DataHash | void} + */ + data_hash(): DataHash | void; + + /** + * @returns {PlutusData | void} + */ + data(): PlutusData | void; +} /** */ declare export class PlutusData { @@ -4428,22 +4749,6 @@ declare export class PlutusData { */ static from_hex(hex_str: string): PlutusData; - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {PlutusDataJSON} - */ - to_js_value(): PlutusDataJSON; - - /** - * @param {string} json - * @returns {PlutusData} - */ - static from_json(json: string): PlutusData; - /** * @param {ConstrPlutusData} constr_plutus_data * @returns {PlutusData} @@ -4459,6 +4764,16 @@ declare export class PlutusData { */ static new_empty_constr_plutus_data(alternative: BigNum): PlutusData; + /** + * @param {BigNum} alternative + * @param {PlutusData} plutus_data + * @returns {PlutusData} + */ + static new_single_value_constr_plutus_data( + alternative: BigNum, + plutus_data: PlutusData + ): PlutusData; + /** * @param {PlutusMap} map * @returns {PlutusData} @@ -4512,6 +4827,25 @@ declare export class PlutusData { * @returns {Uint8Array | void} */ as_bytes(): Uint8Array | void; + + /** + * @param {number} schema + * @returns {string} + */ + to_json(schema: number): string; + + /** + * @param {string} json + * @param {number} schema + * @returns {PlutusData} + */ + static from_json(json: string, schema: number): PlutusData; + + /** + * @param {Address} address + * @returns {PlutusData} + */ + static from_address(address: Address): PlutusData; } /** */ @@ -4540,22 +4874,6 @@ declare export class PlutusList { */ static from_hex(hex_str: string): PlutusList; - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {PlutusListJSON} - */ - to_js_value(): PlutusListJSON; - - /** - * @param {string} json - * @returns {PlutusList} - */ - static from_json(json: string): PlutusList; - /** * @returns {PlutusList} */ @@ -4604,22 +4922,6 @@ declare export class PlutusMap { */ static from_hex(hex_str: string): PlutusMap; - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {PlutusMapJSON} - */ - to_js_value(): PlutusMapJSON; - - /** - * @param {string} json - * @returns {PlutusMap} - */ - static from_json(json: string): PlutusMap; - /** * @returns {PlutusMap} */ @@ -4676,6 +4978,7 @@ declare export class PlutusScript { static from_hex(hex_str: string): PlutusScript; /** + * * * Creates a new Plutus script from the RAW bytes of the compiled script. * * This does NOT include any CBOR encoding around these bytes (e.g. from "cborBytes" in cardano-cli) * * If you creating this from those you should use PlutusScript::from_bytes() instead. @@ -4685,6 +4988,7 @@ declare export class PlutusScript { static new(bytes: Uint8Array): PlutusScript; /** + * * * Creates a new Plutus script from the RAW bytes of the compiled script. * * This does NOT include any CBOR encoding around these bytes (e.g. from "cborBytes" in cardano-cli) * * If you creating this from those you should use PlutusScript::from_bytes() instead. @@ -4694,6 +4998,7 @@ declare export class PlutusScript { static new_v2(bytes: Uint8Array): PlutusScript; /** + * * * Creates a new Plutus script from the RAW bytes of the compiled script. * * This does NOT include any CBOR encoding around these bytes (e.g. from "cborBytes" in cardano-cli) * * If you creating this from those you should use PlutusScript::from_bytes() instead. @@ -4704,6 +5009,7 @@ declare export class PlutusScript { static new_with_version(bytes: Uint8Array, language: Language): PlutusScript; /** + * * * The raw bytes of this compiled Plutus script. * * If you need "cborBytes" for cardano-cli use PlutusScript::to_bytes() instead. * @returns {Uint8Array} @@ -4728,6 +5034,17 @@ declare export class PlutusScript { language: Language ): PlutusScript; + /** + * Same as .from_hex but will consider the script as requiring the specified language version + * @param {string} hex_str + * @param {Language} language + * @returns {PlutusScript} + */ + static from_hex_with_version( + hex_str: string, + language: Language + ): PlutusScript; + /** * @returns {ScriptHash} */ @@ -4750,6 +5067,10 @@ declare export class PlutusScriptSource { static new(script: PlutusScript): PlutusScriptSource; /** + * !!! DEPRECATED !!! + * This constructor has missed information about plutus script language vesrion. That can affect + * the script data hash calculation. + * Use `.new_ref_input_with_lang_ver` instead * @param {ScriptHash} script_hash * @param {TransactionInput} input * @returns {PlutusScriptSource} @@ -4758,6 +5079,18 @@ declare export class PlutusScriptSource { script_hash: ScriptHash, input: TransactionInput ): PlutusScriptSource; + + /** + * @param {ScriptHash} script_hash + * @param {TransactionInput} input + * @param {Language} lang_ver + * @returns {PlutusScriptSource} + */ + static new_ref_input_with_lang_ver( + script_hash: ScriptHash, + input: TransactionInput, + lang_ver: Language + ): PlutusScriptSource; } /** */ @@ -4852,6 +5185,26 @@ declare export class PlutusWitness { redeemer: Redeemer ): PlutusWitness; + /** + * @param {PlutusScript} script + * @param {Redeemer} redeemer + * @returns {PlutusWitness} + */ + static new_without_datum( + script: PlutusScript, + redeemer: Redeemer + ): PlutusWitness; + + /** + * @param {PlutusScriptSource} script + * @param {Redeemer} redeemer + * @returns {PlutusWitness} + */ + static new_with_ref_without_datum( + script: PlutusScriptSource, + redeemer: Redeemer + ): PlutusWitness; + /** * @returns {PlutusScript | void} */ @@ -7451,6 +7804,38 @@ declare export class Transaction { auxiliary_data?: AuxiliaryData ): Transaction; } +/** + */ +declare export class TransactionBatch { + free(): void; + + /** + * @returns {number} + */ + len(): number; + + /** + * @param {number} index + * @returns {Transaction} + */ + get(index: number): Transaction; +} +/** + */ +declare export class TransactionBatchList { + free(): void; + + /** + * @returns {number} + */ + len(): number; + + /** + * @param {number} index + * @returns {TransactionBatch} + */ + get(index: number): TransactionBatch; +} /** */ declare export class TransactionBodies { @@ -8074,6 +8459,19 @@ declare export class TransactionBuilder { ): void; /** + * @param {MintBuilder} mint_builder + */ + set_mint_builder(mint_builder: MintBuilder): void; + + /** + * @returns {MintBuilder | void} + */ + get_mint_builder(): MintBuilder | void; + + /** + * !!! DEPRECATED !!! + * Mints are defining by MintBuilder now. + * Use `.set_mint_builder()` and `MintBuilder` instead. * Set explicit Mint object and the required witnesses to this builder * it will replace any previously existing mint and mint scripts * NOTE! Error will be returned in case a mint policy does not have a matching script @@ -8083,6 +8481,9 @@ declare export class TransactionBuilder { set_mint(mint: Mint, mint_scripts: NativeScripts): void; /** + * !!! DEPRECATED !!! + * Mints are defining by MintBuilder now. + * Use `.get_mint_builder()` and `.build()` instead. * Returns a copy of the current mint state in the builder * @returns {Mint | void} */ @@ -8095,6 +8496,9 @@ declare export class TransactionBuilder { get_mint_scripts(): NativeScripts | void; /** + * !!! DEPRECATED !!! + * Mints are defining by MintBuilder now. + * Use `.set_mint_builder()` and `MintBuilder` instead. * Add a mint entry to this builder using a PolicyID and MintAssets object * It will be securely added to existing or new Mint in this builder * It will replace any existing mint assets with the same PolicyID @@ -8104,6 +8508,9 @@ declare export class TransactionBuilder { set_mint_asset(policy_script: NativeScript, mint_assets: MintAssets): void; /** + * !!! DEPRECATED !!! + * Mints are defining by MintBuilder now. + * Use `.set_mint_builder()` and `MintBuilder` instead. * Add a mint entry to this builder using a PolicyID, AssetName, and Int object for amount * It will be securely added to existing or new Mint in this builder * It will replace any previous existing amount same PolicyID and AssetName @@ -8215,6 +8622,16 @@ declare export class TransactionBuilder { */ add_change_if_needed(address: Address): boolean; + /** + * @param {Address} address + * @param {OutputDatum} plutus_data + * @returns {boolean} + */ + add_change_if_needed_with_datum( + address: Address, + plutus_data: OutputDatum + ): boolean; + /** * This method will calculate the script hash data * using the plutus datums and redeemers already present in the builder @@ -8778,6 +9195,11 @@ declare export class TransactionOutput { * @returns {TransactionOutput} */ static new(address: Address, amount: Value): TransactionOutput; + + /** + * @returns {number | void} + */ + serialization_format(): number | void; } /** */ @@ -9263,6 +9685,8 @@ declare export class TxInputsBuilder { ): void; /** + * !!! DEPRECATED !!! + * This function can make a mistake in choosing right input index. Use `.add_native_script_input` or `.add_plutus_script_input` instead. * This method adds the input to the builder BUT leaves a missing spot for the witness native script * * After adding the input with this method, use `.add_required_native_input_scripts` @@ -9343,6 +9767,8 @@ declare export class TxInputsBuilder { add_required_native_input_scripts(scripts: NativeScripts): number; /** + * !!! DEPRECATED !!! + * This function can make a mistake in choosing right input index. Use `.add_required_script_input_witnesses` instead. * Try adding the specified scripts as witnesses for ALREADY ADDED script inputs * Any scripts that don't match any of the previously added inputs will be ignored * Returns the number of remaining required missing witness scripts @@ -9352,6 +9778,18 @@ declare export class TxInputsBuilder { */ add_required_plutus_input_scripts(scripts: PlutusWitnesses): number; + /** + * Try adding the specified scripts as witnesses for ALREADY ADDED script inputs + * Any scripts that don't match any of the previously added inputs will be ignored + * Returns the number of remaining required missing witness scripts + * Use `.count_missing_input_scripts` to find the number of still missing scripts + * @param {InputsWithScriptWitness} inputs_with_wit + * @returns {number} + */ + add_required_script_input_witnesses( + inputs_with_wit: InputsWithScriptWitness + ): number; + /** * @returns {TransactionInputs} */ @@ -9977,6 +10415,44 @@ declare export class Vkeywitness { declare export class Vkeywitnesses { free(): void; + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {Vkeywitnesses} + */ + static from_bytes(bytes: Uint8Array): Vkeywitnesses; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {Vkeywitnesses} + */ + static from_hex(hex_str: string): Vkeywitnesses; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {VkeywitnessesJSON} + */ + to_js_value(): VkeywitnessesJSON; + + /** + * @param {string} json + * @returns {Vkeywitnesses} + */ + static from_json(json: string): Vkeywitnesses; + /** * @returns {Vkeywitnesses} */ @@ -10078,7 +10554,6 @@ export interface AssetsJSON { export interface AuxiliaryDataJSON { metadata?: { [k: string]: string, - ... } | null; native_scripts?: NativeScriptsJSON | null; plutus_scripts?: PlutusScriptsJSON | null; @@ -10093,7 +10568,6 @@ export type BigNumJSON = string; export interface BlockJSON { auxiliary_data_set: { [k: string]: AuxiliaryDataJSON, - ... }; header: HeaderJSON; invalid_transactions: number[]; @@ -10139,10 +10613,6 @@ export type CertificateEnumJSON = ... }; export type CertificatesJSON = CertificateJSON[]; -export interface ConstrPlutusDataJSON { - alternative: string; - data: PlutusListJSON; -} export type CostModelJSON = string[]; export interface CostmdlsJSON { [k: string]: CostModelJSON; @@ -10156,7 +10626,7 @@ export type DataOptionJSON = ... } | { - Data: PlutusDataJSON, + Data: string, ... }; export type Ed25519KeyHashJSON = string; @@ -10238,7 +10708,6 @@ export type MIREnumJSON = | { ToStakeCredentials: { [k: string]: ProtocolParamUpdateJSON, - ... }, ... }; @@ -10246,9 +10715,7 @@ export type MIRPotJSON = "Reserves" | "Treasury"; export interface MIRToStakeCredentialsJSON { [k: string]: ProtocolParamUpdateJSON; } -export interface MintJSON { - [k: string]: MintAssetsJSON; -} +export type MintJSON = [string, MintAssetsJSON][]; export interface MintAssetsJSON { [k: string]: string; } @@ -10338,25 +10805,8 @@ export interface OperationalCertJSON { sequence_number: number; sigma: string; } -export interface PlutusDataJSON { - datum: PlutusDataEnum; - original_bytes?: number[] | null; -} -export interface PlutusListJSON { - definite_encoding?: boolean | null; - elems: PlutusDataJSON[]; -} -export interface PlutusMapJSON { - [k: string]: PlutusDataJSON; -} export type PlutusScriptJSON = string; export type PlutusScriptsJSON = string[]; -export interface PlutusWitnessJSON { - datum: PlutusDataJSON; - redeemer: RedeemerJSON; - script: string; -} -export type PlutusWitnessesJSON = PlutusWitnessJSON[]; export interface PoolMetadataJSON { pool_metadata_hash: string; url: URLJSON; @@ -10413,10 +10863,9 @@ export interface ProtocolVersionJSON { major: number; minor: number; } -export type ProtocolVersionsJSON = ProtocolVersionJSON[]; export type PublicKeyJSON = string; export interface RedeemerJSON { - data: PlutusDataJSON; + data: string; ex_units: ExUnitsJSON; index: string; tag: RedeemerTagJSON; @@ -10529,7 +10978,6 @@ export interface TransactionBodyJSON { validity_start_interval?: string | null; withdrawals?: { [k: string]: ProtocolParamUpdateJSON, - ... } | null; } export type TransactionHashJSON = string; @@ -10554,7 +11002,7 @@ export type TransactionUnspentOutputsJSON = TransactionUnspentOutputJSON[]; export interface TransactionWitnessSetJSON { bootstraps?: BootstrapWitnessesJSON | null; native_scripts?: NativeScriptsJSON | null; - plutus_data?: PlutusListJSON | null; + plutus_data?: PlutusList | null; plutus_scripts?: PlutusScriptsJSON | null; redeemers?: RedeemersJSON | null; vkeys?: VkeywitnessesJSON | null; @@ -10569,7 +11017,6 @@ export interface UpdateJSON { epoch: number; proposed_protocol_parameter_updates: { [k: string]: ProtocolParamUpdateJSON, - ... }; } export interface VRFCertJSON { diff --git a/code-gen/parse-csl/package.yaml b/code-gen/parse-csl/package.yaml index 995ecf0..0710177 100644 --- a/code-gen/parse-csl/package.yaml +++ b/code-gen/parse-csl/package.yaml @@ -59,6 +59,8 @@ executables: - -with-rtsopts=-N dependencies: - parse-csl + - directory + - filepath tests: parse-csl-test: diff --git a/code-gen/parse-csl/parse-csl.cabal b/code-gen/parse-csl/parse-csl.cabal index 25ed670..15e6bfb 100644 --- a/code-gen/parse-csl/parse-csl.cabal +++ b/code-gen/parse-csl/parse-csl.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4. +-- This file has been generated from package.yaml by hpack version 0.36.0. -- -- see: https://github.com/sol/hpack @@ -64,6 +64,8 @@ executable parse-csl-exe ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N build-depends: base >=4.7 && <5 + , directory + , filepath , parse-csl default-language: Haskell2010 diff --git a/code-gen/parse-csl/src/Csl.hs b/code-gen/parse-csl/src/Csl.hs index da02b80..6409f9b 100644 --- a/code-gen/parse-csl/src/Csl.hs +++ b/code-gen/parse-csl/src/Csl.hs @@ -3,29 +3,48 @@ module Csl( module X ) where -import Csl.Gen as X -import Csl.Parse as X -import Csl.Types as X - -------------------------------------------------------------------------------------- --- export parts - -exportJsFuns = genExport "fun.js" getFuns funJs -exportPursTypes = genExport "types.purs" (classTypes <$> getClasses) typePurs -exportPursFuns = genExport "fun.purs" getFuns funPurs -exportPursClasses = genExport "class.purs" getClasses classPurs -exportJsClasses = genExport "class.js" getClasses classJs - -exportPursExportList = do - funs <- getFuns - cls <- getClasses - exportFile "export.purs" $ unlines $ exportListPurs funs cls +import Csl.Gen as X +import Csl.Parse as X +import Csl.Types as X ------------------------------------------------------------------------------------- -- read parts -getFuns = funs <$> readFile file -getClasses = fmap parseClass . toClassParts <$> readFile file +getFuns = filter (flip elem neededFunctions . fun'name) . + funs <$> readFile file +getClasses + = filter (not . flip elem unneededClasses . class'name) + . fmap parseClass + . toClassParts + <$> readFile file + +unneededClasses = + [ -- builder classes, not used by us + "TransactionBuilder" + , "TransactionBuilderConfigBuilder" + , "TransactionBuilderConfig" + , "TransactionOutputAmountBuilder" + , "TransactionOutputBuilder" + , "TxBuilderConstants" + , "TxInputsBuilder" + , "MintBuilder" + -- block data, not needed for us + , "Block" + , "Header" + , "HeaderBody" + , "TransactionBodies" + , "AuxiliaryDataSet" + , "TransactionWitnessSets" + , "Int" + , "Strings" + , "PublicKeys" + ] + +neededFunctions = + [ "hash_transaction" + , "hash_plutus_data" + , "min_ada_for_output" + ] ------------------------------------------------------------------------------------- -- utils @@ -36,4 +55,3 @@ genExport name extract parse = exportFile :: FilePath -> String -> IO () exportFile name content = writeFile ("output/" <> name) content - diff --git a/code-gen/parse-csl/src/Csl/Gen.hs b/code-gen/parse-csl/src/Csl/Gen.hs index d0a5556..a3fe02c 100644 --- a/code-gen/parse-csl/src/Csl/Gen.hs +++ b/code-gen/parse-csl/src/Csl/Gen.hs @@ -1,13 +1,15 @@ module Csl.Gen where +import Control.Monad (guard) import Data.Char (isAlphaNum, isUpper, toLower) import Data.Map (Map) import Data.Map qualified as Map import Data.Set (Set) import Data.Set qualified as Set +import Data.Functor ((<&>)) import Data.List as L import Data.List.Split (splitOn) -import Data.Maybe (mapMaybe) +import Data.Maybe (mapMaybe, Maybe(Just, Nothing), listToMaybe, catMaybes) import Data.Text qualified as T (pack, unpack, replace) import Data.Text.Manipulate qualified as T (toCamel, upperHead, lowerHead, toTitle, toTrain) import Data.List.Extra (trim) @@ -23,35 +25,27 @@ standardTypes = Set.fromList , "Effect" , "Number" , "Unit" - , "Bytes" + , "ByteArray" + , "Uint32Array" + , "This" ] extraExport :: [String] extraExport = - [ "Bytes" - , "class IsHex, toHex, fromHex" - , "class IsBech32, toBech32, fromBech32" - , "class IsJson, toJson, fromJson" - , "class IsStr, toStr, fromStr" - , "class IsBytes, toBytes, fromBytes" - , "class ToJsValue, toJsValue" - , "class HasFree, free" - , "class MutableLen, getLen" - , "class MutableList, getItem, addItem, emptyList" - , "toMutableList" - , "IntClass" - , "int" + [ "ForeignErrorable" ] -exportListPurs :: [Fun] -> [Class] -> [String] +exportListPurs :: [Fun] -> [Class] -> String exportListPurs funs cls = - fmap (indent . (", " <> )) $ extraExport ++ (toName . fun'name <$> funs) ++ (fromType =<< classTypes cls) + L.intercalate "\n , " $ + extraExport ++ + (classMethods =<< cls) ++ + (toName . fun'name <$> funs) ++ + (fromType =<< classTypes cls) where - fromType ty - | isJsonType ty = [ty] - | hasNoClass ty = [ty] - | otherwise = [ty, ty <> "Class", lowerHead ty] - + fromType ty = [ty] + classMethods :: Class -> [String] + classMethods (Class name ms) = map (mappend (toTypePrefix name <> "_") . toName . fun'name . method'fun) (filter (not . isCommon . method'fun) ms) hasNoClass = flip Set.member hasNoClassSet hasNoClassSet = Set.fromList ["This", "Uint32Array"] @@ -69,13 +63,9 @@ classTypes xs = postProcTypes $ fromClass =<< xs typePurs :: String -> String typePurs ty = unlines - [ typeCommentPurs ty - , typeDefPurs ty + [ typeDefPurs ty ] -typeCommentPurs :: String -> String -typeCommentPurs ty = preComment $ toTitle ty - typeDefPurs :: String -> String typeDefPurs ty | isJsonType ty = unwords [ "type", ty, "= Json"] @@ -132,6 +122,47 @@ data FunSpec = FunSpec , funSpec'pure :: Bool } +isCommon :: Fun -> Bool +isCommon (Fun "free" _ _) = True +isCommon (Fun "to_bytes" _ _) = True +isCommon (Fun "from_bytes" _ _) = True +isCommon (Fun "to_hex" _ _) = True +isCommon (Fun "from_hex" _ _) = True +isCommon (Fun "to_json" _ _) = True +isCommon (Fun "from_json" _ _) = True +isCommon (Fun "to_js_value" _ _) = True +isCommon (Fun "from_js_value" _ _) = True +-- sometimes these are with prefixes, sometimes not. they resist abstraction +-- isCommon (Fun "from_bech32" _ _) = True +-- isCommon (Fun "to_bech32" _ _) = True +isCommon (Fun "len" _ _) = True +isCommon (Fun "add" _ _) = True +isCommon (Fun "insert" _ _) = True +isCommon (Fun "get" _ _) = True +isCommon (Fun "keys" _ _) = True +isCommon (Fun _ _ _) = False + +isListContainer :: Class -> Maybe String +isListContainer (Class _ methods) = do + guard $ all (`elem` methodNames) [ "add", "len", "get" ] + listToMaybe $ mapMaybe getElement methods + where + methodNames = fun'name . method'fun <$> methods + getElement :: Method -> Maybe String + getElement (Method _ (Fun "add" [Arg _ elemType] _)) = Just elemType + getElement _ = Nothing + +isMapContainer :: Class -> Maybe (String, String) +isMapContainer (Class _ methods) = do + guard $ all (`elem` methodNames) [ "insert", "get", "len", "keys" ] + listToMaybe $ mapMaybe getKeyValue methods + where + methodNames = fun'name . method'fun <$> methods + getKeyValue :: Method -> Maybe (String, String) + getKeyValue (Method _ (Fun "insert" [Arg _ keyType, Arg _ valueType] _)) = + Just (keyType, valueType) + getKeyValue _ = Nothing + funJs :: Fun -> String funJs f = funJsBy (FunSpec "CSL" False "" (isPure "" f)) f @@ -154,16 +185,47 @@ funJsBy (FunSpec parent isSkipFirst prefix pureFun) (Fun name args res) = data HandleNulls = UseNullable | UseMaybe +commonInstances :: Class -> String +commonInstances (Class name methods) = unlines $ + [ "instance IsCsl " <> name <> " where\n className _ = \"" <> name <> "\"" ] <> + (if hasInstanceMethod "to_bytes" && hasInstanceMethod "from_bytes" + then [ "instance IsBytes " <> name ] + else []) <> + (if hasInstanceMethod "to_json" && hasInstanceMethod "from_json" + then [ "instance IsJson " <> name + , "instance EncodeAeson " <> name <> " where encodeAeson = cslToAeson" + , "instance DecodeAeson " <> name <> " where decodeAeson = cslFromAeson" + ] + else []) + where + hasInstanceMethod str = Set.member str methodNameSet + methodNameSet = Set.fromList $ fun'name . method'fun <$> methods + +containerInstances :: Class -> Maybe String +containerInstances cls@(Class name _) = + fmap unlines $ + notEmptyList $ + catMaybes + [ isListContainer cls <&> \elemType -> + "instance IsListContainer " <> unwords [ name, elemType ] + , isMapContainer cls <&> \(keyType, valueType) -> + "instance IsMapContainer " <> unwords [ name, keyType, valueType ] + ] + where + notEmptyList :: [a] -> Maybe [a] + notEmptyList [] = Nothing + notEmptyList xs = Just xs + classPurs :: Class -> String -classPurs (Class name ms) = mappend "\n" $ +classPurs cls@(Class name ms) = mappend "\n" $ L.intercalate "\n\n" $ fmap trim [ intro + , typePurs name , methodDefs - , classDef - , valDef , instances ] where + filteredClass = Class name $ filter (not . isCommon . method'fun) ms isNullType ty = elem '?' ty || isSuffixOf "| void" ty intro = unlines @@ -198,14 +260,14 @@ classPurs (Class name ms) = mappend "\n" $ unlines [ preComment $ unwords [toTitle name, "class"] , unwords ["type", valClassName, "="] - , recordDef (fmap (\m -> methodComment m $ psMethodName m <> " :: " <> psSig UseMaybe m) ms) + , recordDef (fmap (\m -> methodComment m $ psMethodName m <> " :: " <> psSig UseNullable m) ms) ] recordDef = \case [] -> "{}" a:as -> unlines [indent $ "{ " <> a, unlines (fmap (indent . (", " <>)) as) <> indent "}" ] - methodDefs = unlines $ fmap toDef ms + methodDefs = unlines $ fmap toDef $ filter (not . isCommon . method'fun) ms where toDef m = unwords ["foreign import", jsMethodName m, "::", psSig UseNullable m] @@ -266,7 +328,7 @@ classPurs (Class name ms) = mappend "\n" $ | otherwise = id where ty = case nullType of - UseNullable -> "ForeignErrorable" + UseNullable -> "Nullable" _ -> "Maybe" fromNullType = \case @@ -296,22 +358,21 @@ classPurs (Class name ms) = mappend "\n" $ instances | name == "Int" = "" - | otherwise = unlines $ mapMaybe id $ - Just freeInst : showInst : mutListInst : toJsValueInst : map toConvertInst ["hex", "bech32", "str", "bytes", "json"] + | otherwise = unlines $ catMaybes $ + [ Just $ commonInstances cls + , containerInstances cls + ] proxyMethod str = unwords [str, "=", valName <> "." <> str] - freeInst = toInst "HasFree" [proxyMethod "free"] - hasInstanceMethod str = Set.member str methodNameSet - showInst - | hasInstanceMethod "to_str" = with "to_str" - | hasInstanceMethod "to_hex" = with "to_hex" - | hasInstanceMethod "to_bech32" && getArgNum "to_bech32" == Just 0 = with "to_bech32" - | otherwise = Nothing - where - with name =Just $ toInst "Show" [instMethod "show" name] + -- | hasInstanceMethod "to_str" = with "to_str" + -- | hasInstanceMethod "to_hex" = with "to_hex" + -- | hasInstanceMethod "to_bech32" && getArgNum "to_bech32" == Just 0 = with "to_bech32" + -- | otherwise = Nothing + -- where + -- with name =Just $ toInst "Show" [instMethod "show" name] mutListInst :: Maybe String @@ -328,22 +389,12 @@ classPurs (Class name ms) = mappend "\n" $ ] instMethod :: String -> String -> String - instMethod name1 name2 = unwords [toName name1, "=", valName <> "." <> toName name2] + instMethod name1 name2 = unwords [toName name1, "=", valName <> "_" <> toName name2] toJsValueInst | hasInstanceMethod "to_js_value" = Just $ toInst "ToJsValue" [proxyMethod $ toName "to_js_value"] | otherwise = Nothing - toConvertInst str - | str == "bech32" && getArgNum "to_bech32" /= Just 0 = Nothing - | hasMethods = Just $ toInst ("Is" <> toType str) - [ proxyMethod (toName $ "to_" <> str) - , proxyMethod (toName $ "from_" <> str) - ] - | otherwise = Nothing - where - hasMethods = hasInstanceMethod ("to_" <> str) && hasInstanceMethod ("from_" <> str) - getArgNum name = fmap (length . fun'args) $ L.find ((== name) . fun'name) $ method'fun <$> ms @@ -388,7 +439,7 @@ indent str = " " <> str classJs :: Class -> String classJs (Class name ms) = - unlines $ pre : (methodJs name <$> ms) + unlines $ pre : (methodJs name <$> filter (not . isCommon . method'fun) ms) where pre = "// " <> name @@ -420,19 +471,14 @@ toName = lowerHead . substFirst . subst . toCamel subst :: String -> String subst = replacesBy replace - [("Transaction", "Tx") - , ("Input", "In") - , ("Output", "Out") - , ("Uint8Array", "Bytes") + [ ("Uint8Array", "ByteArray") , ("Void", "Unit") , ("JSON", "Json") ] substFirst :: String -> String substFirst = replacesBy replaceFirst - [("transaction", "tx") - , ("input", "in") - , ("output", "out") + [ ] replaceFirst :: String -> String -> String -> String @@ -491,7 +537,8 @@ dirtyClassSet = Set.fromList [ "TransactionBuilder" , "TransactionWitnessSet" , "TransactionWitnessSets" - , "TxInputsBuilder"] + , "TxInputsBuilder" + ] listTypeMap :: Map String String listTypeMap = Map.fromList listTypes @@ -623,5 +670,3 @@ canThrow :: String -> String -> Bool canThrow _className methodName = Set.member methodName froms where froms = Set.fromList ["from_hex", "from_bytes", "from_bech32", "from_json", "from_str"] - - diff --git a/code-gen/parse-csl/src/Csl/Parse.hs b/code-gen/parse-csl/src/Csl/Parse.hs index c2f4196..9c79636 100644 --- a/code-gen/parse-csl/src/Csl/Parse.hs +++ b/code-gen/parse-csl/src/Csl/Parse.hs @@ -1,10 +1,11 @@ module Csl.Parse where -import Data.List as L -import Data.List.Extra (trim) -import Data.List.Split (splitOn) -import Data.Maybe (mapMaybe) -import Csl.Types +import Control.Monad (guard) +import Csl.Types +import Data.List as L +import Data.List.Extra (trim) +import Data.List.Split (splitOn) +import Data.Maybe (mapMaybe) toFunParts :: String -> [String] toFunParts = splitOn "\n\n" @@ -16,7 +17,7 @@ parseFun :: String -> Maybe Fun parseFun str = case splitOn funPrefix str of [_, content] -> funBody content - _ -> Nothing + _ -> Nothing funBody :: String -> Maybe Fun funBody content = do @@ -37,7 +38,7 @@ parseArg :: String -> Maybe Arg parseArg str = case splitOn ":" str of [a, b] -> Just $ Arg (trim a) (trim b) - _ -> Nothing + _ -> Nothing toClassParts = tail . splitOn classPrefix @@ -72,7 +73,6 @@ file = "data/cardano_serialization_lib.js.flow" removeComments :: String -> String removeComments str = mconcat $ case splitOn "/*" str of - [] -> [] - a:[] -> [a] + [] -> [] + a:[] -> [a] a:rest -> a : fmap (mconcat . tail . splitOn "*/") rest - diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..816c847 --- /dev/null +++ b/flake.lock @@ -0,0 +1,137 @@ +{ + "nodes": { + "easy-purescript-nix": { + "flake": false, + "locked": { + "lastModified": 1696584097, + "narHash": "sha256-a9Hhqf/Fi0FkjRTcQr3pYDhrO9A9tdOkaeVgD23Cdrk=", + "owner": "justinwoo", + "repo": "easy-purescript-nix", + "rev": "d5fe5f4b210a0e4bac42ae0c159596a49c5eb016", + "type": "github" + }, + "original": { + "owner": "justinwoo", + "repo": "easy-purescript-nix", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1704152458, + "narHash": "sha256-DS+dGw7SKygIWf9w4eNBUZsK+4Ug27NwEWmn2tnbycg=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "88a2cd8166694ba0b6cb374700799cec53aef527", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { + "inputs": { + "nixpkgs-lib": [ + "hercules-ci-effects", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1701473968, + "narHash": "sha256-YcVE5emp1qQ8ieHUnxt1wCZCC3ZfAS+SRRWZ2TMda7E=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "34fed993f1674c8d06d58b37ce1e0fe5eebcb9f5", + "type": "github" + }, + "original": { + "id": "flake-parts", + "type": "indirect" + } + }, + "hercules-ci-effects": { + "inputs": { + "flake-parts": "flake-parts_2", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1704029560, + "narHash": "sha256-a4Iu7x1OP+uSYpqadOu8VCPY+MPF3+f6KIi+MAxlgyw=", + "owner": "hercules-ci", + "repo": "hercules-ci-effects", + "rev": "d5cbf433a6ae9cae05400189a8dbc6412a03ba16", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "hercules-ci-effects", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1703637592, + "narHash": "sha256-8MXjxU0RfFfzl57Zy3OfXCITS0qWDNLzlBAdwxGZwfY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "cfc3698c31b1fb9cdcf10f36c9643460264d0ca8", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "dir": "lib", + "lastModified": 1703961334, + "narHash": "sha256-M1mV/Cq+pgjk0rt6VxoyyD+O8cOUiai8t9Q6Yyq4noY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "b0d36bd0a420ecee3bc916c91886caca87c894e9", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1704194953, + "narHash": "sha256-RtDKd8Mynhe5CFnVT8s0/0yqtWFMM9LmCzXv/YKxnq4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "bd645e8668ec6612439a9ee7e71f7eac4099d4f6", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "easy-purescript-nix": "easy-purescript-nix", + "flake-parts": "flake-parts", + "hercules-ci-effects": "hercules-ci-effects", + "nixpkgs": "nixpkgs_2" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..5c30484 --- /dev/null +++ b/flake.nix @@ -0,0 +1,244 @@ +{ + description = "purescript-cardano-serialization-lib"; + + # Allow IFD in `nix flake check`. + nixConfig.allow-import-from-derivation = "true"; + + nixConfig = { + extra-substituters = [ "https://plutonomicon.cachix.org" ]; + extra-trusted-public-keys = [ "plutonomicon.cachix.org-1:evUxtNULjCjOipxwAnYhNFeF/lyYU1FeNGaVAnm+QQw=" ]; + bash-prompt = "\\[\\e[0m\\][\\[\\e[0;2m\\]nix-develop \\[\\e[0;1m\\]ps-cip30-typesafe@\\[\\033[33m\\]$(git rev-parse --abbrev-ref HEAD) \\[\\e[0;32m\\]\\w\\[\\e[0m\\]]\\[\\e[0m\\]$ \\[\\e[0m\\]"; + }; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-parts.url = github:hercules-ci/flake-parts; + hercules-ci-effects.url = github:hercules-ci/hercules-ci-effects; + easy-purescript-nix = { + url = "github:justinwoo/easy-purescript-nix"; + flake = false; + }; + }; + + outputs = inputs @ { self, flake-parts, hercules-ci-effects, ... }: + flake-parts.lib.mkFlake { inherit inputs; } ({ ... }: { + imports = [ + # Hercules CI effects module used to deploy to GitHub Pages + hercules-ci-effects.flakeModule + ]; + + # Systems supported by this flake + systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; + + perSystem = { self', pkgs, system, ... }: + let + easy-ps = (import inputs.easy-purescript-nix { inherit pkgs; }); + + spagoPkgs = import ./spago-packages.nix { inherit pkgs; }; + + # building/testing machinery is taken from cardano-transaction-lib. + # TODO: migrate it to a separate repo + + # Compiles the dependencies of a Purescript project and copies the `output` + # and `.spago` directories into the Nix store. + # Intended to be used in `buildPursProject` to not recompile the entire + # package set every time. + buildPursDependencies = + { + # If warnings generated from project source files will trigger a build error. + # Controls `--strict` purescript-psa flag + strictComp ? true + # Warnings from `purs` to silence during compilation, independent of `strictComp` + # Controls `--censor-codes` purescript-psa flag + , censorCodes ? [ "UserDefinedWarning" ] + , ... + }: + pkgs.stdenv.mkDerivation { + name = "ps-deps"; + buildInputs = [ + ]; + nativeBuildInputs = [ + spagoPkgs.installSpagoStyle + easy-ps.psa + easy-ps.purs + easy-ps.spago + ]; + # Make the derivation independent of the source files. + # `src` is not needed + unpackPhase = "true"; + buildPhase = '' + install-spago-style + psa ${pkgs.lib.optionalString strictComp "--strict" } \ + --censor-lib \ + --is-lib=.spago ".spago/*/*/src/**/*.purs" \ + --censor-codes=${builtins.concatStringsSep "," censorCodes} \ + -gsourcemaps,js + ''; + installPhase = '' + mkdir $out + mv output $out/ + mv .spago $out/ + ''; + }; + + # Compiles your Purescript project and copies the `output` directory into the + # Nix store. Also copies the local sources to be made available later as `purs` + # does not include any external files to its `output` (if we attempted to refer + # to absolute paths from the project-wide `src` argument, they would be wrong) + buildPursProject = + { + # If warnings generated from project source files will trigger a build error. + # Controls `--strict` purescript-psa flag + strictComp ? true + # Warnings from `purs` to silence during compilation, independent of `strictComp` + # Controls `--censor-codes` purescript-psa flag + , censorCodes ? [ "UserDefinedWarning" ] + , pursDependencies ? buildPursDependencies { + inherit strictComp censorCodes; + } + , ... + }: + pkgs.stdenv.mkDerivation { + name = "ps-project"; + src = ./.; + buildInputs = [ + ]; + nativeBuildInputs = [ + spagoPkgs.installSpagoStyle + easy-ps.psa + easy-ps.purs + easy-ps.spago + ]; + unpackPhase = '' + export HOME="$TMP" + # copy the dependency build artifacts and sources + # preserve the modification date so that we don't rebuild them + mkdir -p output .spago + cp -rp ${pursDependencies}/.spago/* .spago + cp -rp ${pursDependencies}/output/* output + # note that we copy the entire source directory, not just $src/src, + # because we need sources in ./examples and ./test + cp -rp $src ./src + + # add write permissions for the PS compiler to use + # `output/cache-db.json` + chmod -R +w output/ + ''; + buildPhase = '' + psa ${pkgs.lib.optionalString strictComp "--strict" } \ + --censor-lib \ + --is-lib=.spago ".spago/*/*/src/**/*.purs" \ + --censor-codes=${builtins.concatStringsSep "," censorCodes} "./src/**/*.purs" \ + -gsourcemaps,js + ''; + # We also need to copy all of `src` here, since compiled modules in `output` + # might refer to paths that will point to nothing if we use `src` directly + # in other derivations (e.g. when using `fs.readFileSync` inside an FFI + # module) + installPhase = '' + mkdir $out + cp -r output $out/ + ''; + }; + + # Runs a test written in Purescript using NodeJS. + runPursTest = + { + # The main Purescript module + testMain + # The entry point function in the main PureScript module + , psEntryPoint ? "main" + # Additional variables to pass to the test environment + , env ? { } + # Passed through to the `buildInputs` of the derivation. Use this to add + # additional packages to the test environment + , buildInputs ? [ ] + , builtProject ? buildPursProject { main = testMain; } + , ... + }: pkgs.runCommand "ps-test" + ( + { + src = ./.; + buildInputs = [ pkgs.nodejs ]; + } // env + ) + '' + # Copy the purescript project files + cp -r ${builtProject}/* . + + # The tests may depend on sources + cp -r $src/* . + + # Call the main module and execute the entry point function + node --enable-source-maps -e 'import("./output/${testMain}/index.js").then(m => m.${psEntryPoint}())' + + # Create output file to tell Nix we succeeded + touch $out + ''; + + in + { + devShells = { + default = pkgs.mkShell { + buildInputs = with pkgs; [ + nixpkgs-fmt + easy-ps.purs + easy-ps.purs-tidy + easy-ps.spago + easy-ps.pscid + easy-ps.psa + easy-ps.spago2nix + nodePackages.eslint + nodePackages.prettier + fd + git + nodejs-18_x + ]; + }; + }; + + packages = { + # Example package. Build with `nix build` or `nix build .#myapp`. + default = self'.packages.myapp; + }; + + # Example flake checks. Run with `nix flake check --keep-going` + checks = { + tests = runPursTest { testMain = "Test.Main"; psEntryPoint = "main"; }; + + formatting-check = pkgs.runCommand "formatting-check" + { + nativeBuildInputs = with pkgs; [ + easy-ps.purs-tidy + nixpkgs-fmt + nodePackages.prettier + nodePackages.eslint + fd + ]; + } + '' + cd ${self} + purs-tidy check './src/**/*.purs' './test/**/*.purs' + nixpkgs-fmt --check "$(fd --no-ignore-parent -enix --exclude='spago*')" + prettier --log-level warn -c $(fd --no-ignore-parent -ejs -ecjs) + eslint --quiet $(fd --no-ignore-parent -ejs -ecjs) --parser-options 'sourceType: module' + touch $out + ''; + }; + }; + + # On CI, build only on available systems, to avoid errors about systems without agents. + # Please use aarch64-linux and x86_64-darwin sparingly as they run on smaller hardware. + herculesCI.ciSystems = [ "x86_64-linux" ]; + + # Schedule task to run `nix flake update`, run CI, and open a PR with changes + hercules-ci.flake-update = { + enable = true; + when = { + dayOfWeek = "Sun"; + hour = 12; + minute = 45; + }; + }; + }); +} From 1b690e65be4bff48a794b89c913eb3149257ea81 Mon Sep 17 00:00:00 2001 From: Vladimir Kalnitsky Date: Sat, 13 Jan 2024 02:45:39 +0400 Subject: [PATCH 02/18] fix pureness check in codegen --- code-gen/parse-csl/src/Csl/Gen.hs | 40 ++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/code-gen/parse-csl/src/Csl/Gen.hs b/code-gen/parse-csl/src/Csl/Gen.hs index a3fe02c..0d416fc 100644 --- a/code-gen/parse-csl/src/Csl/Gen.hs +++ b/code-gen/parse-csl/src/Csl/Gen.hs @@ -33,6 +33,7 @@ standardTypes = Set.fromList extraExport :: [String] extraExport = [ "ForeignErrorable" + , "module X" ] exportListPurs :: [Fun] -> [Class] -> String @@ -92,7 +93,6 @@ funPurs fun@(Fun name args res) = argTypeNames = toType . arg'type <$> args preFunComment = funCommentBy preComment -postFunComment = funCommentBy postComment funCommentBy title f = L.intercalate "\n" @@ -119,7 +119,7 @@ data FunSpec = FunSpec { funSpec'parent :: String , funSpec'skipFirst :: Bool , funSpec'prefix :: String - , funSpec'pure :: Bool + , funSpec'pureness :: Pureness } isCommon :: Fun -> Bool @@ -163,26 +163,50 @@ isMapContainer (Class _ methods) = do Just (keyType, valueType) getKeyValue _ = Nothing +-- process standalone functions funJs :: Fun -> String -funJs f = funJsBy (FunSpec "CSL" False "" (isPure "" f)) f +funJs f = funJsBy (FunSpec "CSL" False "" (getPureness "" f)) f funJsBy :: FunSpec -> Fun -> String -funJsBy (FunSpec parent isSkipFirst prefix pureFun) (Fun name args res) = +funJsBy (FunSpec parent isSkipFirst prefix pureness) (Fun name args res) = unwords [ "export const" , prefix <> toName name , if L.null argNames then "=" else "= " <> L.intercalate " => " argNames <> " =>" - , flip mappend ";" $ - let isThrow = canThrow parent name - in mconcat [if isThrow then "errorableToPurs(" else "", parent, ".", name, if isThrow then ", " else "(", if L.null jsArgs then "" else (L.intercalate ", " jsArgs) ,")"] + , withSemicolon $ mconcat $ + if pureness == Throwing + then + -- errorableToPurs(CSL.foo, arg1, arg2) + [ "errorableToPurs(" + , parent + , "." + , name + , ", " + , L.intercalate ", " jsArgs + , ")" + ] + else + -- CSL.foo(arg1, arg2) + [ parent + , "." + , name + , "(" + , L.intercalate ", " jsArgs + , ")" + ] ] where - argNames = (if pureFun then id else (<> ["()"])) argNamesIn + -- if a function is mutating, we add another function wrapper that represents + -- PureScript's `Effect` at runtime + argNames = (if pureness == Mutating then (<> ["()"]) else id) argNamesIn argNamesIn = fmap (filter (/= '?')) $ arg'name <$> args jsArgs = (if isSkipFirst then tail else id) argNamesIn +withSemicolon :: String -> String +withSemicolon = flip mappend ";" + data HandleNulls = UseNullable | UseMaybe commonInstances :: Class -> String From a083ae1a0de01becd73b1d9f5b6e33262a29a07c Mon Sep 17 00:00:00 2001 From: Vladimir Kalnitsky Date: Sat, 13 Jan 2024 22:51:38 +0400 Subject: [PATCH 03/18] Improvements. Remove intPos machinery - it was not needed --- code-gen/parse-csl/app/Main.hs | 6 +- code-gen/parse-csl/fixtures/Internal.js | 57 +++++ code-gen/parse-csl/fixtures/Internal.purs | 143 +++++++++++ code-gen/parse-csl/fixtures/Lib.js | 13 + code-gen/parse-csl/fixtures/Lib.purs | 20 ++ code-gen/parse-csl/fixtures/imports.purs | 37 +++ code-gen/parse-csl/src/Csl.hs | 1 - code-gen/parse-csl/src/Csl/Gen.hs | 278 ++++++++-------------- 8 files changed, 367 insertions(+), 188 deletions(-) create mode 100644 code-gen/parse-csl/fixtures/Internal.js create mode 100644 code-gen/parse-csl/fixtures/Internal.purs create mode 100644 code-gen/parse-csl/fixtures/Lib.js create mode 100644 code-gen/parse-csl/fixtures/Lib.purs create mode 100644 code-gen/parse-csl/fixtures/imports.purs diff --git a/code-gen/parse-csl/app/Main.hs b/code-gen/parse-csl/app/Main.hs index c40f51d..ca572a8 100644 --- a/code-gen/parse-csl/app/Main.hs +++ b/code-gen/parse-csl/app/Main.hs @@ -19,14 +19,12 @@ main = do print funs -- print classes let - filteredClasses = classes <&> \(Class name methods) -> Class name $ - filter (not . isCommon . method'fun) methods nonCommonFuns = filter (not . isCommon) funs funsJsCode = unlines $ funJs <$> nonCommonFuns funsPursCode = unlines $ funPurs <$> nonCommonFuns classesPursCode = unlines $ classPurs <$> classes - classesJsCode = unlines $ classJs <$> filteredClasses - exportsPursCode = exportListPurs nonCommonFuns filteredClasses + classesJsCode = unlines $ classJs <$> classes + exportsPursCode = exportListPurs nonCommonFuns classes createDirectoryIfMissing True $ takeDirectory $ exportPath <> "/" createDirectoryIfMissing True $ takeDirectory $ exportPath <> "/Lib/" writeFile (exportPath <> "Lib.purs") $ unlines diff --git a/code-gen/parse-csl/fixtures/Internal.js b/code-gen/parse-csl/fixtures/Internal.js new file mode 100644 index 0000000..c7b0178 --- /dev/null +++ b/code-gen/parse-csl/fixtures/Internal.js @@ -0,0 +1,57 @@ +import * as csl from "@mlabs-haskell/cardano-serialization-lib-gc"; + +export const _toBytes = x => x.to_bytes(); +export const _fromBytes = key => nothing => just => bytes => { + try { + return just(csl[key].from_bytes(bytes)); + } catch (_) { + return nothing; + } +}; + +export const _packListContainer = containerClass => elems => { + const container = csl[containerClass].new(); + for (let elem of elems) { + container.add(elem); + } + return container; +}; + +export const _unpackListContainer = container => { + const res = []; + const len = container.len(); + for (let i = 0; i < len; i++) { + res.push(container.get(i)); + } + return res; +}; + +export const _packMapContainer = containerClass => elems => { + const container = csl[containerClass].new(); + for (let elem of elems) { + container.insert(elem.key, elem.value); + } + console.log(container.to_json()); + return container; +}; + +export const _unpackMapContainer = container => { + const keys = _unpackListContainer(container.keys()); + console.log("keys", keys); + const res = []; + for (let key of keys) { + res.push({ key, value: container.get(key) }); + } + console.log("unpack", res); + return res; +}; + +export const _cslFromJson = className => nothing => just => json => { + try { + return just(csl[className].from_json(json)); + } catch (e) { + return nothing; + } +}; + +export const _cslToJson = x => x.to_json(); diff --git a/code-gen/parse-csl/fixtures/Internal.purs b/code-gen/parse-csl/fixtures/Internal.purs new file mode 100644 index 0000000..493fc22 --- /dev/null +++ b/code-gen/parse-csl/fixtures/Internal.purs @@ -0,0 +1,143 @@ +module Cardano.Serialization.Lib.Internal where + +import Prelude + +import Aeson (Aeson, jsonToAeson, stringifyAeson) +import Data.ByteArray (ByteArray) +import Data.Argonaut (Json, JsonDecodeError(TypeMismatch), jsonParser) +import Data.Bifunctor (lmap) +import Data.Either (Either, note) +import Data.Map (Map) +import Data.Map as Map +import Data.Maybe (Maybe(Nothing, Just)) +import Data.Tuple (Tuple(Tuple)) +import Type.Proxy (Proxy(Proxy)) + +-- all types + +class IsCsl a where + className :: Proxy a -> String + +-- byte-representable types + +class IsBytes a + +toBytes :: forall a. IsCsl a => IsBytes a => a -> ByteArray +toBytes = _toBytes + +fromBytes :: forall a. IsCsl a => IsBytes a => ByteArray -> Maybe a +fromBytes = _fromBytes (className (Proxy :: Proxy a)) Nothing Just + +foreign import _toBytes :: forall a. a -> ByteArray + +foreign import _fromBytes + :: forall b + . String + -> (forall a. Maybe a) + -> (forall a. a -> Maybe a) + -> ByteArray + -> Maybe b + +-- json + +class IsJson a + +-- containers + +class IsListContainer c e | c -> e + +packListContainer :: forall c e. IsCsl c => IsListContainer c e => Array e -> c +packListContainer = _packListContainer (className (Proxy :: Proxy c)) + +unpackListContainer :: forall c e. IsListContainer c e => c -> Array e +unpackListContainer = _unpackListContainer + +foreign import _packListContainer :: forall c e. String -> Array e -> c +foreign import _unpackListContainer :: forall c e. c -> Array e + +class IsMapContainer c k v | c -> k, c -> v + +packMapContainer + :: forall c k v + . IsMapContainer c k v + => IsCsl c + => Array { key :: k, value :: v } + -> c +packMapContainer = _packMapContainer (className (Proxy :: Proxy c)) + +packMapContainerFromMap + :: forall c k v + . IsMapContainer c k v + => IsCsl c + => IsCsl k + => IsCsl v + => Map k v + -> c +packMapContainerFromMap = packMapContainer <<< map toKeyValues <<< Map.toUnfoldable + where + toKeyValues (Tuple key value) = { key, value } + +unpackMapContainer + :: forall c k v + . IsMapContainer c k v + => c + -> Array { key :: k, value :: v } +unpackMapContainer = _unpackMapContainer + +unpackMapContainerToMapWith + :: forall c k v k1 v1 + . IsMapContainer c k v + => Ord k1 + => (k -> k1) + -> (v -> v1) + -> c + -> Map k1 v1 +unpackMapContainerToMapWith mapKey mapValue container = + unpackMapContainer container + # map toTuple >>> Map.fromFoldable + where + toTuple { key, value } = Tuple (mapKey key) (mapValue value) + +foreign import _packMapContainer + :: forall c k v + . String + -> Array { key :: k, value :: v } + -> c + +foreign import _unpackMapContainer + :: forall c k v + . c + -> Array { key :: k, value :: v } + +-- Aeson + +cslFromAeson + :: forall a + . IsJson a + => IsCsl a + => Aeson + -> Either JsonDecodeError a +cslFromAeson aeson = + (lmap (const $ TypeMismatch "JSON") $ jsonParser $ stringifyAeson aeson) + >>= cslFromJson >>> note (TypeMismatch $ className (Proxy :: Proxy a)) + +cslToAeson + :: forall a + . IsJson a + => a -> Aeson +cslToAeson = _cslToJson >>> jsonToAeson + +--- Json + +cslFromJson :: forall a. IsCsl a => IsJson a => Json -> Maybe a +cslFromJson = _cslFromJson (className (Proxy :: Proxy a)) Nothing Just + +foreign import _cslFromJson + :: forall b + . String + -> (forall a. Maybe a) + -> (forall a. a -> Maybe a) + -> Json + -> Maybe b + +foreign import _cslToJson :: forall a. a -> Json diff --git a/code-gen/parse-csl/fixtures/Lib.js b/code-gen/parse-csl/fixtures/Lib.js new file mode 100644 index 0000000..614dad8 --- /dev/null +++ b/code-gen/parse-csl/fixtures/Lib.js @@ -0,0 +1,13 @@ +"use strict"; + +import * as CSL from "@mlabs-haskell/cardano-serialization-lib-gc"; + +// Pass in a function and its list of arguments, that is expected to fail on evaluation, wraps in Either +function errorableToPurs(f, ...vars) { + try { + return f(...vars) || null; + } + catch (err) { + return null; + } + } diff --git a/code-gen/parse-csl/fixtures/Lib.purs b/code-gen/parse-csl/fixtures/Lib.purs new file mode 100644 index 0000000..a58caab --- /dev/null +++ b/code-gen/parse-csl/fixtures/Lib.purs @@ -0,0 +1,20 @@ +module Cardano.Serialization.Lib.Internal where + +import Prelude + +import Data.ByteArray (ByteArray) +import Data.Maybe (Maybe) +import Type.Proxy (Proxy(Proxy)) + +class IsBytes a where + className :: Proxy a -> String + +toBytes :: forall a. IsBytes a => a -> ByteArray +toBytes = _toBytes + +fromBytes :: forall a. IsBytes a => ByteArray -> Maybe a +fromBytes = _fromBytes (className (Proxy :: Proxy a)) + +foreign import _toBytes :: forall a. a -> ByteArray + +foreign import _fromBytes :: forall a. String -> ByteArray -> Maybe a diff --git a/code-gen/parse-csl/fixtures/imports.purs b/code-gen/parse-csl/fixtures/imports.purs new file mode 100644 index 0000000..d8e99d0 --- /dev/null +++ b/code-gen/parse-csl/fixtures/imports.purs @@ -0,0 +1,37 @@ +import Prelude + +import Cardano.Serialization.Lib.Internal +import Cardano.Serialization.Lib.Internal + ( class IsBytes + , toBytes + , fromBytes + , packMapContainer + , packMapContainerFromMap + , unpackMapContainerToMapWith + , unpackMapContainer + , cslFromAeson + , cslToAeson + ) as X +import Effect +import Data.Nullable +import Aeson (Aeson, class DecodeAeson, encodeAeson, decodeAeson, class EncodeAeson, jsonToAeson, stringifyAeson) +import Data.ByteArray (ByteArray) +import Data.Argonaut (Json, JsonDecodeError(TypeMismatch), jsonParser) +import Data.Bifunctor (lmap) +import Data.Either (Either(Left, Right), note) +import Data.Map (Map) +import Data.Map as Map +import Data.Maybe (Maybe(Nothing, Just)) +import Data.Tuple (Tuple(Tuple)) +import Type.Proxy (Proxy(Proxy)) + +-- Utils for type conversions +type ForeignErrorable a = + (String -> Either String a) -> (a -> Either String a) -> Either String a + +runForeignErrorable :: forall (a :: Type). ForeignErrorable a -> Either String a +runForeignErrorable f = f Left Right + +class IsStr a where + fromStr :: String -> Maybe a + toStr :: a -> String diff --git a/code-gen/parse-csl/src/Csl.hs b/code-gen/parse-csl/src/Csl.hs index 6409f9b..b31a35a 100644 --- a/code-gen/parse-csl/src/Csl.hs +++ b/code-gen/parse-csl/src/Csl.hs @@ -35,7 +35,6 @@ unneededClasses = , "TransactionBodies" , "AuxiliaryDataSet" , "TransactionWitnessSets" - , "Int" , "Strings" , "PublicKeys" ] diff --git a/code-gen/parse-csl/src/Csl/Gen.hs b/code-gen/parse-csl/src/Csl/Gen.hs index 0d416fc..0bdfbfe 100644 --- a/code-gen/parse-csl/src/Csl/Gen.hs +++ b/code-gen/parse-csl/src/Csl/Gen.hs @@ -21,7 +21,6 @@ standardTypes :: Set String standardTypes = Set.fromList [ "String" , "Boolean" - , "Int" , "Effect" , "Number" , "Unit" @@ -46,10 +45,13 @@ exportListPurs funs cls = where fromType ty = [ty] classMethods :: Class -> [String] - classMethods (Class name ms) = map (mappend (toTypePrefix name <> "_") . toName . fun'name . method'fun) (filter (not . isCommon . method'fun) ms) + classMethods cls@(Class name ms) = + map (mappend (toTypePrefix name <> "_") . toName . fun'name . method'fun) + $ filterMethods cls hasNoClass = flip Set.member hasNoClassSet hasNoClassSet = Set.fromList ["This", "Uint32Array"] +-- Remove standard types and transform case postProcTypes :: [String] -> [String] postProcTypes = filter (not . flip Set.member standardTypes) . fmap toType . L.sort . L.nub @@ -59,7 +61,7 @@ funsTypes fs = (\Fun{..} -> filter (all isAlphaNum) $ fun'res : (arg'type <$> fu classTypes :: [Class] -> [String] classTypes xs = postProcTypes $ fromClass =<< xs where - fromClass Class{..} = class'name : (funsTypes $ method'fun <$> class'methods) + fromClass Class{..} = [class'name] typePurs :: String -> String typePurs ty = @@ -122,26 +124,6 @@ data FunSpec = FunSpec , funSpec'pureness :: Pureness } -isCommon :: Fun -> Bool -isCommon (Fun "free" _ _) = True -isCommon (Fun "to_bytes" _ _) = True -isCommon (Fun "from_bytes" _ _) = True -isCommon (Fun "to_hex" _ _) = True -isCommon (Fun "from_hex" _ _) = True -isCommon (Fun "to_json" _ _) = True -isCommon (Fun "from_json" _ _) = True -isCommon (Fun "to_js_value" _ _) = True -isCommon (Fun "from_js_value" _ _) = True --- sometimes these are with prefixes, sometimes not. they resist abstraction --- isCommon (Fun "from_bech32" _ _) = True --- isCommon (Fun "to_bech32" _ _) = True -isCommon (Fun "len" _ _) = True -isCommon (Fun "add" _ _) = True -isCommon (Fun "insert" _ _) = True -isCommon (Fun "get" _ _) = True -isCommon (Fun "keys" _ _) = True -isCommon (Fun _ _ _) = False - isListContainer :: Class -> Maybe String isListContainer (Class _ methods) = do guard $ all (`elem` methodNames) [ "add", "len", "get" ] @@ -183,6 +165,7 @@ funJsBy (FunSpec parent isSkipFirst prefix pureness) (Fun name args res) = , parent , "." , name + , if parent == "self" then ".bind(self)" else "" , ", " , L.intercalate ", " jsArgs , ")" @@ -192,6 +175,7 @@ funJsBy (FunSpec parent isSkipFirst prefix pureness) (Fun name args res) = [ parent , "." , name + , if parent == "self" then ".bind(self)" else "" , "(" , L.intercalate ", " jsArgs , ")" @@ -240,6 +224,26 @@ containerInstances cls@(Class name _) = notEmptyList [] = Nothing notEmptyList xs = Just xs +isCommon :: Fun -> Bool +isCommon (Fun "free" _ _) = True +isCommon (Fun "to_bytes" _ _) = True +isCommon (Fun "from_bytes" _ _) = True +isCommon (Fun "to_hex" _ _) = True +isCommon (Fun "from_hex" _ _) = True +isCommon (Fun "to_json" _ _) = True +isCommon (Fun "from_json" _ _) = True +isCommon (Fun "to_js_value" _ _) = True +isCommon (Fun "from_js_value" _ _) = True +-- sometimes these are with prefixes, sometimes not. they resist abstraction +-- isCommon (Fun "from_bech32" _ _) = True +-- isCommon (Fun "to_bech32" _ _) = True +isCommon (Fun "len" _ _) = True +isCommon (Fun "add" _ _) = True +isCommon (Fun "insert" _ _) = True +isCommon (Fun "get" _ _) = True +isCommon (Fun "keys" _ _) = True +isCommon (Fun _ _ _) = False + classPurs :: Class -> String classPurs cls@(Class name ms) = mappend "\n" $ L.intercalate "\n\n" $ fmap trim @@ -249,7 +253,8 @@ classPurs cls@(Class name ms) = mappend "\n" $ , instances ] where - filteredClass = Class name $ filter (not . isCommon . method'fun) ms + filteredMethods = filterMethods cls + filteredClass = Class name filteredMethods isNullType ty = elem '?' ty || isSuffixOf "| void" ty intro = unlines @@ -257,69 +262,16 @@ classPurs cls@(Class name ms) = mappend "\n" $ , "-- " <> toTitle name ] - valDef = unlines - [ preComment $ unwords [toTitle name, "class API"] - , unwords [valName, "::", valClassName] - , unwords [valName, "="] - , recordDef (fmap (\m -> psMethodName m <> ": " <> valMethodDef m) ms) - ] - where - valMethodDef m - | hasMaybes m = jsMaybeMethodName m - | hasThrow m = jsThrowMethodName m - | otherwise = jsMethodName m - - hasThrow Method{..} = canThrow name (fun'name method'fun) - - hasMaybes Method{..} = any isNullType types - where - types = fun'res method'fun : (arg'type <$> fun'args method'fun) - - methodComment m@Method{..} body = L.intercalate "\n" - [ body - , indent $ indent $ trim $ mapLines (indent . indent) $ postFunComment (withSelf name m) - ] - - classDef = - unlines - [ preComment $ unwords [toTitle name, "class"] - , unwords ["type", valClassName, "="] - , recordDef (fmap (\m -> methodComment m $ psMethodName m <> " :: " <> psSig UseNullable m) ms) - ] - recordDef = \case [] -> "{}" a:as -> unlines [indent $ "{ " <> a, unlines (fmap (indent . (", " <>)) as) <> indent "}" ] - methodDefs = unlines $ fmap toDef $ filter (not . isCommon . method'fun) ms + methodDefs = unlines $ fmap toDef $ filteredMethods where toDef m = unwords ["foreign import", jsMethodName m, "::", psSig UseNullable m] - psMethodName Method{..} = toName (fun'name method'fun) jsMethodName Method{..} = methodName name (fun'name method'fun) - jsMaybeMethodName m@Method{..} = toLam (toArgName <$> args) res - where - toArgName (n, _) = 'a' : show n - res = fromNullableRes (fun'res method'fun) $ unwords $ jsMethodName m : fmap fromArg args - args = zip [1..] $ addOnObj $ fun'args method'fun - - addOnObj - | isObj m = (Arg (toName name) (toType name) :) - | otherwise = id - - isPureMethod = isPure name method'fun - isDirtyMethod = not isPureMethod - - fromNullableRes resTy - | isNullType resTy && isPureMethod = mappend "Nullable.toMaybe $ " - | isNullType resTy && isDirtyMethod = mappend "Nullable.toMaybe <$> " - | otherwise = id - - fromArg arg@(_, Arg{..}) - | isNullType arg'type = "(" <> "Nullable.toNullable " <> toArgName arg <> ")" - | otherwise = toArgName arg - jsThrowMethodName m@Method{..} = toLam (toArgName <$> args) res where toArgName (n, _) = 'a' : show n @@ -345,15 +297,11 @@ classPurs cls@(Class name ms) = mappend "\n" $ argTys = handleNumArgs $ (if not (isObj m) then id else (toType name :)) $ fmap (handleVoid True . arg'type) $ fun'args $ method'fun resTy = let pureFun = isPure name method'fun - in (if pureFun then id else addTypePrefix "Effect") $ handleThrows $ handleVoid pureFun $ handleNumRes (fun'res $ method'fun) - - handleThrows - | canThrow name (fun'name method'fun) = addTypePrefix ty - | otherwise = id - where - ty = case nullType of - UseNullable -> "Nullable" - _ -> "Maybe" + in (case getPureness name method'fun of + Pure -> id + Mutating -> addTypePrefix "Effect" + Throwing -> addTypePrefix "Nullable" + ) $ handleVoid pureFun $ handleNumRes (fun'res $ method'fun) fromNullType = \case UseNullable -> "Nullable" @@ -378,27 +326,16 @@ classPurs cls@(Class name ms) = mappend "\n" $ _ -> False valName = toTypePrefix name - valClassName = toType name <> "Class" - instances - | name == "Int" = "" - | otherwise = unlines $ catMaybes $ - [ Just $ commonInstances cls - , containerInstances cls - ] + instances = unlines $ catMaybes $ + [ Just $ commonInstances cls + , containerInstances cls + ] proxyMethod str = unwords [str, "=", valName <> "." <> str] hasInstanceMethod str = Set.member str methodNameSet - -- | hasInstanceMethod "to_str" = with "to_str" - -- | hasInstanceMethod "to_hex" = with "to_hex" - -- | hasInstanceMethod "to_bech32" && getArgNum "to_bech32" == Just 0 = with "to_bech32" - -- | otherwise = Nothing - -- where - -- with name =Just $ toInst "Show" [instMethod "show" name] - - mutListInst :: Maybe String mutListInst = fmap go $ Map.lookup name listTypeMap where @@ -461,20 +398,25 @@ mapLines f = unlines . map f . lines indent :: String -> String indent str = " " <> str +filterMethods :: Class -> [Method] +filterMethods (Class name ms) + | name == "PublicKey" = ms -- PublicKey is a bit out of order. + | otherwise = filter (not . isCommon . method'fun) ms + classJs :: Class -> String -classJs (Class name ms) = - unlines $ pre : (methodJs name <$> filter (not . isCommon . method'fun) ms) +classJs cls@(Class name ms) = + unlines $ pre : (methodJs name <$> filterMethods cls) where pre = "// " <> name methodJs :: String -> Method -> String methodJs className m = toFun m where - toFun (Method ty f) - | fun'name f == "new" = funJsBy (FunSpec ("CSL." <> className) False pre (isPure className f)) f - | otherwise = case ty of - StaticMethod -> funJsBy (FunSpec ("CSL." <> className) False pre (isPure className f)) f - ObjectMethod -> funJsBy (FunSpec "self" True pre (isPure className f)) (f { fun'args = Arg "self" className : fun'args f }) + toFun (Method ty f) = case ty of + StaticMethod -> + funJsBy (FunSpec ("CSL." <> className) False pre (getPureness className f)) f + ObjectMethod -> + funJsBy (FunSpec "self" True pre (getPureness className f)) (f { fun'args = Arg "self" className : fun'args f }) pre = toTypePrefix className <> "_" withSelf :: String -> Method -> Fun @@ -541,23 +483,34 @@ lowerHead str where (pre, post) = span isUpper str -isPure :: String -> Fun -> Bool -isPure className Fun{..} = - fun'res /= "void" && not (dirtyClass className || dirtyMethods (className, fun'name)) - || isConvertor fun'name +data Pureness = Pure | Mutating | Throwing + deriving (Eq, Show) + +getPureness :: String -> Fun -> Pureness +getPureness className Fun{..} + | isConvertor fun'name = Pure + | (fun'res /= "void" && not isMutating && not isThrowing) = Pure + | isMutating && not isThrowing = Mutating + | otherwise = Throwing where - isConvertor a = Set.member a convertorSet + isMutating = dirtyClass className || mutatingMethods (className, fun'name) + isThrowing = Set.member (className, fun'name) throwingSet || isCommonThrowingMethod fun'name + isConvertor a = Set.member a convertorSet + +isPure :: String -> Fun -> Bool +isPure className fun = + getPureness className fun == Pure -convertorSet = Set.fromList $ (\x -> fmap (<> x ) ["to_", "from_"]) =<< +convertorSet = Set.fromList $ (\x -> fmap (<> x ) ["to_"]) =<< ["hex", "string", "bytes", "bech32", "json", "js_value"] -dirtyMethods :: (String, String) -> Bool -dirtyMethods a = Set.member a dirties +mutatingMethods :: (String, String) -> Bool +mutatingMethods a = Set.member a mutating -dirtyClass a = Set.member a dirtyClassSet +dirtyClass a = Set.member a mutatingClassSet -dirtyClassSet :: Set String -dirtyClassSet = Set.fromList +mutatingClassSet :: Set String +mutatingClassSet = Set.fromList [ "TransactionBuilder" , "TransactionWitnessSet" , "TransactionWitnessSets" @@ -594,8 +547,25 @@ listTypes = , ("Vkeywitnesses", "Vkeywitness") ] -dirties :: Set (String, String) -dirties = +throwingSet :: Set (String, String) +throwingSet = mconcat $ + [ inClass "BigNum" + [ "checked_mul" + , "checked_add" + , "checked_sub" + ] + , inClass "Value" + [ "checked_add" + , "checked_sub" + ] + , inClass "PublicKey" + [ "from_bytes" ] + ] + where + inClass name ms = Set.fromList $ fmap (name, ) ms + +mutating :: Set (String, String) +mutating = mconcat $ [ keys "Assets" , inClass "TransactionBuilder" ["new"] @@ -628,69 +598,11 @@ instance Num SigPos where -- | Which numbers should be treated as Int's. -- Position is in the Purs signature (with extended object methods) intPos :: Map (String, String) [SigPos] -intPos = - mconcat $ - [ inClass "BigNum" - [ ("compare", [ResPos]) - ] - , len "Assets" - , lenGetInsert "AuxiliaryDataSet" - , len "CostModel" - , lenSetGet "CostModel" - , len "Costmdls" - , len "GeneralTransactionMetadata" - , inClass "HeaderBody" - [ resPos "block_number" - , resPos "slot" - , resPos "block_body_size" - , ("new", [0, 1, 6]) - , ("new_header_body", [0, 6]) - ] - , len "MetadataMap" - , len "Mint" - , len "MintAssets" - , len "MultiAsset" - , len "PlutusMap" - , len "ProposedProtocolParameterUpdates" - , inClass "TransactionBuilderConfigBuilder" [argPos "max_value_size" 1, argPos "max_tx_size" 1] - , len "Withdrawals" - , inClass "Value" [resPos "compare"] - , inClass "Address" [resPos "network_id"] - , inClass "ByronAddress" [resPos "network_id"] - ] ++ map (list . fst) listTypes - where - resPos name = (name, [ResPos]) - argPos name n = (name, [ArgPos n]) - - inClass name ms = Map.fromList $ fmap (\(a, b) -> ((name, a), b)) ms - - len name = - inClass name - [ ("len", [ResPos]) - ] - - list name = - inClass name - [ ("get", [1]) - , ("len", [ResPos]) - ] - - lenGetInsert name = - inClass name - [ ("insert", [1]) - , ("get", [1]) - , ("len", [ResPos]) - ] - lenSetGet name = - inClass name - [ ("len", [ResPos]) - , ("set", [1]) - , ("get", [1]) - ] +intPos = mempty -- | Is function pure and can throw (in this case we can catch it to Maybe on purs side) -- if it's global function use empty name for class -canThrow :: String -> String -> Bool -canThrow _className methodName = Set.member methodName froms +isCommonThrowingMethod :: String -> Bool +isCommonThrowingMethod methodName = Set.member methodName froms where froms = Set.fromList ["from_hex", "from_bytes", "from_bech32", "from_json", "from_str"] From d18b0a6eb17538991bb4dfbf476efd62a8a3adde Mon Sep 17 00:00:00 2001 From: Vladimir Kalnitsky Date: Wed, 24 Jan 2024 19:59:43 +0400 Subject: [PATCH 04/18] Reorganize codegen --- app/Main.purs | 44 - code-gen/parse-csl/.gitignore | 1 + code-gen/parse-csl/app/Main.hs | 2 + code-gen/parse-csl/fixtures/Internal.purs | 70 +- code-gen/parse-csl/fixtures/imports.purs | 6 + code-gen/parse-csl/src/Csl/Gen.hs | 44 +- packages.dhall | 90 +- spago-packages.nix | 1006 ++ spago.dhall | 14 +- src/Cardano/Serialization/Lib.js | 889 ++ src/Cardano/Serialization/Lib.purs | 3207 ++++ src/Cardano/Serialization/Lib/Internal.js | 173 + src/Cardano/Serialization/Lib/Internal.purs | 173 + src/Csl.js | 2007 --- src/Csl.purs | 14209 ------------------ test/Main.purs | 8 + 16 files changed, 5645 insertions(+), 16298 deletions(-) delete mode 100644 app/Main.purs create mode 100644 spago-packages.nix create mode 100644 src/Cardano/Serialization/Lib.js create mode 100644 src/Cardano/Serialization/Lib.purs create mode 100644 src/Cardano/Serialization/Lib/Internal.js create mode 100644 src/Cardano/Serialization/Lib/Internal.purs delete mode 100644 src/Csl.js delete mode 100644 src/Csl.purs create mode 100644 test/Main.purs diff --git a/app/Main.purs b/app/Main.purs deleted file mode 100644 index 379fee7..0000000 --- a/app/Main.purs +++ /dev/null @@ -1,44 +0,0 @@ --- | Dynamic API for typescript export -module Main - ( main - --, txBuildExample - ) where - -import Prelude -import Effect (Effect) -import Effect.Console (logShow) -import Csl as Csl - --------------------------------------------------------- --- console tests - -main :: Effect Unit -main = do - logShow "hi" - logShow (Csl.fromStr' "1000" :: Csl.BigNum) - logShow $ max (Csl.fromStr' "1000" * (Csl.fromStr' "2") :: Csl.BigNum) one - logShow $ Csl.value.toJson $ Csl.value.new (Csl.fromStr' "1000") - logShow $ (Csl.fromBytes' $ Csl.bigNum.toBytes (Csl.fromStr' "1000") :: Csl.BigNum) - -txBuildExample :: Effect Unit -txBuildExample = do - let - addr = Csl.byronAddress.fromBase58 - "Ae2tdPwUPEZLs4HtbuNey7tK4hTKrwNwYtGqp7bDfCy2WdR3P6735W5Yfpe" - hash = Csl.fromHex' - "488afed67b342d41ec08561258e210352fba2ac030c98a8199bc22ec7a27ccf1" - let config = Csl.txBuilderConfigBuilder.build Csl.txBuilderConfigBuilder.new - builder <- Csl.txBuilder.new config - Csl.txBuilder.setFee builder (Csl.fromStr' "10") - Csl.txBuilder.setTtlBignum builder (Csl.fromStr' "100000") - Csl.txBuilder.addBootstrapIn builder addr (Csl.txIn.new hash 0.0) (Csl.value.new (Csl.fromStr' "3000000")) - Csl.txBuilder.addOut builder (Csl.txOut.new (Csl.byronAddress.toAddress addr) (Csl.value.new (Csl.fromStr' "10000000"))) - Csl.txBuilder.setCollateral builder =<< do - ins <- Csl.txInsBuilder.new - Csl.txInsBuilder.addBootstrapIn ins addr (Csl.txIn.new hash 0.0) (Csl.value.new (Csl.fromStr' "300000")) - pure ins - - logShow =<< Csl.txBuilder.fullSize builder - txBody <- Csl.txBuilder.build builder - logShow $ Csl.txHash.toHex $ Csl.hashTx txBody - diff --git a/code-gen/parse-csl/.gitignore b/code-gen/parse-csl/.gitignore index 7573d82..4adce4b 100644 --- a/code-gen/parse-csl/.gitignore +++ b/code-gen/parse-csl/.gitignore @@ -2,3 +2,4 @@ *~ stack.yaml.lock output/ +dist/ \ No newline at end of file diff --git a/code-gen/parse-csl/app/Main.hs b/code-gen/parse-csl/app/Main.hs index ca572a8..0a19686 100644 --- a/code-gen/parse-csl/app/Main.hs +++ b/code-gen/parse-csl/app/Main.hs @@ -14,6 +14,7 @@ main = do jsLibHeader <- readFile "./fixtures/Lib.js" importsCode <- readFile "./fixtures/imports.purs" pursInternalLib <- readFile "./fixtures/Internal.purs" + jsInternalLib <- readFile "./fixtures/Internal.purs" funs <- getFuns classes <- getClasses print funs @@ -44,5 +45,6 @@ main = do , funsJsCode ] writeFile (exportPath <> "Lib/Internal.purs") pursInternalLib + writeFile (exportPath <> "Lib/Internal.js") jsInternalLib pursLibHeader = "module Cardano.Serialization.Lib\n ( " diff --git a/code-gen/parse-csl/fixtures/Internal.purs b/code-gen/parse-csl/fixtures/Internal.purs index 493fc22..4ecde41 100644 --- a/code-gen/parse-csl/fixtures/Internal.purs +++ b/code-gen/parse-csl/fixtures/Internal.purs @@ -2,25 +2,27 @@ module Cardano.Serialization.Lib.Internal where import Prelude -import Aeson (Aeson, jsonToAeson, stringifyAeson) -import Data.ByteArray (ByteArray) -import Data.Argonaut (Json, JsonDecodeError(TypeMismatch), jsonParser) +import Aeson (Aeson, decodeAeson, encodeAeson, jsonToAeson, stringifyAeson) +import Data.Argonaut (Json, JsonDecodeError(TypeMismatch), jsonParser, stringify) import Data.Bifunctor (lmap) +import Data.ByteArray (ByteArray) import Data.Either (Either, note) import Data.Map (Map) import Data.Map as Map import Data.Maybe (Maybe(Nothing, Just)) +import Data.Profunctor.Strong ((***)) import Data.Tuple (Tuple(Tuple)) +import Data.Tuple.Nested (type (/\), (/\)) import Type.Proxy (Proxy(Proxy)) -- all types -class IsCsl a where +class IsCsl (a :: Type) where className :: Proxy a -> String -- byte-representable types -class IsBytes a +class IsCsl a <= IsBytes (a :: Type) toBytes :: forall a. IsCsl a => IsBytes a => a -> ByteArray toBytes = _toBytes @@ -40,11 +42,11 @@ foreign import _fromBytes -- json -class IsJson a +class IsCsl a <= IsJson (a :: Type) -- containers -class IsListContainer c e | c -> e +class IsListContainer (c :: Type) (e :: Type) | c -> e packListContainer :: forall c e. IsCsl c => IsListContainer c e => Array e -> c packListContainer = _packListContainer (className (Proxy :: Proxy c)) @@ -55,15 +57,17 @@ unpackListContainer = _unpackListContainer foreign import _packListContainer :: forall c e. String -> Array e -> c foreign import _unpackListContainer :: forall c e. c -> Array e -class IsMapContainer c k v | c -> k, c -> v +class IsMapContainer (c :: Type) (k :: Type) (v :: Type) | c -> k, c -> v packMapContainer :: forall c k v . IsMapContainer c k v => IsCsl c - => Array { key :: k, value :: v } + => Array (k /\ v) -> c -packMapContainer = _packMapContainer (className (Proxy :: Proxy c)) +packMapContainer = map toKeyValues >>> _packMapContainer (className (Proxy :: Proxy c)) + where + toKeyValues (Tuple key value) = { key, value } packMapContainerFromMap :: forall c k v @@ -73,16 +77,15 @@ packMapContainerFromMap => IsCsl v => Map k v -> c -packMapContainerFromMap = packMapContainer <<< map toKeyValues <<< Map.toUnfoldable - where - toKeyValues (Tuple key value) = { key, value } +packMapContainerFromMap = packMapContainer <<< Map.toUnfoldable unpackMapContainer :: forall c k v - . IsMapContainer c k v + . IsMapContainer c k v => c - -> Array { key :: k, value :: v } -unpackMapContainer = _unpackMapContainer + -> Array (k /\ v) +unpackMapContainer = _unpackMapContainer >>> map fromKV + where fromKV { key, value } = key /\ value unpackMapContainerToMapWith :: forall c k v k1 v1 @@ -94,9 +97,7 @@ unpackMapContainerToMapWith -> Map k1 v1 unpackMapContainerToMapWith mapKey mapValue container = unpackMapContainer container - # map toTuple >>> Map.fromFoldable - where - toTuple { key, value } = Tuple (mapKey key) (mapValue value) + # map (mapKey *** mapValue) >>> Map.fromFoldable foreign import _packMapContainer :: forall c k v @@ -114,7 +115,6 @@ foreign import _unpackMapContainer cslFromAeson :: forall a . IsJson a - => IsCsl a => Aeson -> Either JsonDecodeError a cslFromAeson aeson = @@ -127,6 +127,36 @@ cslToAeson => a -> Aeson cslToAeson = _cslToJson >>> jsonToAeson +cslToAesonViaBytes + :: forall a + . IsBytes a + => a -> Aeson +cslToAesonViaBytes = toBytes >>> encodeAeson + +cslFromAesonViaBytes + :: forall a + . IsBytes a + => Aeson -> Either JsonDecodeError a +cslFromAesonViaBytes aeson = do + bytes <- decodeAeson aeson + note (TypeMismatch $ className (Proxy :: Proxy a)) $ fromBytes bytes + +-- Show + +showViaBytes + :: forall a + . IsBytes a + => a + -> String +showViaBytes a = "(unsafePartial $ fromJust $ fromBytes " <> show (toBytes a) <> ")" + +showViaJson + :: forall a + . IsJson a + => a + -> String +showViaJson a = "(unsafePartial $ fromJust $ cslFromJson $ jsonParser " <> show (stringify (_cslToJson a)) <> ")" + --- Json cslFromJson :: forall a. IsCsl a => IsJson a => Json -> Maybe a diff --git a/code-gen/parse-csl/fixtures/imports.purs b/code-gen/parse-csl/fixtures/imports.purs index d8e99d0..a71e78b 100644 --- a/code-gen/parse-csl/fixtures/imports.purs +++ b/code-gen/parse-csl/fixtures/imports.purs @@ -3,14 +3,20 @@ import Prelude import Cardano.Serialization.Lib.Internal import Cardano.Serialization.Lib.Internal ( class IsBytes + , class IsCsl + , class IsJson , toBytes , fromBytes + , packListContainer , packMapContainer , packMapContainerFromMap , unpackMapContainerToMapWith , unpackMapContainer + , unpackListContainer , cslFromAeson , cslToAeson + , cslFromAesonViaBytes + , cslToAesonViaBytes ) as X import Effect import Data.Nullable diff --git a/code-gen/parse-csl/src/Csl/Gen.hs b/code-gen/parse-csl/src/Csl/Gen.hs index 0bdfbfe..c7c1d35 100644 --- a/code-gen/parse-csl/src/Csl/Gen.hs +++ b/code-gen/parse-csl/src/Csl/Gen.hs @@ -196,16 +196,28 @@ data HandleNulls = UseNullable | UseMaybe commonInstances :: Class -> String commonInstances (Class name methods) = unlines $ [ "instance IsCsl " <> name <> " where\n className _ = \"" <> name <> "\"" ] <> - (if hasInstanceMethod "to_bytes" && hasInstanceMethod "from_bytes" + (if hasBytes then [ "instance IsBytes " <> name ] else []) <> - (if hasInstanceMethod "to_json" && hasInstanceMethod "from_json" - then [ "instance IsJson " <> name - , "instance EncodeAeson " <> name <> " where encodeAeson = cslToAeson" - , "instance DecodeAeson " <> name <> " where decodeAeson = cslFromAeson" - ] - else []) + (if hasJson + then + [ "instance IsJson " <> name + , "instance EncodeAeson " <> name <> " where encodeAeson = cslToAeson" + , "instance DecodeAeson " <> name <> " where decodeAeson = cslFromAeson" + , "instance Show " <> name <> " where show = showViaJson" + ] + else + if hasBytes + then + [ "instance EncodeAeson " <> name <> " where encodeAeson = cslToAesonViaBytes" + , "instance DecodeAeson " <> name <> " where decodeAeson = cslFromAesonViaBytes" + , "instance Show " <> name <> " where show = showViaBytes" + ] + else [] + ) where + hasBytes = hasInstanceMethod "to_bytes" && hasInstanceMethod "from_bytes" + hasJson = hasInstanceMethod "to_json" && hasInstanceMethod "from_json" hasInstanceMethod str = Set.member str methodNameSet methodNameSet = Set.fromList $ fun'name . method'fun <$> methods @@ -400,7 +412,7 @@ indent str = " " <> str filterMethods :: Class -> [Method] filterMethods (Class name ms) - | name == "PublicKey" = ms -- PublicKey is a bit out of order. + | name `elem` ["PublicKey", "PrivateKey"] = ms -- these types need special handling | otherwise = filter (not . isCommon . method'fun) ms classJs :: Class -> String @@ -560,6 +572,10 @@ throwingSet = mconcat $ ] , inClass "PublicKey" [ "from_bytes" ] + , inClass "PrivateKey" + [ "from_normal_bytes" ] + , inClass "ByronAddress" + [ "from_base58" ] ] where inClass name ms = Set.fromList $ fmap (name, ) ms @@ -579,6 +595,8 @@ mutating = , keys "Mint" <> inClass "Mint" ["new_from_entry", "as_positive_multiasset", "as_negative_multiasset"] , keys "MintAssets" , inClass "MultiAsset" ["new", "len", "inset", "get", "get_asset", "set_asset", "keys", "sub"] + , inClass "Value" ["set_multiasset"] + , inClass "TransactionOutput" ["set_data_hash", "set_plutus_data", "set_script_ref"] , keys "PlutusMap" , keys "ProposedProtocolParameterUpdates" , keys "Withdrawals" @@ -605,4 +623,12 @@ intPos = mempty isCommonThrowingMethod :: String -> Bool isCommonThrowingMethod methodName = Set.member methodName froms where - froms = Set.fromList ["from_hex", "from_bytes", "from_bech32", "from_json", "from_str"] + froms = Set.fromList + [ "from_hex" + , "from_bytes" + , "from_normal_bytes" + , "from_extended_bytes" + , "from_bech32" + , "from_json" + , "from_str" + ] diff --git a/packages.dhall b/packages.dhall index 6af7ef8..a3a37b1 100644 --- a/packages.dhall +++ b/packages.dhall @@ -105,7 +105,91 @@ in upstream ------------------------------- -} let upstream = - https://github.com/purescript/package-sets/releases/download/psc-0.15.4-20220901/packages.dhall - sha256:f1531b29c21ac437ffe5666c1b6cc76f0a9c29d3c9d107ff047aa2567744994f + https://github.com/purescript/package-sets/releases/download/psc-0.15.4-20230105/packages.dhall + sha256:3e9fbc9ba03e9a1fcfd895f65e2d50ee2f5e86c4cd273f3d5c841b655a0e1bda + +let additions = + { aeson = + { dependencies = + [ "aff" + , "argonaut" + , "argonaut-codecs" + , "argonaut-core" + , "arrays" + , "bifunctors" + , "const" + , "control" + , "effect" + , "either" + , "exceptions" + , "foldable-traversable" + , "foreign-object" + , "integers" + , "js-bigints" + , "lists" + , "maybe" + , "mote" + , "numbers" + , "ordered-collections" + , "partial" + , "prelude" + , "quickcheck" + , "record" + , "spec" + , "strings" + , "tuples" + , "typelevel" + , "typelevel-prelude" + , "uint" + , "untagged-union" + ] + , repo = "https://github.com/mlabs-haskell/purescript-aeson.git" + , version = "v2.0.0" + } + , bignumber = + { dependencies = + [ "console" + , "effect" + , "either" + , "exceptions" + , "functions" + , "integers" + , "partial" + , "prelude" + , "tuples" + ] + , repo = "https://github.com/mlabs-haskell/purescript-bignumber" + , version = "760d11b41ece31b8cdd3c53349c5c2fd48d3ff89" + } + , mote = + { dependencies = [ "these", "transformers", "arrays" ] + , repo = "https://github.com/garyb/purescript-mote" + , version = "v1.1.0" + } + , js-bigints = + { dependencies = [ "integers", "maybe", "prelude" ] + , repo = "https://github.com/purescript-contrib/purescript-js-bigints" + , version = "36a7d8ac75a7230043ae511f3145f9ed130954a9" + } + , bytearrays = + { dependencies = + [ "aeson" + , "aff" + , "arraybuffer-types" + , "effect" + , "either" + , "foldable-traversable" + , "maybe" + , "newtype" + , "prelude" + , "quickcheck" + , "quickcheck-laws" + , "spec" + , "strings" + ] + , repo = "https://github.com/mlabs-haskell/purescript-bytearrays" + , version = "e3991d562a04d8825472551d91a06407ad9c9112" + } + } -in upstream \ No newline at end of file +in upstream // additions diff --git a/spago-packages.nix b/spago-packages.nix new file mode 100644 index 0000000..901dd7e --- /dev/null +++ b/spago-packages.nix @@ -0,0 +1,1006 @@ +# This file was generated by Spago2Nix + +{ pkgs ? import {} }: + +let + inputs = { + + "aeson" = pkgs.stdenv.mkDerivation { + name = "aeson"; + version = "v2.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/mlabs-haskell/purescript-aeson.git"; + rev = "4fddd518a143de563299d484272a0ef18daa7dcd"; + sha256 = "1bz1z9l6nwf5yk45sbbjllmqvci0n1l92cvk3lgmni19g9silbrl"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "aff" = pkgs.stdenv.mkDerivation { + name = "aff"; + version = "v7.1.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript-contrib/purescript-aff.git"; + rev = "6adec6ff048a7876f74c294c440374cd21342d39"; + sha256 = "1viplap030ym9ya033xl6x41hvdc12v9ngwp1v64ayl40a5m1d47"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "ansi" = pkgs.stdenv.mkDerivation { + name = "ansi"; + version = "v7.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/hdgarrood/purescript-ansi.git"; + rev = "7d898732d643a977a78004851112a4417909e126"; + sha256 = "1aml84m5p1s14kj29m39182byg44nf275p4cinx3kgwhv1gj0qcp"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "argonaut" = pkgs.stdenv.mkDerivation { + name = "argonaut"; + version = "v9.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript-contrib/purescript-argonaut.git"; + rev = "7505a47f2edb0c9cacaac4f11dcedf4723a3e9c8"; + sha256 = "18yxhlrwri6q858krz1klyq29fx8nvfm16c04wm2rn91mgyasn6x"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "argonaut-codecs" = pkgs.stdenv.mkDerivation { + name = "argonaut-codecs"; + version = "v9.1.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript-contrib/purescript-argonaut-codecs.git"; + rev = "f8fdc1e34142fa84e66022ea5d417a008d709146"; + sha256 = "1ncpl512k2xdaf7r5ixwxkm6i4vym7a6a3ih71z489h9ad781q73"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "argonaut-core" = pkgs.stdenv.mkDerivation { + name = "argonaut-core"; + version = "v7.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript-contrib/purescript-argonaut-core.git"; + rev = "68da81dd80ec36d3b013eff46dc067a972c22e5d"; + sha256 = "0hxl17ddbflkk0hchjgk5xj6j9fwp3b182w4g073p0dwscdl4f08"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "argonaut-traversals" = pkgs.stdenv.mkDerivation { + name = "argonaut-traversals"; + version = "v10.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript-contrib/purescript-argonaut-traversals.git"; + rev = "8d2403d8d57afb568933dbb36063d5670ce770a0"; + sha256 = "0v965bcl1hdp1hacbzxcm35kxxclixj0kpsdm816gs7m548z6l43"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "arraybuffer-types" = pkgs.stdenv.mkDerivation { + name = "arraybuffer-types"; + version = "v3.0.2"; + src = pkgs.fetchgit { + url = "https://github.com/purescript-contrib/purescript-arraybuffer-types.git"; + rev = "9b0b7a0f9ee034e039f3d3a2a9c3f74eb7c9264a"; + sha256 = "1q3111jk6jj64bxy86lc7ik6q5mgdz87bc086wj5rm57dmlivlxx"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "arrays" = pkgs.stdenv.mkDerivation { + name = "arrays"; + version = "v7.1.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-arrays.git"; + rev = "bb1b821530d368110eebf8a3541af90823e8af65"; + sha256 = "1mb9a4pb1bd7fj4vqj6msv5z27jbb5f89w3nczgjjhs02909phk9"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "assert" = pkgs.stdenv.mkDerivation { + name = "assert"; + version = "v6.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-assert.git"; + rev = "27c0edb57d2ee497eb5fab664f5601c35b613eda"; + sha256 = "02qpcsijil64qq4kcikv2ynxl85zkryvv0vmzjm6752956ymzi0j"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "avar" = pkgs.stdenv.mkDerivation { + name = "avar"; + version = "v5.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript-contrib/purescript-avar.git"; + rev = "d00f5784d9cc8f079babd62740f5c52b87e5caa5"; + sha256 = "132g0ccmjr8328xpaycww8b5wmx1vi3li4irxxqcjk5wi47i8c9h"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "bifunctors" = pkgs.stdenv.mkDerivation { + name = "bifunctors"; + version = "v6.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-bifunctors.git"; + rev = "16ba2fb6dd7f05528ebd9e2f9ca3a068b325e5b3"; + sha256 = "1qz5aaiq5w4g1rhjb63z47h6nqhw8hw23x1zw5alam047pq4vfkg"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "bytearrays" = pkgs.stdenv.mkDerivation { + name = "bytearrays"; + version = "e3991d562a04d8825472551d91a06407ad9c9112"; + src = pkgs.fetchgit { + url = "https://github.com/mlabs-haskell/purescript-bytearrays"; + rev = "e3991d562a04d8825472551d91a06407ad9c9112"; + sha256 = "0lyp1x8kgzg8ykv5yp8dd21ziypi9yzhzqpwv5l995kfm4mdglh2"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "catenable-lists" = pkgs.stdenv.mkDerivation { + name = "catenable-lists"; + version = "v7.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-catenable-lists.git"; + rev = "09abe1f4888bc00841ad2b59e56a9e7ce7ebd4ab"; + sha256 = "0fn6caspdnb0nrlj31sy7d5hxrhndfz7a2b9wfkxf5bv5vpjyawb"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "console" = pkgs.stdenv.mkDerivation { + name = "console"; + version = "v6.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-console.git"; + rev = "3b83d7b792d03872afeea5e62b4f686ab0f09842"; + sha256 = "0fr5l1myhscp910mybp04cg6g8f2hy3ikjfc8fkqlb2dm2cqzdfs"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "const" = pkgs.stdenv.mkDerivation { + name = "const"; + version = "v6.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-const.git"; + rev = "ab9570cf2b6e67f7e441178211db1231cfd75c37"; + sha256 = "0mcpwqqf5bcwxlzk53smvsjjz1ymlnq0ypphg6sc83ibw70g64f6"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "contravariant" = pkgs.stdenv.mkDerivation { + name = "contravariant"; + version = "v6.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-contravariant.git"; + rev = "9ad3e105b8855bcc25f4e0893c784789d05a58de"; + sha256 = "1xkd3rfs8v20w7mj6sj6dmhfb2vb1zpmjv245xj1rahk3g16qm7m"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "control" = pkgs.stdenv.mkDerivation { + name = "control"; + version = "v6.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-control.git"; + rev = "a6033808790879a17b2729e73747a9ed3fb2264e"; + sha256 = "05sdgywprwpav62d2bvlb80yd39brxhnmhhl1f116mm9hw5clqia"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "datetime" = pkgs.stdenv.mkDerivation { + name = "datetime"; + version = "v6.1.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-datetime.git"; + rev = "7f6062346055e654942caed6c44612b59031f059"; + sha256 = "0z5f62arrli0dgmggv6z2qkv1qc9isdivcn7njywsa8wmc4vd47n"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "distributive" = pkgs.stdenv.mkDerivation { + name = "distributive"; + version = "v6.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-distributive.git"; + rev = "6005e513642e855ebf6f884d24a35c2803ca252a"; + sha256 = "0x6cfsx9ff66kvw9l10pxd5vv16r91mmfxrfc68w1xfdfi81lhdx"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "effect" = pkgs.stdenv.mkDerivation { + name = "effect"; + version = "v4.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-effect.git"; + rev = "a192ddb923027d426d6ea3d8deb030c9aa7c7dda"; + sha256 = "0aa10lc6h9mlf4xf3g3ziig7v6kxdqvbh20kma8ay59w0b1bhmj1"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "either" = pkgs.stdenv.mkDerivation { + name = "either"; + version = "v6.1.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-either.git"; + rev = "af655a04ed2fd694b6688af39ee20d7907ad0763"; + sha256 = "05zps4klvgmvlm06f4hrycssm8q0pysbqnjsrk26lfvmid6mmg63"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "enums" = pkgs.stdenv.mkDerivation { + name = "enums"; + version = "v6.0.1"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-enums.git"; + rev = "cd373c580b69fdc00e412bddbc299adabe242cc5"; + sha256 = "1wk98ddmgyii1ifqawnhqkiqlrs405qcp3m12jsg1yp8jv6ppv47"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "exceptions" = pkgs.stdenv.mkDerivation { + name = "exceptions"; + version = "v6.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-exceptions.git"; + rev = "afab3c07c820bb49b6c5be50049db46a964a6161"; + sha256 = "04xrbrcjwsv8gj465ygrlqhv1majxmr6m242iazg6apxlr89hgvg"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "exists" = pkgs.stdenv.mkDerivation { + name = "exists"; + version = "v6.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-exists.git"; + rev = "f765b4ace7869c27b9c05949e18c843881f9173b"; + sha256 = "0xnxi8fsmi15wrpq5d99gg94glk8a45hpx7pf4pmxg5r6rn1vjvx"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "foldable-traversable" = pkgs.stdenv.mkDerivation { + name = "foldable-traversable"; + version = "v6.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-foldable-traversable.git"; + rev = "b3926f870532d287ea59e2d5cd3873b81ef2a93a"; + sha256 = "0xg8qvyc6r9wqgy7wnw1rjqljl4wpgdrkxsm5x9rsagj2k5brxip"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "foreign" = pkgs.stdenv.mkDerivation { + name = "foreign"; + version = "v7.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-foreign.git"; + rev = "2dd222d1ec7363fa0a0a7adb0d8eaf81bb7006dd"; + sha256 = "0ycjaal8b2rsg3zl3b7acv166vjfdvziiza3fs8nhfw0rx0xmm1m"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "foreign-object" = pkgs.stdenv.mkDerivation { + name = "foreign-object"; + version = "v4.1.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-foreign-object.git"; + rev = "9bfb4eb6271b151414594cfec669fb4b18b91bd1"; + sha256 = "1fr5hwzkan7yv2kbgvii2b8kanhjkqrbixcyj7kyv9fwkk8dk96a"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "fork" = pkgs.stdenv.mkDerivation { + name = "fork"; + version = "v6.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript-contrib/purescript-fork.git"; + rev = "a5c3bc6f357e97669e8c29c6f79f5f55be0d42c0"; + sha256 = "0yzh55vfrhrr660ni3sbbljypjirbka5jlks4zibqmhwrmy3wnj9"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "free" = pkgs.stdenv.mkDerivation { + name = "free"; + version = "v7.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-free.git"; + rev = "e2d8fa8023a864363857834e11393483bced5e38"; + sha256 = "0gyy0k297m26gw76w7kx8k1zjczlqbqb3nmh2h4gb3r84gl05g6r"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "functions" = pkgs.stdenv.mkDerivation { + name = "functions"; + version = "v6.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-functions.git"; + rev = "f626f20580483977c5b27a01aac6471e28aff367"; + sha256 = "1bsf2y8hx103a92yrc6m05q2dv51ckag1srd7q5n9vaf2k9byrj9"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "functors" = pkgs.stdenv.mkDerivation { + name = "functors"; + version = "v5.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-functors.git"; + rev = "022ffd7a2a7ec12080314f3d217b400674a247b4"; + sha256 = "1pnw3r1nk0rx8mrw3ajjml40zvx9v26qrqwj77pz7hpwxigxfbff"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "gen" = pkgs.stdenv.mkDerivation { + name = "gen"; + version = "v4.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-gen.git"; + rev = "9fbcc2a1261c32e30d79c5418edef4d96fe76931"; + sha256 = "0kajzcp9a8dmqvb3ga27hlf18m2smbp98a0bmzzb9vv156ckw0b4"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "identity" = pkgs.stdenv.mkDerivation { + name = "identity"; + version = "v6.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-identity.git"; + rev = "ef6768f8a52ab0bc943a85f5761ba07c257f639f"; + sha256 = "1lh0pkwwdyd8q9bgf4l1m96gdnardki4r2s359cnhrwp94b43fyr"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "integers" = pkgs.stdenv.mkDerivation { + name = "integers"; + version = "v6.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-integers.git"; + rev = "54d712b25c594833083d15dc9ff2418eb9c52822"; + sha256 = "04j9sqvkgyxxvbm8jfc2118wzmgswn8jva9fysgbsnmsg9vcxfm6"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "invariant" = pkgs.stdenv.mkDerivation { + name = "invariant"; + version = "v6.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-invariant.git"; + rev = "1d2a196d51e90623adb88496c2cfd759c6736894"; + sha256 = "07rqag47ykdiqc5yfbc1a64ijaqliljhcw1vgbv81m7ljzzd2xna"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "js-bigints" = pkgs.stdenv.mkDerivation { + name = "js-bigints"; + version = "36a7d8ac75a7230043ae511f3145f9ed130954a9"; + src = pkgs.fetchgit { + url = "https://github.com/purescript-contrib/purescript-js-bigints"; + rev = "36a7d8ac75a7230043ae511f3145f9ed130954a9"; + sha256 = "0q3j7jl6ga63ygw2hmfigxjq8nbj56p3bn94x7vnhnhq7996bkpd"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "lazy" = pkgs.stdenv.mkDerivation { + name = "lazy"; + version = "v6.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-lazy.git"; + rev = "48347841226b27af5205a1a8ec71e27a93ce86fd"; + sha256 = "0dxlc3b2bdqsri45i7a9bvwvv0gg43cc1gq61zi41f290a29ny2q"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "lcg" = pkgs.stdenv.mkDerivation { + name = "lcg"; + version = "v4.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-lcg.git"; + rev = "67c6c6483a563a59ae036d9dca0f1be2835326a5"; + sha256 = "1shzn6zvc1cxd7v0bvfsk7x3xf59vxby8c5lfjvd746r6396zn65"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "lists" = pkgs.stdenv.mkDerivation { + name = "lists"; + version = "v7.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-lists.git"; + rev = "b113451e5b41cad87d669a3165f955c71cd863e2"; + sha256 = "1mg7vy44k8jlqkri7x4ikciixx92b17wi35887x09dwdsicjf0sx"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "literals" = pkgs.stdenv.mkDerivation { + name = "literals"; + version = "v1.0.2"; + src = pkgs.fetchgit { + url = "https://github.com/rowtype-yoga/purescript-literals.git"; + rev = "ae3ef4e9c1ae7c57ec77bd13906fa60ae8abba4a"; + sha256 = "1dvzi3qx6jbfw2g28wgbh1s9zv8z59wrf7r7jhib4g5ibgzq5r8q"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "maybe" = pkgs.stdenv.mkDerivation { + name = "maybe"; + version = "v6.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-maybe.git"; + rev = "c6f98ac1088766287106c5d9c8e30e7648d36786"; + sha256 = "0n33g8c579vcs06ii0r7f14jjdwzjw7p583w4nmrv9h442q2cvlz"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "mmorph" = pkgs.stdenv.mkDerivation { + name = "mmorph"; + version = "v7.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/Thimoteus/purescript-mmorph.git"; + rev = "94bc558ac34184d5236a7a9b2463dcc7551ced8e"; + sha256 = "0m3m1kjy4i9lwzj8l5qlafxawyhbdxj035wa5ys4j8v4013a92xg"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "mote" = pkgs.stdenv.mkDerivation { + name = "mote"; + version = "v1.1.0"; + src = pkgs.fetchgit { + url = "https://github.com/garyb/purescript-mote"; + rev = "29aea4ad7b013d50b42629c87b01cf0202451abd"; + sha256 = "00nckcd7w4djx9jh1hmg0fma55k6k7cw6pdcb96w107gykxgv5r7"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "newtype" = pkgs.stdenv.mkDerivation { + name = "newtype"; + version = "v5.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-newtype.git"; + rev = "29d8e6dd77aec2c975c948364ec3faf26e14ee7b"; + sha256 = "0kfc644zn2f9rpx8fy4gjvmz04k9mv1c2xrqis8m3s0ydnhbffd7"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "nonempty" = pkgs.stdenv.mkDerivation { + name = "nonempty"; + version = "v7.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-nonempty.git"; + rev = "28150ecc7419238b187abd609a92a645273348bb"; + sha256 = "1mwdc2sny2ygp67kyk7h2493vq7syf7j18s3d9a5gwf1y7jlf7gh"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "now" = pkgs.stdenv.mkDerivation { + name = "now"; + version = "v6.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript-contrib/purescript-now.git"; + rev = "b5ffed2381e5fefc063f484e607e8499e79eaf32"; + sha256 = "01khmqs4iz7dhlvd43zxj19q0c0vvqf1m128vgvgxz5mv430zfgr"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "nullable" = pkgs.stdenv.mkDerivation { + name = "nullable"; + version = "v6.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript-contrib/purescript-nullable.git"; + rev = "3202744c6c65e8d1fbba7f4256a1c482078e7fb5"; + sha256 = "10s3b54pjmr2rxlyzvc8yc99k1dpn0qrijnc4y65yj5z6bxf2791"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "numbers" = pkgs.stdenv.mkDerivation { + name = "numbers"; + version = "v9.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-numbers.git"; + rev = "2a53528f18f9415334bae28e7bb3cf3be86342c2"; + sha256 = "1h4v6ir1hq6gvkk0kla38vlcd6bv73xkc8pv71jygwqxrdwfxxgw"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "ordered-collections" = pkgs.stdenv.mkDerivation { + name = "ordered-collections"; + version = "v3.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-ordered-collections.git"; + rev = "9826b7632d0d0a691173bde308a634195f42a419"; + sha256 = "1wk8mcn1zsxi0yk9ybas2v7m0drb492806gld1xxxic8x1i19ws0"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "orders" = pkgs.stdenv.mkDerivation { + name = "orders"; + version = "v6.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-orders.git"; + rev = "f86db621ec5eef1274145f8b1fd8ebbfe0ed4a2c"; + sha256 = "14fjls3v14ia6fr2w4p0i5dqv10zk343wg28m4c77a17jmvbs9r4"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "parallel" = pkgs.stdenv.mkDerivation { + name = "parallel"; + version = "v6.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-parallel.git"; + rev = "85290dca837771ac4870071008c933d315ef678f"; + sha256 = "0bpwvzq4dn7vx5mfj12w1zvvnamc6w2c45c2v54b9yw36snnwpcf"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "partial" = pkgs.stdenv.mkDerivation { + name = "partial"; + version = "v4.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-partial.git"; + rev = "0fa0646f5ea1ec5f0c46dcbd770c705a6c9ad3ec"; + sha256 = "04s1h0r3slyd8kcamhqqrr6piksl9y76nmf2418j0ifhp16qwxmm"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "pipes" = pkgs.stdenv.mkDerivation { + name = "pipes"; + version = "v8.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/felixschl/purescript-pipes.git"; + rev = "e3bdc0b0db0a67e89a717b6118b23e78a380e23f"; + sha256 = "1jz3bfbl8b0hgbcm9y98bv2z29b072v1k8snp19vb2xql1zd40sx"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "prelude" = pkgs.stdenv.mkDerivation { + name = "prelude"; + version = "v6.0.1"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-prelude.git"; + rev = "f4cad0ae8106185c9ab407f43cf9abf05c256af4"; + sha256 = "0j6mb9w728ifcp10jdv7l9k7k5pw8j1f0fa7xyb8xmbxzc59xqpy"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "profunctor" = pkgs.stdenv.mkDerivation { + name = "profunctor"; + version = "v6.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-profunctor.git"; + rev = "0a966a14e7b0c827d44657dc1710cdc712d2e034"; + sha256 = "07rhk8micbc74my6s53xbj2smvvwah2w1drqrcmcnncxdks3lqg3"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "profunctor-lenses" = pkgs.stdenv.mkDerivation { + name = "profunctor-lenses"; + version = "v8.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript-contrib/purescript-profunctor-lenses.git"; + rev = "973d567afe458fd802cf4f0d9725b6dc35ad9297"; + sha256 = "0axz7nznn12iqh6sn9qjg6i8qglpdsqgkp30ndwdj98czcnbnybv"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "psci-support" = pkgs.stdenv.mkDerivation { + name = "psci-support"; + version = "v6.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-psci-support.git"; + rev = "897cdb543548cb6078d69b6413b54841404eda72"; + sha256 = "1ix53r8avkn3fw72mngwzw7v6c6mv7j4miw5mrgjrh9hb8p2ydl1"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "quickcheck" = pkgs.stdenv.mkDerivation { + name = "quickcheck"; + version = "v8.0.1"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-quickcheck.git"; + rev = "bf5029f97e6c0d7552d3a08d2ab793a19e2c5e3d"; + sha256 = "142dvh57fl8b6i7mm37a38v7vkc1znbqz6l6wqa704m53hkikvyd"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "quickcheck-laws" = pkgs.stdenv.mkDerivation { + name = "quickcheck-laws"; + version = "v7.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript-contrib/purescript-quickcheck-laws.git"; + rev = "04f00fb78d88f38a2f2bb73b75f97ce5bf5624fc"; + sha256 = "0izp71wq253k9wih2hspfs4p1s36yins2a5mh13yl57pf1srbrky"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "random" = pkgs.stdenv.mkDerivation { + name = "random"; + version = "v6.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-random.git"; + rev = "9540bc965a9596da02fefd9949418bb19c92533a"; + sha256 = "0qz14qviz5053j9h1jwpk0gnn692hcdx6fp90wckzrnw31d53174"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "record" = pkgs.stdenv.mkDerivation { + name = "record"; + version = "v4.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-record.git"; + rev = "c89cd1ada6b636692571fc374196b1c39c4c9f70"; + sha256 = "1g7s2h1as5cz824wpm0jhjprrh66shha5i4gq37q73yw0s5p2ahm"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "refs" = pkgs.stdenv.mkDerivation { + name = "refs"; + version = "v6.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-refs.git"; + rev = "f8e6216da4cb9309fde1f20cd6f69ac3a3b7f9e8"; + sha256 = "09bvfxhjfwfwv55py45s71maazwrr68k0rk4v8ynfqv91h34319h"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "safe-coerce" = pkgs.stdenv.mkDerivation { + name = "safe-coerce"; + version = "v2.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-safe-coerce.git"; + rev = "7fa799ae80a38b8d948efcb52608e58e198b3da7"; + sha256 = "00m4l733gpl0153cbl6n5kly7jr8ids399apza2rbczif40brp9g"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "spec" = pkgs.stdenv.mkDerivation { + name = "spec"; + version = "v7.2.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript-spec/purescript-spec.git"; + rev = "1ae536c4d9848d26087fe5e0606409740aa421b7"; + sha256 = "1vyk0fn39qfwx4i7vanazr5v0q0w0sxsxzmlliwlpcb9kvd1b2b3"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "st" = pkgs.stdenv.mkDerivation { + name = "st"; + version = "v6.2.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-st.git"; + rev = "fc2fe2972bb12e6a2bd3b295baf01577240c23ac"; + sha256 = "17syc11gxhi1law4lskrr4swr62n4r7irj5imdyjjp8z0p5c6p8z"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "strings" = pkgs.stdenv.mkDerivation { + name = "strings"; + version = "v6.0.1"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-strings.git"; + rev = "3d3e2f7197d4f7aacb15e854ee9a645489555fff"; + sha256 = "1dx6l4j4yw6w6nxa687gf04q4caa99ccl4cp4q22nda6ghsz7yjl"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "tailrec" = pkgs.stdenv.mkDerivation { + name = "tailrec"; + version = "v6.1.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-tailrec.git"; + rev = "5661a10afbd4849bd2e45139ea567beb40b20f9f"; + sha256 = "0snhrvkpd429r0d0bzs0mxwwz3am9bpa1m9f5a9hpmyjjkl7gddw"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "these" = pkgs.stdenv.mkDerivation { + name = "these"; + version = "v6.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript-contrib/purescript-these.git"; + rev = "ad4de7d2bb9ce684a9dff5def6489630736985b8"; + sha256 = "1i73qz7pk11mbiymhfg21i3nq92hqjmqzj4gjp1n6l2zkm0lmql3"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "transformers" = pkgs.stdenv.mkDerivation { + name = "transformers"; + version = "v6.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-transformers.git"; + rev = "be72ab52357d9a665cbf93d73ba1c07c4b0957ee"; + sha256 = "0ijrdsppl8vx0rlbwc9p0vjbmvwlcy4ia7xymvk6y34zbxzjlzm6"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "tuples" = pkgs.stdenv.mkDerivation { + name = "tuples"; + version = "v7.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-tuples.git"; + rev = "4f52da2729b448c8564369378f1232d8d2dc1d8b"; + sha256 = "1m1ng0xxicb73945jymcl1hn2y2hmynlnmhb2k0kkn1jrjwgcc3d"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "type-equality" = pkgs.stdenv.mkDerivation { + name = "type-equality"; + version = "v4.0.1"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-type-equality.git"; + rev = "0525b7d39e0fbd81b4209518139fb8ab02695774"; + sha256 = "1ass38jdycsjisdimdc4drg2w8vkkwp6lkvz3kvy7q0h98vdmlbr"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "typelevel" = pkgs.stdenv.mkDerivation { + name = "typelevel"; + version = "v6.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/bodil/purescript-typelevel.git"; + rev = "c7917aa6d43440608e6e04332e4c916a45976313"; + sha256 = "0gxj926ppx6d8inir589x0a30iv29hqc2y6vsa1n1c2vlcqv2zgd"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "typelevel-prelude" = pkgs.stdenv.mkDerivation { + name = "typelevel-prelude"; + version = "v7.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-typelevel-prelude.git"; + rev = "dca2fe3c8cfd5527d4fe70c4bedfda30148405bf"; + sha256 = "0x86mrg33kpnrnsfp4p3c92j5lpyqzy87bxdynwf7smk3inqr2jc"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "uint" = pkgs.stdenv.mkDerivation { + name = "uint"; + version = "v7.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript-contrib/purescript-uint.git"; + rev = "9e4f76ffd5192472f75583844172fe8ab3c0cb9f"; + sha256 = "173bhrd006q53s7agwyasxhfbr89x9jpz5b47vm2fr74l3jcw3lq"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "unfoldable" = pkgs.stdenv.mkDerivation { + name = "unfoldable"; + version = "v6.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-unfoldable.git"; + rev = "493dfe04ed590e20d8f69079df2f58486882748d"; + sha256 = "15z2k639ph8wdkrc2y838m5am1z7szw2vqymmv021skzisyn7zwf"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "unsafe-coerce" = pkgs.stdenv.mkDerivation { + name = "unsafe-coerce"; + version = "v6.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/purescript/purescript-unsafe-coerce.git"; + rev = "ab956f82e66e633f647fb3098e8ddd3ec58d689f"; + sha256 = "0r6d3dx8jalfzvrvkagz9v05yxwkkhgbzlpswg4w1cyl03zjcla4"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + "untagged-union" = pkgs.stdenv.mkDerivation { + name = "untagged-union"; + version = "v1.0.0"; + src = pkgs.fetchgit { + url = "https://github.com/rowtype-yoga/purescript-untagged-union.git"; + rev = "ed8262a966e15e751322c327e2759a9b9c0ef3f3"; + sha256 = "163blv01abd3dhcpqz499851lhwnmb4dlfbzkr3cs53d30w3yldx"; + }; + phases = "installPhase"; + installPhase = "ln -s $src $out"; + }; + + }; + + cpPackage = pkg: + let + target = ".spago/${pkg.name}/${pkg.version}"; + in '' + if [ ! -e ${target} ]; then + echo "Installing ${target}." + mkdir -p ${target} + cp --no-preserve=mode,ownership,timestamp -r ${toString pkg.outPath}/* ${target} + else + echo "${target} already exists. Skipping." + fi + ''; + + getGlob = pkg: ''".spago/${pkg.name}/${pkg.version}/src/**/*.purs"''; + + getStoreGlob = pkg: ''"${pkg.outPath}/src/**/*.purs"''; + +in { + inherit inputs; + + installSpagoStyle = pkgs.writeShellScriptBin "install-spago-style" '' + set -e + echo installing dependencies... + ${builtins.toString (builtins.map cpPackage (builtins.attrValues inputs))} + echo "echo done." + ''; + + buildSpagoStyle = pkgs.writeShellScriptBin "build-spago-style" '' + set -e + echo building project... + purs compile ${builtins.toString (builtins.map getGlob (builtins.attrValues inputs))} "$@" + echo done. + ''; + + buildFromNixStore = pkgs.writeShellScriptBin "build-from-store" '' + set -e + echo building project using sources from nix store... + purs compile ${builtins.toString ( + builtins.map getStoreGlob (builtins.attrValues inputs))} "$@" + echo done. + ''; + + mkBuildProjectOutput = + { src, purs }: + + pkgs.stdenv.mkDerivation { + name = "build-project-output"; + src = src; + + buildInputs = [ purs ]; + + installPhase = '' + mkdir -p $out + purs compile "$src/**/*.purs" ${builtins.toString + (builtins.map + (x: ''"${x.outPath}/src/**/*.purs"'') + (builtins.attrValues inputs))} + mv output $out + ''; + }; +} diff --git a/spago.dhall b/spago.dhall index 4dbad8b..8f751eb 100644 --- a/spago.dhall +++ b/spago.dhall @@ -12,17 +12,19 @@ to generate this file without the comments in this block. -} { name = "my-project" , dependencies = - [ "arraybuffer-types" - , "console" + [ "aeson" + , "argonaut" + , "bifunctors" + , "bytearrays" , "effect" , "either" , "maybe" , "nullable" - , "partial" + , "ordered-collections" , "prelude" - , "foldable-traversable" - , "argonaut-core" + , "profunctor" + , "tuples" ] , packages = ./packages.dhall -, sources = [ "src/**/*.purs", "test/**/*.purs", "app/**/*.purs" ] +, sources = [ "src/**/*.purs", "test/**/*.purs" ] } diff --git a/src/Cardano/Serialization/Lib.js b/src/Cardano/Serialization/Lib.js new file mode 100644 index 0000000..d45e729 --- /dev/null +++ b/src/Cardano/Serialization/Lib.js @@ -0,0 +1,889 @@ +"use strict"; + +import * as CSL from "@mlabs-haskell/cardano-serialization-lib-gc"; + +// Pass in a function and its list of arguments, that is expected to fail on evaluation, wraps in Either +function errorableToPurs(f, ...vars) { + try { + return f(...vars) || null; + } + catch (err) { + return null; + } + } + +// Address +export const address_toBech32 = self => prefix => self.to_bech32.bind(self)(prefix); +export const address_fromBech32 = bech_str => errorableToPurs(CSL.Address.from_bech32, bech_str); +export const address_networkId = self => self.network_id.bind(self)(); + +// AssetName +export const assetName_new = name => CSL.AssetName.new(name); +export const assetName_name = self => self.name.bind(self)(); + +// AssetNames +export const assetNames_new = () => CSL.AssetNames.new(); + +// Assets +export const assets_new = () => CSL.Assets.new(); + +// AuxiliaryData +export const auxiliaryData_new = () => CSL.AuxiliaryData.new(); +export const auxiliaryData_metadata = self => self.metadata.bind(self)(); +export const auxiliaryData_setMetadata = self => metadata => errorableToPurs(self.set_metadata.bind(self), metadata); +export const auxiliaryData_nativeScripts = self => () => self.native_scripts.bind(self)(); +export const auxiliaryData_setNativeScripts = self => native_scripts => errorableToPurs(self.set_native_scripts.bind(self), native_scripts); +export const auxiliaryData_plutusScripts = self => () => self.plutus_scripts.bind(self)(); +export const auxiliaryData_setPlutusScripts = self => plutus_scripts => errorableToPurs(self.set_plutus_scripts.bind(self), plutus_scripts); +export const auxiliaryData_preferAlonzoFormat = self => self.prefer_alonzo_format.bind(self)(); +export const auxiliaryData_setPreferAlonzoFormat = self => prefer => errorableToPurs(self.set_prefer_alonzo_format.bind(self), prefer); + +// AuxiliaryDataHash +export const auxiliaryDataHash_toBech32 = self => prefix => self.to_bech32.bind(self)(prefix); +export const auxiliaryDataHash_fromBech32 = bech_str => errorableToPurs(CSL.AuxiliaryDataHash.from_bech32, bech_str); + +// BaseAddress +export const baseAddress_new = network => payment => stake => CSL.BaseAddress.new(network, payment, stake); +export const baseAddress_paymentCred = self => self.payment_cred.bind(self)(); +export const baseAddress_stakeCred = self => self.stake_cred.bind(self)(); +export const baseAddress_toAddress = self => self.to_address.bind(self)(); +export const baseAddress_fromAddress = addr => CSL.BaseAddress.from_address(addr); + +// BigInt +export const bigInt_isZero = self => self.is_zero.bind(self)(); +export const bigInt_asU64 = self => self.as_u64.bind(self)(); +export const bigInt_asInt = self => self.as_int.bind(self)(); +export const bigInt_fromStr = text => errorableToPurs(CSL.BigInt.from_str, text); +export const bigInt_toStr = self => self.to_str.bind(self)(); +export const bigInt_mul = self => other => self.mul.bind(self)(other); +export const bigInt_one = CSL.BigInt.one(); +export const bigInt_increment = self => self.increment.bind(self)(); +export const bigInt_divCeil = self => other => self.div_ceil.bind(self)(other); + +// BigNum +export const bigNum_fromStr = string => errorableToPurs(CSL.BigNum.from_str, string); +export const bigNum_toStr = self => self.to_str.bind(self)(); +export const bigNum_zero = CSL.BigNum.zero(); +export const bigNum_one = CSL.BigNum.one(); +export const bigNum_isZero = self => self.is_zero.bind(self)(); +export const bigNum_divFloor = self => other => self.div_floor.bind(self)(other); +export const bigNum_checkedMul = self => other => errorableToPurs(self.checked_mul.bind(self), other); +export const bigNum_checkedAdd = self => other => errorableToPurs(self.checked_add.bind(self), other); +export const bigNum_checkedSub = self => other => errorableToPurs(self.checked_sub.bind(self), other); +export const bigNum_clampedSub = self => other => self.clamped_sub.bind(self)(other); +export const bigNum_compare = self => rhs_value => self.compare.bind(self)(rhs_value); +export const bigNum_lessThan = self => rhs_value => self.less_than.bind(self)(rhs_value); +export const bigNum_maxValue = CSL.BigNum.max_value(); +export const bigNum_max = a => b => CSL.BigNum.max(a, b); + +// Bip32PrivateKey +export const bip32PrivateKey_derive = self => index => self.derive.bind(self)(index); +export const bip32PrivateKey_from128Xprv = bytes => CSL.Bip32PrivateKey.from_128_xprv(bytes); +export const bip32PrivateKey_to128Xprv = self => self.to_128_xprv.bind(self)(); +export const bip32PrivateKey_generateEd25519Bip32 = CSL.Bip32PrivateKey.generate_ed25519_bip32(); +export const bip32PrivateKey_toRawKey = self => self.to_raw_key.bind(self)(); +export const bip32PrivateKey_toPublic = self => self.to_public.bind(self)(); +export const bip32PrivateKey_asBytes = self => self.as_bytes.bind(self)(); +export const bip32PrivateKey_fromBech32 = bech32_str => errorableToPurs(CSL.Bip32PrivateKey.from_bech32, bech32_str); +export const bip32PrivateKey_toBech32 = self => self.to_bech32.bind(self)(); +export const bip32PrivateKey_fromBip39Entropy = entropy => password => CSL.Bip32PrivateKey.from_bip39_entropy(entropy, password); +export const bip32PrivateKey_chaincode = self => self.chaincode.bind(self)(); + +// Bip32PublicKey +export const bip32PublicKey_derive = self => index => self.derive.bind(self)(index); +export const bip32PublicKey_toRawKey = self => self.to_raw_key.bind(self)(); +export const bip32PublicKey_asBytes = self => self.as_bytes.bind(self)(); +export const bip32PublicKey_fromBech32 = bech32_str => errorableToPurs(CSL.Bip32PublicKey.from_bech32, bech32_str); +export const bip32PublicKey_toBech32 = self => self.to_bech32.bind(self)(); +export const bip32PublicKey_chaincode = self => self.chaincode.bind(self)(); + +// BlockHash +export const blockHash_toBech32 = self => prefix => self.to_bech32.bind(self)(prefix); +export const blockHash_fromBech32 = bech_str => errorableToPurs(CSL.BlockHash.from_bech32, bech_str); + +// BootstrapWitness +export const bootstrapWitness_vkey = self => self.vkey.bind(self)(); +export const bootstrapWitness_signature = self => self.signature.bind(self)(); +export const bootstrapWitness_chainCode = self => self.chain_code.bind(self)(); +export const bootstrapWitness_attributes = self => self.attributes.bind(self)(); +export const bootstrapWitness_new = vkey => signature => chain_code => attributes => CSL.BootstrapWitness.new(vkey, signature, chain_code, attributes); + +// BootstrapWitnesses +export const bootstrapWitnesses_new = () => CSL.BootstrapWitnesses.new(); + +// ByronAddress +export const byronAddress_toBase58 = self => self.to_base58.bind(self)(); +export const byronAddress_byronProtocolMagic = self => self.byron_protocol_magic.bind(self)(); +export const byronAddress_attributes = self => self.attributes.bind(self)(); +export const byronAddress_networkId = self => self.network_id.bind(self)(); +export const byronAddress_fromBase58 = s => errorableToPurs(CSL.ByronAddress.from_base58, s); +export const byronAddress_icarusFromKey = key => protocol_magic => CSL.ByronAddress.icarus_from_key(key, protocol_magic); +export const byronAddress_isValid = s => CSL.ByronAddress.is_valid(s); +export const byronAddress_toAddress = self => self.to_address.bind(self)(); +export const byronAddress_fromAddress = addr => CSL.ByronAddress.from_address(addr); + +// Certificate +export const certificate_newStakeRegistration = stake_registration => CSL.Certificate.new_stake_registration(stake_registration); +export const certificate_newStakeDeregistration = stake_deregistration => CSL.Certificate.new_stake_deregistration(stake_deregistration); +export const certificate_newStakeDelegation = stake_delegation => CSL.Certificate.new_stake_delegation(stake_delegation); +export const certificate_newPoolRegistration = pool_registration => CSL.Certificate.new_pool_registration(pool_registration); +export const certificate_newPoolRetirement = pool_retirement => CSL.Certificate.new_pool_retirement(pool_retirement); +export const certificate_newGenesisKeyDelegation = genesis_key_delegation => CSL.Certificate.new_genesis_key_delegation(genesis_key_delegation); +export const certificate_newMoveInstantaneousRewardsCert = move_instantaneous_rewards_cert => CSL.Certificate.new_move_instantaneous_rewards_cert(move_instantaneous_rewards_cert); +export const certificate_kind = self => self.kind.bind(self)(); +export const certificate_asStakeRegistration = self => self.as_stake_registration.bind(self)(); +export const certificate_asStakeDeregistration = self => self.as_stake_deregistration.bind(self)(); +export const certificate_asStakeDelegation = self => self.as_stake_delegation.bind(self)(); +export const certificate_asPoolRegistration = self => self.as_pool_registration.bind(self)(); +export const certificate_asPoolRetirement = self => self.as_pool_retirement.bind(self)(); +export const certificate_asGenesisKeyDelegation = self => self.as_genesis_key_delegation.bind(self)(); +export const certificate_asMoveInstantaneousRewardsCert = self => self.as_move_instantaneous_rewards_cert.bind(self)(); + +// Certificates +export const certificates_new = () => CSL.Certificates.new(); + +// ConstrPlutusData +export const constrPlutusData_alternative = self => self.alternative.bind(self)(); +export const constrPlutusData_data = self => self.data.bind(self)(); +export const constrPlutusData_new = alternative => data => CSL.ConstrPlutusData.new(alternative, data); + +// CostModel +export const costModel_new = () => CSL.CostModel.new(); +export const costModel_set = self => operation => cost => () => self.set.bind(self)(operation, cost); + +// Costmdls +export const costmdls_new = () => CSL.Costmdls.new(); +export const costmdls_retainLanguageVersions = self => languages => self.retain_language_versions.bind(self)(languages); + +// DNSRecordAorAAAA +export const dnsRecordAorAAAA_new = dns_name => CSL.DNSRecordAorAAAA.new(dns_name); +export const dnsRecordAorAAAA_record = self => self.record.bind(self)(); + +// DNSRecordSRV +export const dnsRecordSRV_new = dns_name => CSL.DNSRecordSRV.new(dns_name); +export const dnsRecordSRV_record = self => self.record.bind(self)(); + +// DataCost +export const dataCost_newCoinsPerWord = coins_per_word => CSL.DataCost.new_coins_per_word(coins_per_word); +export const dataCost_newCoinsPerByte = coins_per_byte => CSL.DataCost.new_coins_per_byte(coins_per_byte); +export const dataCost_coinsPerByte = self => self.coins_per_byte.bind(self)(); + +// DataHash +export const dataHash_toBech32 = self => prefix => self.to_bech32.bind(self)(prefix); +export const dataHash_fromBech32 = bech_str => errorableToPurs(CSL.DataHash.from_bech32, bech_str); + +// DatumSource +export const datumSource_new = datum => CSL.DatumSource.new(datum); +export const datumSource_newRefInput = input => CSL.DatumSource.new_ref_input(input); + +// Ed25519KeyHash +export const ed25519KeyHash_toBech32 = self => prefix => self.to_bech32.bind(self)(prefix); +export const ed25519KeyHash_fromBech32 = bech_str => errorableToPurs(CSL.Ed25519KeyHash.from_bech32, bech_str); + +// Ed25519KeyHashes +export const ed25519KeyHashes_new = CSL.Ed25519KeyHashes.new(); +export const ed25519KeyHashes_toOption = self => self.to_option.bind(self)(); + +// Ed25519Signature +export const ed25519Signature_toBech32 = self => self.to_bech32.bind(self)(); +export const ed25519Signature_fromBech32 = bech32_str => errorableToPurs(CSL.Ed25519Signature.from_bech32, bech32_str); + +// EnterpriseAddress +export const enterpriseAddress_new = network => payment => CSL.EnterpriseAddress.new(network, payment); +export const enterpriseAddress_paymentCred = self => self.payment_cred.bind(self)(); +export const enterpriseAddress_toAddress = self => self.to_address.bind(self)(); +export const enterpriseAddress_fromAddress = addr => CSL.EnterpriseAddress.from_address(addr); + +// ExUnitPrices +export const exUnitPrices_memPrice = self => self.mem_price.bind(self)(); +export const exUnitPrices_stepPrice = self => self.step_price.bind(self)(); +export const exUnitPrices_new = mem_price => step_price => CSL.ExUnitPrices.new(mem_price, step_price); + +// ExUnits +export const exUnits_mem = self => self.mem.bind(self)(); +export const exUnits_steps = self => self.steps.bind(self)(); +export const exUnits_new = mem => steps => CSL.ExUnits.new(mem, steps); + +// FixedTransaction +export const fixedTransaction_new = raw_body => raw_witness_set => is_valid => CSL.FixedTransaction.new(raw_body, raw_witness_set, is_valid); +export const fixedTransaction_newWithAuxiliary = raw_body => raw_witness_set => raw_auxiliary_data => is_valid => CSL.FixedTransaction.new_with_auxiliary(raw_body, raw_witness_set, raw_auxiliary_data, is_valid); +export const fixedTransaction_body = self => self.body.bind(self)(); +export const fixedTransaction_rawBody = self => self.raw_body.bind(self)(); +export const fixedTransaction_setBody = self => raw_body => errorableToPurs(self.set_body.bind(self), raw_body); +export const fixedTransaction_setWitnessSet = self => raw_witness_set => errorableToPurs(self.set_witness_set.bind(self), raw_witness_set); +export const fixedTransaction_witnessSet = self => self.witness_set.bind(self)(); +export const fixedTransaction_rawWitnessSet = self => self.raw_witness_set.bind(self)(); +export const fixedTransaction_setIsValid = self => valid => errorableToPurs(self.set_is_valid.bind(self), valid); +export const fixedTransaction_isValid = self => self.is_valid.bind(self)(); +export const fixedTransaction_setAuxiliaryData = self => raw_auxiliary_data => errorableToPurs(self.set_auxiliary_data.bind(self), raw_auxiliary_data); +export const fixedTransaction_auxiliaryData = self => self.auxiliary_data.bind(self)(); +export const fixedTransaction_rawAuxiliaryData = self => self.raw_auxiliary_data.bind(self)(); + +// GeneralTransactionMetadata +export const generalTransactionMetadata_new = () => CSL.GeneralTransactionMetadata.new(); + +// GenesisDelegateHash +export const genesisDelegateHash_toBech32 = self => prefix => self.to_bech32.bind(self)(prefix); +export const genesisDelegateHash_fromBech32 = bech_str => errorableToPurs(CSL.GenesisDelegateHash.from_bech32, bech_str); + +// GenesisHash +export const genesisHash_toBech32 = self => prefix => self.to_bech32.bind(self)(prefix); +export const genesisHash_fromBech32 = bech_str => errorableToPurs(CSL.GenesisHash.from_bech32, bech_str); + +// GenesisHashes +export const genesisHashes_new = () => CSL.GenesisHashes.new(); + +// GenesisKeyDelegation +export const genesisKeyDelegation_genesishash = self => self.genesishash.bind(self)(); +export const genesisKeyDelegation_genesisDelegateHash = self => self.genesis_delegate_hash.bind(self)(); +export const genesisKeyDelegation_vrfKeyhash = self => self.vrf_keyhash.bind(self)(); +export const genesisKeyDelegation_new = genesishash => genesis_delegate_hash => vrf_keyhash => CSL.GenesisKeyDelegation.new(genesishash, genesis_delegate_hash, vrf_keyhash); + +// InputWithScriptWitness +export const inputWithScriptWitness_newWithNativeScriptWitness = input => witness => CSL.InputWithScriptWitness.new_with_native_script_witness(input, witness); +export const inputWithScriptWitness_newWithPlutusWitness = input => witness => CSL.InputWithScriptWitness.new_with_plutus_witness(input, witness); +export const inputWithScriptWitness_input = self => self.input.bind(self)(); + +// InputsWithScriptWitness +export const inputsWithScriptWitness_new = CSL.InputsWithScriptWitness.new(); + +// Int +export const int_new = x => CSL.Int.new(x); +export const int_newNegative = x => CSL.Int.new_negative(x); +export const int_newI32 = x => CSL.Int.new_i32(x); +export const int_isPositive = self => self.is_positive.bind(self)(); +export const int_asPositive = self => self.as_positive.bind(self)(); +export const int_asNegative = self => self.as_negative.bind(self)(); +export const int_asI32 = self => self.as_i32.bind(self)(); +export const int_asI32OrNothing = self => self.as_i32_or_nothing.bind(self)(); +export const int_asI32OrFail = self => self.as_i32_or_fail.bind(self)(); +export const int_toStr = self => self.to_str.bind(self)(); +export const int_fromStr = string => errorableToPurs(CSL.Int.from_str, string); + +// Ipv4 +export const ipv4_new = data => CSL.Ipv4.new(data); +export const ipv4_ip = self => self.ip.bind(self)(); + +// Ipv6 +export const ipv6_new = data => CSL.Ipv6.new(data); +export const ipv6_ip = self => self.ip.bind(self)(); + +// KESSignature + +// KESVKey +export const kesvKey_toBech32 = self => prefix => self.to_bech32.bind(self)(prefix); +export const kesvKey_fromBech32 = bech_str => errorableToPurs(CSL.KESVKey.from_bech32, bech_str); + +// Language +export const language_newPlutusV1 = CSL.Language.new_plutus_v1(); +export const language_newPlutusV2 = CSL.Language.new_plutus_v2(); +export const language_kind = self => self.kind.bind(self)(); + +// Languages +export const languages_new = () => CSL.Languages.new(); +export const languages_list = CSL.Languages.list(); + +// LegacyDaedalusPrivateKey +export const legacyDaedalusPrivateKey_asBytes = self => self.as_bytes.bind(self)(); +export const legacyDaedalusPrivateKey_chaincode = self => self.chaincode.bind(self)(); + +// LinearFee +export const linearFee_constant = self => self.constant.bind(self)(); +export const linearFee_coefficient = self => self.coefficient.bind(self)(); +export const linearFee_new = coefficient => constant => CSL.LinearFee.new(coefficient, constant); + +// MIRToStakeCredentials +export const mirToStakeCredentials_new = () => CSL.MIRToStakeCredentials.new(); + +// MetadataList +export const metadataList_new = () => CSL.MetadataList.new(); + +// MetadataMap +export const metadataMap_new = () => CSL.MetadataMap.new(); +export const metadataMap_insertStr = self => key => value => () => self.insert_str.bind(self)(key, value); +export const metadataMap_insertI32 = self => key => value => () => self.insert_i32.bind(self)(key, value); +export const metadataMap_getStr = self => key => () => self.get_str.bind(self)(key); +export const metadataMap_getI32 = self => key => () => self.get_i32.bind(self)(key); +export const metadataMap_has = self => key => () => self.has.bind(self)(key); + +// Mint +export const mint_new = () => CSL.Mint.new(); +export const mint_newFromEntry = key => value => () => CSL.Mint.new_from_entry(key, value); +export const mint_getAll = self => key => self.get_all.bind(self)(key); +export const mint_asPositiveMultiasset = self => () => self.as_positive_multiasset.bind(self)(); +export const mint_asNegativeMultiasset = self => () => self.as_negative_multiasset.bind(self)(); + +// MintAssets +export const mintAssets_new = () => CSL.MintAssets.new(); +export const mintAssets_newFromEntry = key => value => CSL.MintAssets.new_from_entry(key, value); + +// MintWitness +export const mintWitness_newNativeScript = native_script => CSL.MintWitness.new_native_script(native_script); +export const mintWitness_newPlutusScript = plutus_script => redeemer => CSL.MintWitness.new_plutus_script(plutus_script, redeemer); + +// MintsAssets + +// MoveInstantaneousReward +export const moveInstantaneousReward_newToOtherPot = pot => amount => CSL.MoveInstantaneousReward.new_to_other_pot(pot, amount); +export const moveInstantaneousReward_newToStakeCreds = pot => amounts => CSL.MoveInstantaneousReward.new_to_stake_creds(pot, amounts); +export const moveInstantaneousReward_pot = self => self.pot.bind(self)(); +export const moveInstantaneousReward_kind = self => self.kind.bind(self)(); +export const moveInstantaneousReward_asToOtherPot = self => self.as_to_other_pot.bind(self)(); +export const moveInstantaneousReward_asToStakeCreds = self => self.as_to_stake_creds.bind(self)(); + +// MoveInstantaneousRewardsCert +export const moveInstantaneousRewardsCert_moveInstantaneousReward = self => self.move_instantaneous_reward.bind(self)(); +export const moveInstantaneousRewardsCert_new = move_instantaneous_reward => CSL.MoveInstantaneousRewardsCert.new(move_instantaneous_reward); + +// MultiAsset +export const multiAsset_new = () => CSL.MultiAsset.new(); +export const multiAsset_setAsset = self => policy_id => asset_name => value => () => self.set_asset.bind(self)(policy_id, asset_name, value); +export const multiAsset_getAsset = self => policy_id => asset_name => () => self.get_asset.bind(self)(policy_id, asset_name); +export const multiAsset_sub = self => rhs_ma => () => self.sub.bind(self)(rhs_ma); + +// MultiHostName +export const multiHostName_dnsName = self => self.dns_name.bind(self)(); +export const multiHostName_new = dns_name => CSL.MultiHostName.new(dns_name); + +// NativeScript +export const nativeScript_hash = self => self.hash.bind(self)(); +export const nativeScript_newScriptPubkey = script_pubkey => CSL.NativeScript.new_script_pubkey(script_pubkey); +export const nativeScript_newScriptAll = script_all => CSL.NativeScript.new_script_all(script_all); +export const nativeScript_newScriptAny = script_any => CSL.NativeScript.new_script_any(script_any); +export const nativeScript_newScriptNOfK = script_n_of_k => CSL.NativeScript.new_script_n_of_k(script_n_of_k); +export const nativeScript_newTimelockStart = timelock_start => CSL.NativeScript.new_timelock_start(timelock_start); +export const nativeScript_newTimelockExpiry = timelock_expiry => CSL.NativeScript.new_timelock_expiry(timelock_expiry); +export const nativeScript_kind = self => self.kind.bind(self)(); +export const nativeScript_asScriptPubkey = self => self.as_script_pubkey.bind(self)(); +export const nativeScript_asScriptAll = self => self.as_script_all.bind(self)(); +export const nativeScript_asScriptAny = self => self.as_script_any.bind(self)(); +export const nativeScript_asScriptNOfK = self => self.as_script_n_of_k.bind(self)(); +export const nativeScript_asTimelockStart = self => self.as_timelock_start.bind(self)(); +export const nativeScript_asTimelockExpiry = self => self.as_timelock_expiry.bind(self)(); +export const nativeScript_getRequiredSigners = self => self.get_required_signers.bind(self)(); + +// NativeScripts +export const nativeScripts_new = () => CSL.NativeScripts.new(); + +// NetworkId +export const networkId_testnet = CSL.NetworkId.testnet(); +export const networkId_mainnet = CSL.NetworkId.mainnet(); +export const networkId_kind = self => self.kind.bind(self)(); + +// NetworkInfo +export const networkInfo_new = network_id => protocol_magic => CSL.NetworkInfo.new(network_id, protocol_magic); +export const networkInfo_networkId = self => self.network_id.bind(self)(); +export const networkInfo_protocolMagic = self => self.protocol_magic.bind(self)(); +export const networkInfo_testnetPreview = CSL.NetworkInfo.testnet_preview(); +export const networkInfo_testnetPreprod = CSL.NetworkInfo.testnet_preprod(); +export const networkInfo_testnet = CSL.NetworkInfo.testnet(); +export const networkInfo_mainnet = CSL.NetworkInfo.mainnet(); + +// Nonce +export const nonce_newIdentity = CSL.Nonce.new_identity(); +export const nonce_newFromHash = hash => CSL.Nonce.new_from_hash(hash); +export const nonce_getHash = self => self.get_hash.bind(self)(); + +// OperationalCert +export const operationalCert_hotVkey = self => self.hot_vkey.bind(self)(); +export const operationalCert_sequenceNumber = self => self.sequence_number.bind(self)(); +export const operationalCert_kesPeriod = self => self.kes_period.bind(self)(); +export const operationalCert_sigma = self => self.sigma.bind(self)(); +export const operationalCert_new = hot_vkey => sequence_number => kes_period => sigma => CSL.OperationalCert.new(hot_vkey, sequence_number, kes_period, sigma); + +// OutputDatum +export const outputDatum_newDataHash = data_hash => CSL.OutputDatum.new_data_hash(data_hash); +export const outputDatum_newData = data => CSL.OutputDatum.new_data(data); +export const outputDatum_dataHash = self => self.data_hash.bind(self)(); +export const outputDatum_data = self => self.data.bind(self)(); + +// PlutusData +export const plutusData_newConstrPlutusData = constr_plutus_data => CSL.PlutusData.new_constr_plutus_data(constr_plutus_data); +export const plutusData_newEmptyConstrPlutusData = alternative => CSL.PlutusData.new_empty_constr_plutus_data(alternative); +export const plutusData_newSingleValueConstrPlutusData = alternative => plutus_data => CSL.PlutusData.new_single_value_constr_plutus_data(alternative, plutus_data); +export const plutusData_newMap = map => CSL.PlutusData.new_map(map); +export const plutusData_newList = list => CSL.PlutusData.new_list(list); +export const plutusData_newInteger = integer => CSL.PlutusData.new_integer(integer); +export const plutusData_newBytes = bytes => CSL.PlutusData.new_bytes(bytes); +export const plutusData_kind = self => self.kind.bind(self)(); +export const plutusData_asConstrPlutusData = self => self.as_constr_plutus_data.bind(self)(); +export const plutusData_asMap = self => self.as_map.bind(self)(); +export const plutusData_asList = self => self.as_list.bind(self)(); +export const plutusData_asInteger = self => self.as_integer.bind(self)(); +export const plutusData_asBytes = self => self.as_bytes.bind(self)(); +export const plutusData_fromAddress = address => CSL.PlutusData.from_address(address); + +// PlutusList +export const plutusList_new = () => CSL.PlutusList.new(); + +// PlutusMap +export const plutusMap_new = () => CSL.PlutusMap.new(); + +// PlutusScript +export const plutusScript_new = bytes => CSL.PlutusScript.new(bytes); +export const plutusScript_newV2 = bytes => CSL.PlutusScript.new_v2(bytes); +export const plutusScript_newWithVersion = bytes => language => CSL.PlutusScript.new_with_version(bytes, language); +export const plutusScript_bytes = self => self.bytes.bind(self)(); +export const plutusScript_fromBytesV2 = bytes => CSL.PlutusScript.from_bytes_v2(bytes); +export const plutusScript_fromBytesWithVersion = bytes => language => CSL.PlutusScript.from_bytes_with_version(bytes, language); +export const plutusScript_fromHexWithVersion = hex_str => language => CSL.PlutusScript.from_hex_with_version(hex_str, language); +export const plutusScript_hash = self => self.hash.bind(self)(); +export const plutusScript_languageVersion = self => self.language_version.bind(self)(); + +// PlutusScriptSource +export const plutusScriptSource_new = script => CSL.PlutusScriptSource.new(script); +export const plutusScriptSource_newRefInput = script_hash => input => CSL.PlutusScriptSource.new_ref_input(script_hash, input); +export const plutusScriptSource_newRefInputWithLangVer = script_hash => input => lang_ver => CSL.PlutusScriptSource.new_ref_input_with_lang_ver(script_hash, input, lang_ver); + +// PlutusScripts +export const plutusScripts_new = () => CSL.PlutusScripts.new(); + +// PlutusWitness +export const plutusWitness_new = script => datum => redeemer => CSL.PlutusWitness.new(script, datum, redeemer); +export const plutusWitness_newWithRef = script => datum => redeemer => CSL.PlutusWitness.new_with_ref(script, datum, redeemer); +export const plutusWitness_newWithoutDatum = script => redeemer => CSL.PlutusWitness.new_without_datum(script, redeemer); +export const plutusWitness_newWithRefWithoutDatum = script => redeemer => CSL.PlutusWitness.new_with_ref_without_datum(script, redeemer); +export const plutusWitness_script = self => self.script.bind(self)(); +export const plutusWitness_datum = self => self.datum.bind(self)(); +export const plutusWitness_redeemer = self => self.redeemer.bind(self)(); + +// PlutusWitnesses +export const plutusWitnesses_new = () => CSL.PlutusWitnesses.new(); + +// Pointer +export const pointer_new = slot => tx_index => cert_index => CSL.Pointer.new(slot, tx_index, cert_index); +export const pointer_newPointer = slot => tx_index => cert_index => CSL.Pointer.new_pointer(slot, tx_index, cert_index); +export const pointer_slot = self => self.slot.bind(self)(); +export const pointer_txIndex = self => self.tx_index.bind(self)(); +export const pointer_certIndex = self => self.cert_index.bind(self)(); +export const pointer_slotBignum = self => self.slot_bignum.bind(self)(); +export const pointer_txIndexBignum = self => self.tx_index_bignum.bind(self)(); +export const pointer_certIndexBignum = self => self.cert_index_bignum.bind(self)(); + +// PointerAddress +export const pointerAddress_new = network => payment => stake => CSL.PointerAddress.new(network, payment, stake); +export const pointerAddress_paymentCred = self => self.payment_cred.bind(self)(); +export const pointerAddress_stakePointer = self => self.stake_pointer.bind(self)(); +export const pointerAddress_toAddress = self => self.to_address.bind(self)(); +export const pointerAddress_fromAddress = addr => CSL.PointerAddress.from_address(addr); + +// PoolMetadata +export const poolMetadata_url = self => self.url.bind(self)(); +export const poolMetadata_poolMetadataHash = self => self.pool_metadata_hash.bind(self)(); +export const poolMetadata_new = url => pool_metadata_hash => CSL.PoolMetadata.new(url, pool_metadata_hash); + +// PoolMetadataHash +export const poolMetadataHash_toBech32 = self => prefix => self.to_bech32.bind(self)(prefix); +export const poolMetadataHash_fromBech32 = bech_str => errorableToPurs(CSL.PoolMetadataHash.from_bech32, bech_str); + +// PoolParams +export const poolParams_operator = self => self.operator.bind(self)(); +export const poolParams_vrfKeyhash = self => self.vrf_keyhash.bind(self)(); +export const poolParams_pledge = self => self.pledge.bind(self)(); +export const poolParams_cost = self => self.cost.bind(self)(); +export const poolParams_margin = self => self.margin.bind(self)(); +export const poolParams_rewardAccount = self => self.reward_account.bind(self)(); +export const poolParams_poolOwners = self => self.pool_owners.bind(self)(); +export const poolParams_relays = self => self.relays.bind(self)(); +export const poolParams_poolMetadata = self => self.pool_metadata.bind(self)(); +export const poolParams_new = operator => vrf_keyhash => pledge => cost => margin => reward_account => pool_owners => relays => pool_metadata => CSL.PoolParams.new(operator, vrf_keyhash, pledge, cost, margin, reward_account, pool_owners, relays, pool_metadata); + +// PoolRegistration +export const poolRegistration_poolParams = self => self.pool_params.bind(self)(); +export const poolRegistration_new = pool_params => CSL.PoolRegistration.new(pool_params); + +// PoolRetirement +export const poolRetirement_poolKeyhash = self => self.pool_keyhash.bind(self)(); +export const poolRetirement_epoch = self => self.epoch.bind(self)(); +export const poolRetirement_new = pool_keyhash => epoch => CSL.PoolRetirement.new(pool_keyhash, epoch); + +// PrivateKey +export const privateKey_free = self => errorableToPurs(self.free.bind(self), ); +export const privateKey_toPublic = self => self.to_public.bind(self)(); +export const privateKey_generateEd25519 = CSL.PrivateKey.generate_ed25519(); +export const privateKey_generateEd25519extended = CSL.PrivateKey.generate_ed25519extended(); +export const privateKey_fromBech32 = bech32_str => errorableToPurs(CSL.PrivateKey.from_bech32, bech32_str); +export const privateKey_toBech32 = self => self.to_bech32.bind(self)(); +export const privateKey_asBytes = self => self.as_bytes.bind(self)(); +export const privateKey_fromExtendedBytes = bytes => errorableToPurs(CSL.PrivateKey.from_extended_bytes, bytes); +export const privateKey_fromNormalBytes = bytes => errorableToPurs(CSL.PrivateKey.from_normal_bytes, bytes); +export const privateKey_sign = self => message => self.sign.bind(self)(message); +export const privateKey_toHex = self => self.to_hex.bind(self)(); +export const privateKey_fromHex = hex_str => errorableToPurs(CSL.PrivateKey.from_hex, hex_str); + +// ProposedProtocolParameterUpdates +export const proposedProtocolParameterUpdates_new = () => CSL.ProposedProtocolParameterUpdates.new(); + +// ProtocolParamUpdate +export const protocolParamUpdate_setMinfeeA = self => minfee_a => errorableToPurs(self.set_minfee_a.bind(self), minfee_a); +export const protocolParamUpdate_minfeeA = self => self.minfee_a.bind(self)(); +export const protocolParamUpdate_setMinfeeB = self => minfee_b => errorableToPurs(self.set_minfee_b.bind(self), minfee_b); +export const protocolParamUpdate_minfeeB = self => self.minfee_b.bind(self)(); +export const protocolParamUpdate_setMaxBlockBodySize = self => max_block_body_size => errorableToPurs(self.set_max_block_body_size.bind(self), max_block_body_size); +export const protocolParamUpdate_maxBlockBodySize = self => self.max_block_body_size.bind(self)(); +export const protocolParamUpdate_setMaxTxSize = self => max_tx_size => errorableToPurs(self.set_max_tx_size.bind(self), max_tx_size); +export const protocolParamUpdate_maxTxSize = self => self.max_tx_size.bind(self)(); +export const protocolParamUpdate_setMaxBlockHeaderSize = self => max_block_header_size => errorableToPurs(self.set_max_block_header_size.bind(self), max_block_header_size); +export const protocolParamUpdate_maxBlockHeaderSize = self => self.max_block_header_size.bind(self)(); +export const protocolParamUpdate_setKeyDeposit = self => key_deposit => errorableToPurs(self.set_key_deposit.bind(self), key_deposit); +export const protocolParamUpdate_keyDeposit = self => self.key_deposit.bind(self)(); +export const protocolParamUpdate_setPoolDeposit = self => pool_deposit => errorableToPurs(self.set_pool_deposit.bind(self), pool_deposit); +export const protocolParamUpdate_poolDeposit = self => self.pool_deposit.bind(self)(); +export const protocolParamUpdate_setMaxEpoch = self => max_epoch => errorableToPurs(self.set_max_epoch.bind(self), max_epoch); +export const protocolParamUpdate_maxEpoch = self => self.max_epoch.bind(self)(); +export const protocolParamUpdate_setNOpt = self => n_opt => errorableToPurs(self.set_n_opt.bind(self), n_opt); +export const protocolParamUpdate_nOpt = self => self.n_opt.bind(self)(); +export const protocolParamUpdate_setPoolPledgeInfluence = self => pool_pledge_influence => errorableToPurs(self.set_pool_pledge_influence.bind(self), pool_pledge_influence); +export const protocolParamUpdate_poolPledgeInfluence = self => self.pool_pledge_influence.bind(self)(); +export const protocolParamUpdate_setExpansionRate = self => expansion_rate => errorableToPurs(self.set_expansion_rate.bind(self), expansion_rate); +export const protocolParamUpdate_expansionRate = self => self.expansion_rate.bind(self)(); +export const protocolParamUpdate_setTreasuryGrowthRate = self => treasury_growth_rate => errorableToPurs(self.set_treasury_growth_rate.bind(self), treasury_growth_rate); +export const protocolParamUpdate_treasuryGrowthRate = self => self.treasury_growth_rate.bind(self)(); +export const protocolParamUpdate_d = self => self.d.bind(self)(); +export const protocolParamUpdate_extraEntropy = self => self.extra_entropy.bind(self)(); +export const protocolParamUpdate_setProtocolVersion = self => protocol_version => errorableToPurs(self.set_protocol_version.bind(self), protocol_version); +export const protocolParamUpdate_protocolVersion = self => self.protocol_version.bind(self)(); +export const protocolParamUpdate_setMinPoolCost = self => min_pool_cost => errorableToPurs(self.set_min_pool_cost.bind(self), min_pool_cost); +export const protocolParamUpdate_minPoolCost = self => self.min_pool_cost.bind(self)(); +export const protocolParamUpdate_setAdaPerUtxoByte = self => ada_per_utxo_byte => errorableToPurs(self.set_ada_per_utxo_byte.bind(self), ada_per_utxo_byte); +export const protocolParamUpdate_adaPerUtxoByte = self => self.ada_per_utxo_byte.bind(self)(); +export const protocolParamUpdate_setCostModels = self => cost_models => errorableToPurs(self.set_cost_models.bind(self), cost_models); +export const protocolParamUpdate_costModels = self => self.cost_models.bind(self)(); +export const protocolParamUpdate_setExecutionCosts = self => execution_costs => errorableToPurs(self.set_execution_costs.bind(self), execution_costs); +export const protocolParamUpdate_executionCosts = self => self.execution_costs.bind(self)(); +export const protocolParamUpdate_setMaxTxExUnits = self => max_tx_ex_units => errorableToPurs(self.set_max_tx_ex_units.bind(self), max_tx_ex_units); +export const protocolParamUpdate_maxTxExUnits = self => self.max_tx_ex_units.bind(self)(); +export const protocolParamUpdate_setMaxBlockExUnits = self => max_block_ex_units => errorableToPurs(self.set_max_block_ex_units.bind(self), max_block_ex_units); +export const protocolParamUpdate_maxBlockExUnits = self => self.max_block_ex_units.bind(self)(); +export const protocolParamUpdate_setMaxValueSize = self => max_value_size => errorableToPurs(self.set_max_value_size.bind(self), max_value_size); +export const protocolParamUpdate_maxValueSize = self => self.max_value_size.bind(self)(); +export const protocolParamUpdate_setCollateralPercentage = self => collateral_percentage => errorableToPurs(self.set_collateral_percentage.bind(self), collateral_percentage); +export const protocolParamUpdate_collateralPercentage = self => self.collateral_percentage.bind(self)(); +export const protocolParamUpdate_setMaxCollateralInputs = self => max_collateral_inputs => errorableToPurs(self.set_max_collateral_inputs.bind(self), max_collateral_inputs); +export const protocolParamUpdate_maxCollateralInputs = self => self.max_collateral_inputs.bind(self)(); +export const protocolParamUpdate_new = CSL.ProtocolParamUpdate.new(); + +// ProtocolVersion +export const protocolVersion_major = self => self.major.bind(self)(); +export const protocolVersion_minor = self => self.minor.bind(self)(); +export const protocolVersion_new = major => minor => CSL.ProtocolVersion.new(major, minor); + +// PublicKey +export const publicKey_free = self => errorableToPurs(self.free.bind(self), ); +export const publicKey_fromBech32 = bech32_str => errorableToPurs(CSL.PublicKey.from_bech32, bech32_str); +export const publicKey_toBech32 = self => self.to_bech32.bind(self)(); +export const publicKey_asBytes = self => self.as_bytes.bind(self)(); +export const publicKey_fromBytes = bytes => errorableToPurs(CSL.PublicKey.from_bytes, bytes); +export const publicKey_verify = self => data => signature => self.verify.bind(self)(data, signature); +export const publicKey_hash = self => self.hash.bind(self)(); +export const publicKey_toHex = self => self.to_hex.bind(self)(); +export const publicKey_fromHex = hex_str => errorableToPurs(CSL.PublicKey.from_hex, hex_str); + +// Redeemer +export const redeemer_tag = self => self.tag.bind(self)(); +export const redeemer_index = self => self.index.bind(self)(); +export const redeemer_data = self => self.data.bind(self)(); +export const redeemer_exUnits = self => self.ex_units.bind(self)(); +export const redeemer_new = tag => index => data => ex_units => CSL.Redeemer.new(tag, index, data, ex_units); + +// RedeemerTag +export const redeemerTag_newSpend = CSL.RedeemerTag.new_spend(); +export const redeemerTag_newMint = CSL.RedeemerTag.new_mint(); +export const redeemerTag_newCert = CSL.RedeemerTag.new_cert(); +export const redeemerTag_newReward = CSL.RedeemerTag.new_reward(); +export const redeemerTag_kind = self => self.kind.bind(self)(); + +// Redeemers +export const redeemers_new = () => CSL.Redeemers.new(); +export const redeemers_totalExUnits = self => self.total_ex_units.bind(self)(); + +// Relay +export const relay_newSingleHostAddr = single_host_addr => CSL.Relay.new_single_host_addr(single_host_addr); +export const relay_newSingleHostName = single_host_name => CSL.Relay.new_single_host_name(single_host_name); +export const relay_newMultiHostName = multi_host_name => CSL.Relay.new_multi_host_name(multi_host_name); +export const relay_kind = self => self.kind.bind(self)(); +export const relay_asSingleHostAddr = self => self.as_single_host_addr.bind(self)(); +export const relay_asSingleHostName = self => self.as_single_host_name.bind(self)(); +export const relay_asMultiHostName = self => self.as_multi_host_name.bind(self)(); + +// Relays +export const relays_new = () => CSL.Relays.new(); + +// RewardAddress +export const rewardAddress_new = network => payment => CSL.RewardAddress.new(network, payment); +export const rewardAddress_paymentCred = self => self.payment_cred.bind(self)(); +export const rewardAddress_toAddress = self => self.to_address.bind(self)(); +export const rewardAddress_fromAddress = addr => CSL.RewardAddress.from_address(addr); + +// RewardAddresses +export const rewardAddresses_new = () => CSL.RewardAddresses.new(); + +// ScriptAll +export const scriptAll_nativeScripts = self => self.native_scripts.bind(self)(); +export const scriptAll_new = native_scripts => CSL.ScriptAll.new(native_scripts); + +// ScriptAny +export const scriptAny_nativeScripts = self => self.native_scripts.bind(self)(); +export const scriptAny_new = native_scripts => CSL.ScriptAny.new(native_scripts); + +// ScriptDataHash +export const scriptDataHash_toBech32 = self => prefix => self.to_bech32.bind(self)(prefix); +export const scriptDataHash_fromBech32 = bech_str => errorableToPurs(CSL.ScriptDataHash.from_bech32, bech_str); + +// ScriptHash +export const scriptHash_toBech32 = self => prefix => self.to_bech32.bind(self)(prefix); +export const scriptHash_fromBech32 = bech_str => errorableToPurs(CSL.ScriptHash.from_bech32, bech_str); + +// ScriptHashes +export const scriptHashes_new = () => CSL.ScriptHashes.new(); + +// ScriptNOfK +export const scriptNOfK_n = self => self.n.bind(self)(); +export const scriptNOfK_nativeScripts = self => self.native_scripts.bind(self)(); +export const scriptNOfK_new = n => native_scripts => CSL.ScriptNOfK.new(n, native_scripts); + +// ScriptPubkey +export const scriptPubkey_addrKeyhash = self => self.addr_keyhash.bind(self)(); +export const scriptPubkey_new = addr_keyhash => CSL.ScriptPubkey.new(addr_keyhash); + +// ScriptRef +export const scriptRef_newNativeScript = native_script => CSL.ScriptRef.new_native_script(native_script); +export const scriptRef_newPlutusScript = plutus_script => CSL.ScriptRef.new_plutus_script(plutus_script); +export const scriptRef_isNativeScript = self => self.is_native_script.bind(self)(); +export const scriptRef_isPlutusScript = self => self.is_plutus_script.bind(self)(); +export const scriptRef_nativeScript = self => self.native_script.bind(self)(); +export const scriptRef_plutusScript = self => self.plutus_script.bind(self)(); + +// SingleHostAddr +export const singleHostAddr_port = self => self.port.bind(self)(); +export const singleHostAddr_ipv4 = self => self.ipv4.bind(self)(); +export const singleHostAddr_ipv6 = self => self.ipv6.bind(self)(); +export const singleHostAddr_new = port => ipv4 => ipv6 => CSL.SingleHostAddr.new(port, ipv4, ipv6); + +// SingleHostName +export const singleHostName_port = self => self.port.bind(self)(); +export const singleHostName_dnsName = self => self.dns_name.bind(self)(); +export const singleHostName_new = port => dns_name => CSL.SingleHostName.new(port, dns_name); + +// StakeCredential +export const stakeCredential_fromKeyhash = hash => CSL.StakeCredential.from_keyhash(hash); +export const stakeCredential_fromScripthash = hash => CSL.StakeCredential.from_scripthash(hash); +export const stakeCredential_toKeyhash = self => self.to_keyhash.bind(self)(); +export const stakeCredential_toScripthash = self => self.to_scripthash.bind(self)(); +export const stakeCredential_kind = self => self.kind.bind(self)(); + +// StakeCredentials +export const stakeCredentials_new = () => CSL.StakeCredentials.new(); + +// StakeDelegation +export const stakeDelegation_stakeCredential = self => self.stake_credential.bind(self)(); +export const stakeDelegation_poolKeyhash = self => self.pool_keyhash.bind(self)(); +export const stakeDelegation_new = stake_credential => pool_keyhash => CSL.StakeDelegation.new(stake_credential, pool_keyhash); + +// StakeDeregistration +export const stakeDeregistration_stakeCredential = self => self.stake_credential.bind(self)(); +export const stakeDeregistration_new = stake_credential => CSL.StakeDeregistration.new(stake_credential); + +// StakeRegistration +export const stakeRegistration_stakeCredential = self => self.stake_credential.bind(self)(); +export const stakeRegistration_new = stake_credential => CSL.StakeRegistration.new(stake_credential); + +// TimelockExpiry +export const timelockExpiry_slot = self => self.slot.bind(self)(); +export const timelockExpiry_slotBignum = self => self.slot_bignum.bind(self)(); +export const timelockExpiry_new = slot => CSL.TimelockExpiry.new(slot); +export const timelockExpiry_newTimelockexpiry = slot => CSL.TimelockExpiry.new_timelockexpiry(slot); + +// TimelockStart +export const timelockStart_slot = self => self.slot.bind(self)(); +export const timelockStart_slotBignum = self => self.slot_bignum.bind(self)(); +export const timelockStart_new = slot => CSL.TimelockStart.new(slot); +export const timelockStart_newTimelockstart = slot => CSL.TimelockStart.new_timelockstart(slot); + +// Transaction +export const transaction_body = self => self.body.bind(self)(); +export const transaction_witnessSet = self => self.witness_set.bind(self)(); +export const transaction_isValid = self => self.is_valid.bind(self)(); +export const transaction_auxiliaryData = self => self.auxiliary_data.bind(self)(); +export const transaction_setIsValid = self => valid => errorableToPurs(self.set_is_valid.bind(self), valid); +export const transaction_new = body => witness_set => auxiliary_data => CSL.Transaction.new(body, witness_set, auxiliary_data); + +// TransactionBatch + +// TransactionBatchList + +// TransactionBody +export const transactionBody_inputs = self => self.inputs.bind(self)(); +export const transactionBody_outputs = self => self.outputs.bind(self)(); +export const transactionBody_fee = self => self.fee.bind(self)(); +export const transactionBody_ttl = self => self.ttl.bind(self)(); +export const transactionBody_ttlBignum = self => self.ttl_bignum.bind(self)(); +export const transactionBody_setTtl = self => ttl => errorableToPurs(self.set_ttl.bind(self), ttl); +export const transactionBody_removeTtl = self => errorableToPurs(self.remove_ttl.bind(self), ); +export const transactionBody_setCerts = self => certs => errorableToPurs(self.set_certs.bind(self), certs); +export const transactionBody_certs = self => self.certs.bind(self)(); +export const transactionBody_setWithdrawals = self => withdrawals => errorableToPurs(self.set_withdrawals.bind(self), withdrawals); +export const transactionBody_withdrawals = self => self.withdrawals.bind(self)(); +export const transactionBody_setUpdate = self => update => errorableToPurs(self.set_update.bind(self), update); +export const transactionBody_update = self => self.update.bind(self)(); +export const transactionBody_setAuxiliaryDataHash = self => auxiliary_data_hash => errorableToPurs(self.set_auxiliary_data_hash.bind(self), auxiliary_data_hash); +export const transactionBody_auxiliaryDataHash = self => self.auxiliary_data_hash.bind(self)(); +export const transactionBody_setValidityStartInterval = self => validity_start_interval => errorableToPurs(self.set_validity_start_interval.bind(self), validity_start_interval); +export const transactionBody_setValidityStartIntervalBignum = self => validity_start_interval => errorableToPurs(self.set_validity_start_interval_bignum.bind(self), validity_start_interval); +export const transactionBody_validityStartIntervalBignum = self => self.validity_start_interval_bignum.bind(self)(); +export const transactionBody_validityStartInterval = self => self.validity_start_interval.bind(self)(); +export const transactionBody_setMint = self => mint => errorableToPurs(self.set_mint.bind(self), mint); +export const transactionBody_mint = self => self.mint.bind(self)(); +export const transactionBody_multiassets = self => self.multiassets.bind(self)(); +export const transactionBody_setReferenceInputs = self => reference_inputs => errorableToPurs(self.set_reference_inputs.bind(self), reference_inputs); +export const transactionBody_referenceInputs = self => self.reference_inputs.bind(self)(); +export const transactionBody_setScriptDataHash = self => script_data_hash => errorableToPurs(self.set_script_data_hash.bind(self), script_data_hash); +export const transactionBody_scriptDataHash = self => self.script_data_hash.bind(self)(); +export const transactionBody_setCollateral = self => collateral => errorableToPurs(self.set_collateral.bind(self), collateral); +export const transactionBody_collateral = self => self.collateral.bind(self)(); +export const transactionBody_setRequiredSigners = self => required_signers => errorableToPurs(self.set_required_signers.bind(self), required_signers); +export const transactionBody_requiredSigners = self => self.required_signers.bind(self)(); +export const transactionBody_setNetworkId = self => network_id => errorableToPurs(self.set_network_id.bind(self), network_id); +export const transactionBody_networkId = self => self.network_id.bind(self)(); +export const transactionBody_setCollateralReturn = self => collateral_return => errorableToPurs(self.set_collateral_return.bind(self), collateral_return); +export const transactionBody_collateralReturn = self => self.collateral_return.bind(self)(); +export const transactionBody_setTotalCollateral = self => total_collateral => errorableToPurs(self.set_total_collateral.bind(self), total_collateral); +export const transactionBody_totalCollateral = self => self.total_collateral.bind(self)(); +export const transactionBody_new = inputs => outputs => fee => ttl => CSL.TransactionBody.new(inputs, outputs, fee, ttl); +export const transactionBody_newTxBody = inputs => outputs => fee => CSL.TransactionBody.new_tx_body(inputs, outputs, fee); + +// TransactionHash +export const transactionHash_toBech32 = self => prefix => self.to_bech32.bind(self)(prefix); +export const transactionHash_fromBech32 = bech_str => errorableToPurs(CSL.TransactionHash.from_bech32, bech_str); + +// TransactionInput +export const transactionInput_transactionId = self => self.transaction_id.bind(self)(); +export const transactionInput_index = self => self.index.bind(self)(); +export const transactionInput_new = transaction_id => index => CSL.TransactionInput.new(transaction_id, index); + +// TransactionInputs +export const transactionInputs_new = () => CSL.TransactionInputs.new(); +export const transactionInputs_toOption = self => self.to_option.bind(self)(); + +// TransactionMetadatum +export const transactionMetadatum_newMap = map => CSL.TransactionMetadatum.new_map(map); +export const transactionMetadatum_newList = list => CSL.TransactionMetadatum.new_list(list); +export const transactionMetadatum_newInt = int => CSL.TransactionMetadatum.new_int(int); +export const transactionMetadatum_newBytes = bytes => CSL.TransactionMetadatum.new_bytes(bytes); +export const transactionMetadatum_newText = text => CSL.TransactionMetadatum.new_text(text); +export const transactionMetadatum_kind = self => self.kind.bind(self)(); +export const transactionMetadatum_asMap = self => self.as_map.bind(self)(); +export const transactionMetadatum_asList = self => self.as_list.bind(self)(); +export const transactionMetadatum_asInt = self => self.as_int.bind(self)(); +export const transactionMetadatum_asBytes = self => self.as_bytes.bind(self)(); +export const transactionMetadatum_asText = self => self.as_text.bind(self)(); + +// TransactionMetadatumLabels +export const transactionMetadatumLabels_new = () => CSL.TransactionMetadatumLabels.new(); + +// TransactionOutput +export const transactionOutput_address = self => self.address.bind(self)(); +export const transactionOutput_amount = self => self.amount.bind(self)(); +export const transactionOutput_dataHash = self => self.data_hash.bind(self)(); +export const transactionOutput_plutusData = self => self.plutus_data.bind(self)(); +export const transactionOutput_scriptRef = self => self.script_ref.bind(self)(); +export const transactionOutput_setScriptRef = self => script_ref => () => self.set_script_ref.bind(self)(script_ref); +export const transactionOutput_setPlutusData = self => data => () => self.set_plutus_data.bind(self)(data); +export const transactionOutput_setDataHash = self => data_hash => () => self.set_data_hash.bind(self)(data_hash); +export const transactionOutput_hasPlutusData = self => self.has_plutus_data.bind(self)(); +export const transactionOutput_hasDataHash = self => self.has_data_hash.bind(self)(); +export const transactionOutput_hasScriptRef = self => self.has_script_ref.bind(self)(); +export const transactionOutput_new = address => amount => CSL.TransactionOutput.new(address, amount); +export const transactionOutput_serializationFormat = self => self.serialization_format.bind(self)(); + +// TransactionOutputs +export const transactionOutputs_new = () => CSL.TransactionOutputs.new(); + +// TransactionUnspentOutput +export const transactionUnspentOutput_new = input => output => CSL.TransactionUnspentOutput.new(input, output); +export const transactionUnspentOutput_input = self => self.input.bind(self)(); +export const transactionUnspentOutput_output = self => self.output.bind(self)(); + +// TransactionUnspentOutputs +export const transactionUnspentOutputs_new = () => CSL.TransactionUnspentOutputs.new(); + +// TransactionWitnessSet +export const transactionWitnessSet_setVkeys = self => vkeys => () => self.set_vkeys.bind(self)(vkeys); +export const transactionWitnessSet_vkeys = self => () => self.vkeys.bind(self)(); +export const transactionWitnessSet_setNativeScripts = self => native_scripts => () => self.set_native_scripts.bind(self)(native_scripts); +export const transactionWitnessSet_nativeScripts = self => () => self.native_scripts.bind(self)(); +export const transactionWitnessSet_setBootstraps = self => bootstraps => () => self.set_bootstraps.bind(self)(bootstraps); +export const transactionWitnessSet_bootstraps = self => () => self.bootstraps.bind(self)(); +export const transactionWitnessSet_setPlutusScripts = self => plutus_scripts => () => self.set_plutus_scripts.bind(self)(plutus_scripts); +export const transactionWitnessSet_plutusScripts = self => () => self.plutus_scripts.bind(self)(); +export const transactionWitnessSet_setPlutusData = self => plutus_data => () => self.set_plutus_data.bind(self)(plutus_data); +export const transactionWitnessSet_plutusData = self => () => self.plutus_data.bind(self)(); +export const transactionWitnessSet_setRedeemers = self => redeemers => () => self.set_redeemers.bind(self)(redeemers); +export const transactionWitnessSet_redeemers = self => () => self.redeemers.bind(self)(); +export const transactionWitnessSet_new = () => CSL.TransactionWitnessSet.new(); + +// URL +export const url_new = url => CSL.URL.new(url); +export const url_url = self => self.url.bind(self)(); + +// UnitInterval +export const unitInterval_numerator = self => self.numerator.bind(self)(); +export const unitInterval_denominator = self => self.denominator.bind(self)(); +export const unitInterval_new = numerator => denominator => CSL.UnitInterval.new(numerator, denominator); + +// Update +export const update_proposedProtocolParameterUpdates = self => self.proposed_protocol_parameter_updates.bind(self)(); +export const update_epoch = self => self.epoch.bind(self)(); +export const update_new = proposed_protocol_parameter_updates => epoch => CSL.Update.new(proposed_protocol_parameter_updates, epoch); + +// VRFCert +export const vrfCert_output = self => self.output.bind(self)(); +export const vrfCert_proof = self => self.proof.bind(self)(); +export const vrfCert_new = output => proof => CSL.VRFCert.new(output, proof); + +// VRFKeyHash +export const vrfKeyHash_toBech32 = self => prefix => self.to_bech32.bind(self)(prefix); +export const vrfKeyHash_fromBech32 = bech_str => errorableToPurs(CSL.VRFKeyHash.from_bech32, bech_str); + +// VRFVKey +export const vrfvKey_toBech32 = self => prefix => self.to_bech32.bind(self)(prefix); +export const vrfvKey_fromBech32 = bech_str => errorableToPurs(CSL.VRFVKey.from_bech32, bech_str); + +// Value +export const value_new = coin => CSL.Value.new(coin); +export const value_newFromAssets = multiasset => CSL.Value.new_from_assets(multiasset); +export const value_newWithAssets = coin => multiasset => CSL.Value.new_with_assets(coin, multiasset); +export const value_zero = CSL.Value.zero(); +export const value_isZero = self => self.is_zero.bind(self)(); +export const value_coin = self => self.coin.bind(self)(); +export const value_setCoin = self => coin => errorableToPurs(self.set_coin.bind(self), coin); +export const value_multiasset = self => self.multiasset.bind(self)(); +export const value_setMultiasset = self => multiasset => () => self.set_multiasset.bind(self)(multiasset); +export const value_checkedAdd = self => rhs => errorableToPurs(self.checked_add.bind(self), rhs); +export const value_checkedSub = self => rhs_value => errorableToPurs(self.checked_sub.bind(self), rhs_value); +export const value_clampedSub = self => rhs_value => self.clamped_sub.bind(self)(rhs_value); +export const value_compare = self => rhs_value => self.compare.bind(self)(rhs_value); + +// Vkey +export const vkey_new = pk => CSL.Vkey.new(pk); +export const vkey_publicKey = self => self.public_key.bind(self)(); + +// Vkeys +export const vkeys_new = () => CSL.Vkeys.new(); + +// Vkeywitness +export const vkeywitness_new = vkey => signature => CSL.Vkeywitness.new(vkey, signature); +export const vkeywitness_vkey = self => self.vkey.bind(self)(); +export const vkeywitness_signature = self => self.signature.bind(self)(); + +// Vkeywitnesses +export const vkeywitnesses_new = () => CSL.Vkeywitnesses.new(); + +// Withdrawals +export const withdrawals_new = () => CSL.Withdrawals.new(); + + +export const hashTransaction = tx_body => CSL.hash_transaction(tx_body); +export const hashPlutusData = plutus_data => CSL.hash_plutus_data(plutus_data); +export const minAdaForOutput = output => data_cost => CSL.min_ada_for_output(output, data_cost); + diff --git a/src/Cardano/Serialization/Lib.purs b/src/Cardano/Serialization/Lib.purs new file mode 100644 index 0000000..9ecbfa1 --- /dev/null +++ b/src/Cardano/Serialization/Lib.purs @@ -0,0 +1,3207 @@ +module Cardano.Serialization.Lib + ( ForeignErrorable + , module X + , address_toBech32 + , address_fromBech32 + , address_networkId + , assetName_new + , assetName_name + , assetNames_new + , assets_new + , auxiliaryData_new + , auxiliaryData_metadata + , auxiliaryData_setMetadata + , auxiliaryData_nativeScripts + , auxiliaryData_setNativeScripts + , auxiliaryData_plutusScripts + , auxiliaryData_setPlutusScripts + , auxiliaryData_preferAlonzoFormat + , auxiliaryData_setPreferAlonzoFormat + , auxiliaryDataHash_toBech32 + , auxiliaryDataHash_fromBech32 + , baseAddress_new + , baseAddress_paymentCred + , baseAddress_stakeCred + , baseAddress_toAddress + , baseAddress_fromAddress + , bigInt_isZero + , bigInt_asU64 + , bigInt_asInt + , bigInt_fromStr + , bigInt_toStr + , bigInt_mul + , bigInt_one + , bigInt_increment + , bigInt_divCeil + , bigNum_fromStr + , bigNum_toStr + , bigNum_zero + , bigNum_one + , bigNum_isZero + , bigNum_divFloor + , bigNum_checkedMul + , bigNum_checkedAdd + , bigNum_checkedSub + , bigNum_clampedSub + , bigNum_compare + , bigNum_lessThan + , bigNum_maxValue + , bigNum_max + , bip32PrivateKey_derive + , bip32PrivateKey_from128Xprv + , bip32PrivateKey_to128Xprv + , bip32PrivateKey_generateEd25519Bip32 + , bip32PrivateKey_toRawKey + , bip32PrivateKey_toPublic + , bip32PrivateKey_asBytes + , bip32PrivateKey_fromBech32 + , bip32PrivateKey_toBech32 + , bip32PrivateKey_fromBip39Entropy + , bip32PrivateKey_chaincode + , bip32PublicKey_derive + , bip32PublicKey_toRawKey + , bip32PublicKey_asBytes + , bip32PublicKey_fromBech32 + , bip32PublicKey_toBech32 + , bip32PublicKey_chaincode + , blockHash_toBech32 + , blockHash_fromBech32 + , bootstrapWitness_vkey + , bootstrapWitness_signature + , bootstrapWitness_chainCode + , bootstrapWitness_attributes + , bootstrapWitness_new + , bootstrapWitnesses_new + , byronAddress_toBase58 + , byronAddress_byronProtocolMagic + , byronAddress_attributes + , byronAddress_networkId + , byronAddress_fromBase58 + , byronAddress_icarusFromKey + , byronAddress_isValid + , byronAddress_toAddress + , byronAddress_fromAddress + , certificate_newStakeRegistration + , certificate_newStakeDeregistration + , certificate_newStakeDelegation + , certificate_newPoolRegistration + , certificate_newPoolRetirement + , certificate_newGenesisKeyDelegation + , certificate_newMoveInstantaneousRewardsCert + , certificate_kind + , certificate_asStakeRegistration + , certificate_asStakeDeregistration + , certificate_asStakeDelegation + , certificate_asPoolRegistration + , certificate_asPoolRetirement + , certificate_asGenesisKeyDelegation + , certificate_asMoveInstantaneousRewardsCert + , certificates_new + , constrPlutusData_alternative + , constrPlutusData_data + , constrPlutusData_new + , costModel_new + , costModel_set + , costmdls_new + , costmdls_retainLanguageVersions + , dnsRecordAorAAAA_new + , dnsRecordAorAAAA_record + , dnsRecordSRV_new + , dnsRecordSRV_record + , dataCost_newCoinsPerWord + , dataCost_newCoinsPerByte + , dataCost_coinsPerByte + , dataHash_toBech32 + , dataHash_fromBech32 + , datumSource_new + , datumSource_newRefInput + , ed25519KeyHash_toBech32 + , ed25519KeyHash_fromBech32 + , ed25519KeyHashes_new + , ed25519KeyHashes_toOption + , ed25519Signature_toBech32 + , ed25519Signature_fromBech32 + , enterpriseAddress_new + , enterpriseAddress_paymentCred + , enterpriseAddress_toAddress + , enterpriseAddress_fromAddress + , exUnitPrices_memPrice + , exUnitPrices_stepPrice + , exUnitPrices_new + , exUnits_mem + , exUnits_steps + , exUnits_new + , fixedTransaction_new + , fixedTransaction_newWithAuxiliary + , fixedTransaction_body + , fixedTransaction_rawBody + , fixedTransaction_setBody + , fixedTransaction_setWitnessSet + , fixedTransaction_witnessSet + , fixedTransaction_rawWitnessSet + , fixedTransaction_setIsValid + , fixedTransaction_isValid + , fixedTransaction_setAuxiliaryData + , fixedTransaction_auxiliaryData + , fixedTransaction_rawAuxiliaryData + , generalTransactionMetadata_new + , genesisDelegateHash_toBech32 + , genesisDelegateHash_fromBech32 + , genesisHash_toBech32 + , genesisHash_fromBech32 + , genesisHashes_new + , genesisKeyDelegation_genesishash + , genesisKeyDelegation_genesisDelegateHash + , genesisKeyDelegation_vrfKeyhash + , genesisKeyDelegation_new + , inputWithScriptWitness_newWithNativeScriptWitness + , inputWithScriptWitness_newWithPlutusWitness + , inputWithScriptWitness_input + , inputsWithScriptWitness_new + , int_new + , int_newNegative + , int_newI32 + , int_isPositive + , int_asPositive + , int_asNegative + , int_asI32 + , int_asI32OrNothing + , int_asI32OrFail + , int_toStr + , int_fromStr + , ipv4_new + , ipv4_ip + , ipv6_new + , ipv6_ip + , kesvKey_toBech32 + , kesvKey_fromBech32 + , language_newPlutusV1 + , language_newPlutusV2 + , language_kind + , languages_new + , languages_list + , legacyDaedalusPrivateKey_asBytes + , legacyDaedalusPrivateKey_chaincode + , linearFee_constant + , linearFee_coefficient + , linearFee_new + , mirToStakeCredentials_new + , metadataList_new + , metadataMap_new + , metadataMap_insertStr + , metadataMap_insertI32 + , metadataMap_getStr + , metadataMap_getI32 + , metadataMap_has + , mint_new + , mint_newFromEntry + , mint_getAll + , mint_asPositiveMultiasset + , mint_asNegativeMultiasset + , mintAssets_new + , mintAssets_newFromEntry + , mintWitness_newNativeScript + , mintWitness_newPlutusScript + , moveInstantaneousReward_newToOtherPot + , moveInstantaneousReward_newToStakeCreds + , moveInstantaneousReward_pot + , moveInstantaneousReward_kind + , moveInstantaneousReward_asToOtherPot + , moveInstantaneousReward_asToStakeCreds + , moveInstantaneousRewardsCert_moveInstantaneousReward + , moveInstantaneousRewardsCert_new + , multiAsset_new + , multiAsset_setAsset + , multiAsset_getAsset + , multiAsset_sub + , multiHostName_dnsName + , multiHostName_new + , nativeScript_hash + , nativeScript_newScriptPubkey + , nativeScript_newScriptAll + , nativeScript_newScriptAny + , nativeScript_newScriptNOfK + , nativeScript_newTimelockStart + , nativeScript_newTimelockExpiry + , nativeScript_kind + , nativeScript_asScriptPubkey + , nativeScript_asScriptAll + , nativeScript_asScriptAny + , nativeScript_asScriptNOfK + , nativeScript_asTimelockStart + , nativeScript_asTimelockExpiry + , nativeScript_getRequiredSigners + , nativeScripts_new + , networkId_testnet + , networkId_mainnet + , networkId_kind + , networkInfo_new + , networkInfo_networkId + , networkInfo_protocolMagic + , networkInfo_testnetPreview + , networkInfo_testnetPreprod + , networkInfo_testnet + , networkInfo_mainnet + , nonce_newIdentity + , nonce_newFromHash + , nonce_getHash + , operationalCert_hotVkey + , operationalCert_sequenceNumber + , operationalCert_kesPeriod + , operationalCert_sigma + , operationalCert_new + , outputDatum_newDataHash + , outputDatum_newData + , outputDatum_dataHash + , outputDatum_data + , plutusData_newConstrPlutusData + , plutusData_newEmptyConstrPlutusData + , plutusData_newSingleValueConstrPlutusData + , plutusData_newMap + , plutusData_newList + , plutusData_newInteger + , plutusData_newBytes + , plutusData_kind + , plutusData_asConstrPlutusData + , plutusData_asMap + , plutusData_asList + , plutusData_asInteger + , plutusData_asBytes + , plutusData_fromAddress + , plutusList_new + , plutusMap_new + , plutusScript_new + , plutusScript_newV2 + , plutusScript_newWithVersion + , plutusScript_bytes + , plutusScript_fromBytesV2 + , plutusScript_fromBytesWithVersion + , plutusScript_fromHexWithVersion + , plutusScript_hash + , plutusScript_languageVersion + , plutusScriptSource_new + , plutusScriptSource_newRefInput + , plutusScriptSource_newRefInputWithLangVer + , plutusScripts_new + , plutusWitness_new + , plutusWitness_newWithRef + , plutusWitness_newWithoutDatum + , plutusWitness_newWithRefWithoutDatum + , plutusWitness_script + , plutusWitness_datum + , plutusWitness_redeemer + , plutusWitnesses_new + , pointer_new + , pointer_newPointer + , pointer_slot + , pointer_txIndex + , pointer_certIndex + , pointer_slotBignum + , pointer_txIndexBignum + , pointer_certIndexBignum + , pointerAddress_new + , pointerAddress_paymentCred + , pointerAddress_stakePointer + , pointerAddress_toAddress + , pointerAddress_fromAddress + , poolMetadata_url + , poolMetadata_poolMetadataHash + , poolMetadata_new + , poolMetadataHash_toBech32 + , poolMetadataHash_fromBech32 + , poolParams_operator + , poolParams_vrfKeyhash + , poolParams_pledge + , poolParams_cost + , poolParams_margin + , poolParams_rewardAccount + , poolParams_poolOwners + , poolParams_relays + , poolParams_poolMetadata + , poolParams_new + , poolRegistration_poolParams + , poolRegistration_new + , poolRetirement_poolKeyhash + , poolRetirement_epoch + , poolRetirement_new + , privateKey_free + , privateKey_toPublic + , privateKey_generateEd25519 + , privateKey_generateEd25519extended + , privateKey_fromBech32 + , privateKey_toBech32 + , privateKey_asBytes + , privateKey_fromExtendedBytes + , privateKey_fromNormalBytes + , privateKey_sign + , privateKey_toHex + , privateKey_fromHex + , proposedProtocolParameterUpdates_new + , protocolParamUpdate_setMinfeeA + , protocolParamUpdate_minfeeA + , protocolParamUpdate_setMinfeeB + , protocolParamUpdate_minfeeB + , protocolParamUpdate_setMaxBlockBodySize + , protocolParamUpdate_maxBlockBodySize + , protocolParamUpdate_setMaxTxSize + , protocolParamUpdate_maxTxSize + , protocolParamUpdate_setMaxBlockHeaderSize + , protocolParamUpdate_maxBlockHeaderSize + , protocolParamUpdate_setKeyDeposit + , protocolParamUpdate_keyDeposit + , protocolParamUpdate_setPoolDeposit + , protocolParamUpdate_poolDeposit + , protocolParamUpdate_setMaxEpoch + , protocolParamUpdate_maxEpoch + , protocolParamUpdate_setNOpt + , protocolParamUpdate_nOpt + , protocolParamUpdate_setPoolPledgeInfluence + , protocolParamUpdate_poolPledgeInfluence + , protocolParamUpdate_setExpansionRate + , protocolParamUpdate_expansionRate + , protocolParamUpdate_setTreasuryGrowthRate + , protocolParamUpdate_treasuryGrowthRate + , protocolParamUpdate_d + , protocolParamUpdate_extraEntropy + , protocolParamUpdate_setProtocolVersion + , protocolParamUpdate_protocolVersion + , protocolParamUpdate_setMinPoolCost + , protocolParamUpdate_minPoolCost + , protocolParamUpdate_setAdaPerUtxoByte + , protocolParamUpdate_adaPerUtxoByte + , protocolParamUpdate_setCostModels + , protocolParamUpdate_costModels + , protocolParamUpdate_setExecutionCosts + , protocolParamUpdate_executionCosts + , protocolParamUpdate_setMaxTxExUnits + , protocolParamUpdate_maxTxExUnits + , protocolParamUpdate_setMaxBlockExUnits + , protocolParamUpdate_maxBlockExUnits + , protocolParamUpdate_setMaxValueSize + , protocolParamUpdate_maxValueSize + , protocolParamUpdate_setCollateralPercentage + , protocolParamUpdate_collateralPercentage + , protocolParamUpdate_setMaxCollateralInputs + , protocolParamUpdate_maxCollateralInputs + , protocolParamUpdate_new + , protocolVersion_major + , protocolVersion_minor + , protocolVersion_new + , publicKey_free + , publicKey_fromBech32 + , publicKey_toBech32 + , publicKey_asBytes + , publicKey_fromBytes + , publicKey_verify + , publicKey_hash + , publicKey_toHex + , publicKey_fromHex + , redeemer_tag + , redeemer_index + , redeemer_data + , redeemer_exUnits + , redeemer_new + , redeemerTag_newSpend + , redeemerTag_newMint + , redeemerTag_newCert + , redeemerTag_newReward + , redeemerTag_kind + , redeemers_new + , redeemers_totalExUnits + , relay_newSingleHostAddr + , relay_newSingleHostName + , relay_newMultiHostName + , relay_kind + , relay_asSingleHostAddr + , relay_asSingleHostName + , relay_asMultiHostName + , relays_new + , rewardAddress_new + , rewardAddress_paymentCred + , rewardAddress_toAddress + , rewardAddress_fromAddress + , rewardAddresses_new + , scriptAll_nativeScripts + , scriptAll_new + , scriptAny_nativeScripts + , scriptAny_new + , scriptDataHash_toBech32 + , scriptDataHash_fromBech32 + , scriptHash_toBech32 + , scriptHash_fromBech32 + , scriptHashes_new + , scriptNOfK_n + , scriptNOfK_nativeScripts + , scriptNOfK_new + , scriptPubkey_addrKeyhash + , scriptPubkey_new + , scriptRef_newNativeScript + , scriptRef_newPlutusScript + , scriptRef_isNativeScript + , scriptRef_isPlutusScript + , scriptRef_nativeScript + , scriptRef_plutusScript + , singleHostAddr_port + , singleHostAddr_ipv4 + , singleHostAddr_ipv6 + , singleHostAddr_new + , singleHostName_port + , singleHostName_dnsName + , singleHostName_new + , stakeCredential_fromKeyhash + , stakeCredential_fromScripthash + , stakeCredential_toKeyhash + , stakeCredential_toScripthash + , stakeCredential_kind + , stakeCredentials_new + , stakeDelegation_stakeCredential + , stakeDelegation_poolKeyhash + , stakeDelegation_new + , stakeDeregistration_stakeCredential + , stakeDeregistration_new + , stakeRegistration_stakeCredential + , stakeRegistration_new + , timelockExpiry_slot + , timelockExpiry_slotBignum + , timelockExpiry_new + , timelockExpiry_newTimelockexpiry + , timelockStart_slot + , timelockStart_slotBignum + , timelockStart_new + , timelockStart_newTimelockstart + , transaction_body + , transaction_witnessSet + , transaction_isValid + , transaction_auxiliaryData + , transaction_setIsValid + , transaction_new + , transactionBody_inputs + , transactionBody_outputs + , transactionBody_fee + , transactionBody_ttl + , transactionBody_ttlBignum + , transactionBody_setTtl + , transactionBody_removeTtl + , transactionBody_setCerts + , transactionBody_certs + , transactionBody_setWithdrawals + , transactionBody_withdrawals + , transactionBody_setUpdate + , transactionBody_update + , transactionBody_setAuxiliaryDataHash + , transactionBody_auxiliaryDataHash + , transactionBody_setValidityStartInterval + , transactionBody_setValidityStartIntervalBignum + , transactionBody_validityStartIntervalBignum + , transactionBody_validityStartInterval + , transactionBody_setMint + , transactionBody_mint + , transactionBody_multiassets + , transactionBody_setReferenceInputs + , transactionBody_referenceInputs + , transactionBody_setScriptDataHash + , transactionBody_scriptDataHash + , transactionBody_setCollateral + , transactionBody_collateral + , transactionBody_setRequiredSigners + , transactionBody_requiredSigners + , transactionBody_setNetworkId + , transactionBody_networkId + , transactionBody_setCollateralReturn + , transactionBody_collateralReturn + , transactionBody_setTotalCollateral + , transactionBody_totalCollateral + , transactionBody_new + , transactionBody_newTxBody + , transactionHash_toBech32 + , transactionHash_fromBech32 + , transactionInput_transactionId + , transactionInput_index + , transactionInput_new + , transactionInputs_new + , transactionInputs_toOption + , transactionMetadatum_newMap + , transactionMetadatum_newList + , transactionMetadatum_newInt + , transactionMetadatum_newBytes + , transactionMetadatum_newText + , transactionMetadatum_kind + , transactionMetadatum_asMap + , transactionMetadatum_asList + , transactionMetadatum_asInt + , transactionMetadatum_asBytes + , transactionMetadatum_asText + , transactionMetadatumLabels_new + , transactionOutput_address + , transactionOutput_amount + , transactionOutput_dataHash + , transactionOutput_plutusData + , transactionOutput_scriptRef + , transactionOutput_setScriptRef + , transactionOutput_setPlutusData + , transactionOutput_setDataHash + , transactionOutput_hasPlutusData + , transactionOutput_hasDataHash + , transactionOutput_hasScriptRef + , transactionOutput_new + , transactionOutput_serializationFormat + , transactionOutputs_new + , transactionUnspentOutput_new + , transactionUnspentOutput_input + , transactionUnspentOutput_output + , transactionUnspentOutputs_new + , transactionWitnessSet_setVkeys + , transactionWitnessSet_vkeys + , transactionWitnessSet_setNativeScripts + , transactionWitnessSet_nativeScripts + , transactionWitnessSet_setBootstraps + , transactionWitnessSet_bootstraps + , transactionWitnessSet_setPlutusScripts + , transactionWitnessSet_plutusScripts + , transactionWitnessSet_setPlutusData + , transactionWitnessSet_plutusData + , transactionWitnessSet_setRedeemers + , transactionWitnessSet_redeemers + , transactionWitnessSet_new + , url_new + , url_url + , unitInterval_numerator + , unitInterval_denominator + , unitInterval_new + , update_proposedProtocolParameterUpdates + , update_epoch + , update_new + , vrfCert_output + , vrfCert_proof + , vrfCert_new + , vrfKeyHash_toBech32 + , vrfKeyHash_fromBech32 + , vrfvKey_toBech32 + , vrfvKey_fromBech32 + , value_new + , value_newFromAssets + , value_newWithAssets + , value_zero + , value_isZero + , value_coin + , value_setCoin + , value_multiasset + , value_setMultiasset + , value_checkedAdd + , value_checkedSub + , value_clampedSub + , value_compare + , vkey_new + , vkey_publicKey + , vkeys_new + , vkeywitness_new + , vkeywitness_vkey + , vkeywitness_signature + , vkeywitnesses_new + , withdrawals_new + , hashTransaction + , hashPlutusData + , minAdaForOutput + , Address + , AssetName + , AssetNames + , Assets + , AuxiliaryData + , AuxiliaryDataHash + , BaseAddress + , BigInt + , BigNum + , Bip32PrivateKey + , Bip32PublicKey + , BlockHash + , BootstrapWitness + , BootstrapWitnesses + , ByronAddress + , Certificate + , Certificates + , ConstrPlutusData + , CostModel + , Costmdls + , DNSRecordAorAAAA + , DNSRecordSRV + , DataCost + , DataHash + , DatumSource + , Ed25519KeyHash + , Ed25519KeyHashes + , Ed25519Signature + , EnterpriseAddress + , ExUnitPrices + , ExUnits + , FixedTransaction + , GeneralTransactionMetadata + , GenesisDelegateHash + , GenesisHash + , GenesisHashes + , GenesisKeyDelegation + , InputWithScriptWitness + , InputsWithScriptWitness + , Int + , Ipv4 + , Ipv6 + , KESSignature + , KESVKey + , Language + , Languages + , LegacyDaedalusPrivateKey + , LinearFee + , MIRToStakeCredentials + , MetadataList + , MetadataMap + , Mint + , MintAssets + , MintWitness + , MintsAssets + , MoveInstantaneousReward + , MoveInstantaneousRewardsCert + , MultiAsset + , MultiHostName + , NativeScript + , NativeScripts + , NetworkId + , NetworkInfo + , Nonce + , OperationalCert + , OutputDatum + , PlutusData + , PlutusList + , PlutusMap + , PlutusScript + , PlutusScriptSource + , PlutusScripts + , PlutusWitness + , PlutusWitnesses + , Pointer + , PointerAddress + , PoolMetadata + , PoolMetadataHash + , PoolParams + , PoolRegistration + , PoolRetirement + , PrivateKey + , ProposedProtocolParameterUpdates + , ProtocolParamUpdate + , ProtocolVersion + , PublicKey + , Redeemer + , RedeemerTag + , Redeemers + , Relay + , Relays + , RewardAddress + , RewardAddresses + , ScriptAll + , ScriptAny + , ScriptDataHash + , ScriptHash + , ScriptHashes + , ScriptNOfK + , ScriptPubkey + , ScriptRef + , SingleHostAddr + , SingleHostName + , StakeCredential + , StakeCredentials + , StakeDelegation + , StakeDeregistration + , StakeRegistration + , TimelockExpiry + , TimelockStart + , Transaction + , TransactionBatch + , TransactionBatchList + , TransactionBody + , TransactionHash + , TransactionInput + , TransactionInputs + , TransactionMetadatum + , TransactionMetadatumLabels + , TransactionOutput + , TransactionOutputs + , TransactionUnspentOutput + , TransactionUnspentOutputs + , TransactionWitnessSet + , URL + , UnitInterval + , Update + , VRFCert + , VRFKeyHash + , VRFVKey + , Value + , Vkey + , Vkeys + , Vkeywitness + , Vkeywitnesses + , Withdrawals + ) where +import Prelude + +import Cardano.Serialization.Lib.Internal +import Cardano.Serialization.Lib.Internal + ( class IsBytes + , class IsCsl + , class IsJson + , toBytes + , fromBytes + , packListContainer + , packMapContainer + , packMapContainerFromMap + , unpackMapContainerToMapWith + , unpackMapContainer + , unpackListContainer + , cslFromAeson + , cslToAeson + , cslFromAesonViaBytes + , cslToAesonViaBytes + ) as X +import Effect +import Data.Nullable +import Aeson (Aeson, class DecodeAeson, encodeAeson, decodeAeson, class EncodeAeson, jsonToAeson, stringifyAeson) +import Data.ByteArray (ByteArray) +import Data.Argonaut (Json, JsonDecodeError(TypeMismatch), jsonParser) +import Data.Bifunctor (lmap) +import Data.Either (Either(Left, Right), note) +import Data.Map (Map) +import Data.Map as Map +import Data.Maybe (Maybe(Nothing, Just)) +import Data.Tuple (Tuple(Tuple)) +import Type.Proxy (Proxy(Proxy)) + +-- Utils for type conversions +type ForeignErrorable a = + (String -> Either String a) -> (a -> Either String a) -> Either String a + +runForeignErrorable :: forall (a :: Type). ForeignErrorable a -> Either String a +runForeignErrorable f = f Left Right + +class IsStr a where + fromStr :: String -> Maybe a + toStr :: a -> String + + +-- functions +-- | Hash transaction +-- > hashTransaction txBody +foreign import hashTransaction :: TransactionBody -> TransactionHash + +-- | Hash plutus data +-- > hashPlutusData plutusData +foreign import hashPlutusData :: PlutusData -> DataHash + +-- | Min ada for output +-- > minAdaForOutput output dataCost +foreign import minAdaForOutput :: TransactionOutput -> DataCost -> BigNum + + + +-- classes + + +------------------------------------------------------------------------------------- +-- Address + +foreign import data Address :: Type + +foreign import address_toBech32 :: Address -> String -> String +foreign import address_fromBech32 :: String -> Nullable Address +foreign import address_networkId :: Address -> Number + +instance IsCsl Address where + className _ = "Address" +instance IsBytes Address +instance IsJson Address +instance EncodeAeson Address where encodeAeson = cslToAeson +instance DecodeAeson Address where decodeAeson = cslFromAeson +instance Show Address where show = showViaJson + +------------------------------------------------------------------------------------- +-- Asset name + +foreign import data AssetName :: Type + +foreign import assetName_new :: ByteArray -> AssetName +foreign import assetName_name :: AssetName -> ByteArray + +instance IsCsl AssetName where + className _ = "AssetName" +instance IsBytes AssetName +instance IsJson AssetName +instance EncodeAeson AssetName where encodeAeson = cslToAeson +instance DecodeAeson AssetName where decodeAeson = cslFromAeson +instance Show AssetName where show = showViaJson + +------------------------------------------------------------------------------------- +-- Asset names + +foreign import data AssetNames :: Type + +foreign import assetNames_new :: Effect AssetNames + +instance IsCsl AssetNames where + className _ = "AssetNames" +instance IsBytes AssetNames +instance IsJson AssetNames +instance EncodeAeson AssetNames where encodeAeson = cslToAeson +instance DecodeAeson AssetNames where decodeAeson = cslFromAeson +instance Show AssetNames where show = showViaJson + +instance IsListContainer AssetNames AssetName + +------------------------------------------------------------------------------------- +-- Assets + +foreign import data Assets :: Type + +foreign import assets_new :: Effect Assets + +instance IsCsl Assets where + className _ = "Assets" +instance IsBytes Assets +instance IsJson Assets +instance EncodeAeson Assets where encodeAeson = cslToAeson +instance DecodeAeson Assets where decodeAeson = cslFromAeson +instance Show Assets where show = showViaJson + +instance IsMapContainer Assets AssetName BigNum + +------------------------------------------------------------------------------------- +-- Auxiliary data + +foreign import data AuxiliaryData :: Type + +foreign import auxiliaryData_new :: Effect AuxiliaryData +foreign import auxiliaryData_metadata :: AuxiliaryData -> Nullable GeneralTransactionMetadata +foreign import auxiliaryData_setMetadata :: AuxiliaryData -> GeneralTransactionMetadata -> Nullable Unit +foreign import auxiliaryData_nativeScripts :: AuxiliaryData -> Effect ((Nullable NativeScripts)) +foreign import auxiliaryData_setNativeScripts :: AuxiliaryData -> NativeScripts -> Nullable Unit +foreign import auxiliaryData_plutusScripts :: AuxiliaryData -> Effect ((Nullable PlutusScripts)) +foreign import auxiliaryData_setPlutusScripts :: AuxiliaryData -> PlutusScripts -> Nullable Unit +foreign import auxiliaryData_preferAlonzoFormat :: AuxiliaryData -> Boolean +foreign import auxiliaryData_setPreferAlonzoFormat :: AuxiliaryData -> Boolean -> Nullable Unit + +instance IsCsl AuxiliaryData where + className _ = "AuxiliaryData" +instance IsBytes AuxiliaryData +instance IsJson AuxiliaryData +instance EncodeAeson AuxiliaryData where encodeAeson = cslToAeson +instance DecodeAeson AuxiliaryData where decodeAeson = cslFromAeson +instance Show AuxiliaryData where show = showViaJson + +------------------------------------------------------------------------------------- +-- Auxiliary data hash + +foreign import data AuxiliaryDataHash :: Type + +foreign import auxiliaryDataHash_toBech32 :: AuxiliaryDataHash -> String -> String +foreign import auxiliaryDataHash_fromBech32 :: String -> Nullable AuxiliaryDataHash + +instance IsCsl AuxiliaryDataHash where + className _ = "AuxiliaryDataHash" +instance IsBytes AuxiliaryDataHash +instance EncodeAeson AuxiliaryDataHash where encodeAeson = cslToAesonViaBytes +instance DecodeAeson AuxiliaryDataHash where decodeAeson = cslFromAesonViaBytes +instance Show AuxiliaryDataHash where show = showViaBytes + +------------------------------------------------------------------------------------- +-- Base address + +foreign import data BaseAddress :: Type + +foreign import baseAddress_new :: Number -> StakeCredential -> StakeCredential -> BaseAddress +foreign import baseAddress_paymentCred :: BaseAddress -> StakeCredential +foreign import baseAddress_stakeCred :: BaseAddress -> StakeCredential +foreign import baseAddress_toAddress :: BaseAddress -> Address +foreign import baseAddress_fromAddress :: Address -> Nullable BaseAddress + +instance IsCsl BaseAddress where + className _ = "BaseAddress" + +------------------------------------------------------------------------------------- +-- Big int + +foreign import data BigInt :: Type + +foreign import bigInt_isZero :: BigInt -> Boolean +foreign import bigInt_asU64 :: BigInt -> Nullable BigNum +foreign import bigInt_asInt :: BigInt -> Nullable Int +foreign import bigInt_fromStr :: String -> Nullable BigInt +foreign import bigInt_toStr :: BigInt -> String +foreign import bigInt_mul :: BigInt -> BigInt -> BigInt +foreign import bigInt_one :: BigInt +foreign import bigInt_increment :: BigInt -> BigInt +foreign import bigInt_divCeil :: BigInt -> BigInt -> BigInt + +instance IsCsl BigInt where + className _ = "BigInt" +instance IsBytes BigInt +instance IsJson BigInt +instance EncodeAeson BigInt where encodeAeson = cslToAeson +instance DecodeAeson BigInt where decodeAeson = cslFromAeson +instance Show BigInt where show = showViaJson + +------------------------------------------------------------------------------------- +-- Big num + +foreign import data BigNum :: Type + +foreign import bigNum_fromStr :: String -> Nullable BigNum +foreign import bigNum_toStr :: BigNum -> String +foreign import bigNum_zero :: BigNum +foreign import bigNum_one :: BigNum +foreign import bigNum_isZero :: BigNum -> Boolean +foreign import bigNum_divFloor :: BigNum -> BigNum -> BigNum +foreign import bigNum_checkedMul :: BigNum -> BigNum -> Nullable BigNum +foreign import bigNum_checkedAdd :: BigNum -> BigNum -> Nullable BigNum +foreign import bigNum_checkedSub :: BigNum -> BigNum -> Nullable BigNum +foreign import bigNum_clampedSub :: BigNum -> BigNum -> BigNum +foreign import bigNum_compare :: BigNum -> BigNum -> Number +foreign import bigNum_lessThan :: BigNum -> BigNum -> Boolean +foreign import bigNum_maxValue :: BigNum +foreign import bigNum_max :: BigNum -> BigNum -> BigNum + +instance IsCsl BigNum where + className _ = "BigNum" +instance IsBytes BigNum +instance IsJson BigNum +instance EncodeAeson BigNum where encodeAeson = cslToAeson +instance DecodeAeson BigNum where decodeAeson = cslFromAeson +instance Show BigNum where show = showViaJson + +------------------------------------------------------------------------------------- +-- Bip32 private key + +foreign import data Bip32PrivateKey :: Type + +foreign import bip32PrivateKey_derive :: Bip32PrivateKey -> Number -> Bip32PrivateKey +foreign import bip32PrivateKey_from128Xprv :: ByteArray -> Bip32PrivateKey +foreign import bip32PrivateKey_to128Xprv :: Bip32PrivateKey -> ByteArray +foreign import bip32PrivateKey_generateEd25519Bip32 :: Bip32PrivateKey +foreign import bip32PrivateKey_toRawKey :: Bip32PrivateKey -> PrivateKey +foreign import bip32PrivateKey_toPublic :: Bip32PrivateKey -> Bip32PublicKey +foreign import bip32PrivateKey_asBytes :: Bip32PrivateKey -> ByteArray +foreign import bip32PrivateKey_fromBech32 :: String -> Nullable Bip32PrivateKey +foreign import bip32PrivateKey_toBech32 :: Bip32PrivateKey -> String +foreign import bip32PrivateKey_fromBip39Entropy :: ByteArray -> ByteArray -> Bip32PrivateKey +foreign import bip32PrivateKey_chaincode :: Bip32PrivateKey -> ByteArray + +instance IsCsl Bip32PrivateKey where + className _ = "Bip32PrivateKey" + +------------------------------------------------------------------------------------- +-- Bip32 public key + +foreign import data Bip32PublicKey :: Type + +foreign import bip32PublicKey_derive :: Bip32PublicKey -> Number -> Bip32PublicKey +foreign import bip32PublicKey_toRawKey :: Bip32PublicKey -> PublicKey +foreign import bip32PublicKey_asBytes :: Bip32PublicKey -> ByteArray +foreign import bip32PublicKey_fromBech32 :: String -> Nullable Bip32PublicKey +foreign import bip32PublicKey_toBech32 :: Bip32PublicKey -> String +foreign import bip32PublicKey_chaincode :: Bip32PublicKey -> ByteArray + +instance IsCsl Bip32PublicKey where + className _ = "Bip32PublicKey" + +------------------------------------------------------------------------------------- +-- Block hash + +foreign import data BlockHash :: Type + +foreign import blockHash_toBech32 :: BlockHash -> String -> String +foreign import blockHash_fromBech32 :: String -> Nullable BlockHash + +instance IsCsl BlockHash where + className _ = "BlockHash" +instance IsBytes BlockHash +instance EncodeAeson BlockHash where encodeAeson = cslToAesonViaBytes +instance DecodeAeson BlockHash where decodeAeson = cslFromAesonViaBytes +instance Show BlockHash where show = showViaBytes + +------------------------------------------------------------------------------------- +-- Bootstrap witness + +foreign import data BootstrapWitness :: Type + +foreign import bootstrapWitness_vkey :: BootstrapWitness -> Vkey +foreign import bootstrapWitness_signature :: BootstrapWitness -> Ed25519Signature +foreign import bootstrapWitness_chainCode :: BootstrapWitness -> ByteArray +foreign import bootstrapWitness_attributes :: BootstrapWitness -> ByteArray +foreign import bootstrapWitness_new :: Vkey -> Ed25519Signature -> ByteArray -> ByteArray -> BootstrapWitness + +instance IsCsl BootstrapWitness where + className _ = "BootstrapWitness" +instance IsBytes BootstrapWitness +instance IsJson BootstrapWitness +instance EncodeAeson BootstrapWitness where encodeAeson = cslToAeson +instance DecodeAeson BootstrapWitness where decodeAeson = cslFromAeson +instance Show BootstrapWitness where show = showViaJson + +------------------------------------------------------------------------------------- +-- Bootstrap witnesses + +foreign import data BootstrapWitnesses :: Type + +foreign import bootstrapWitnesses_new :: Effect BootstrapWitnesses + +instance IsCsl BootstrapWitnesses where + className _ = "BootstrapWitnesses" + +instance IsListContainer BootstrapWitnesses BootstrapWitness + +------------------------------------------------------------------------------------- +-- Byron address + +foreign import data ByronAddress :: Type + +foreign import byronAddress_toBase58 :: ByronAddress -> String +foreign import byronAddress_byronProtocolMagic :: ByronAddress -> Number +foreign import byronAddress_attributes :: ByronAddress -> ByteArray +foreign import byronAddress_networkId :: ByronAddress -> Number +foreign import byronAddress_fromBase58 :: String -> Nullable ByronAddress +foreign import byronAddress_icarusFromKey :: Bip32PublicKey -> Number -> ByronAddress +foreign import byronAddress_isValid :: String -> Boolean +foreign import byronAddress_toAddress :: ByronAddress -> Address +foreign import byronAddress_fromAddress :: Address -> Nullable ByronAddress + +instance IsCsl ByronAddress where + className _ = "ByronAddress" +instance IsBytes ByronAddress +instance EncodeAeson ByronAddress where encodeAeson = cslToAesonViaBytes +instance DecodeAeson ByronAddress where decodeAeson = cslFromAesonViaBytes +instance Show ByronAddress where show = showViaBytes + +------------------------------------------------------------------------------------- +-- Certificate + +foreign import data Certificate :: Type + +foreign import certificate_newStakeRegistration :: StakeRegistration -> Certificate +foreign import certificate_newStakeDeregistration :: StakeDeregistration -> Certificate +foreign import certificate_newStakeDelegation :: StakeDelegation -> Certificate +foreign import certificate_newPoolRegistration :: PoolRegistration -> Certificate +foreign import certificate_newPoolRetirement :: PoolRetirement -> Certificate +foreign import certificate_newGenesisKeyDelegation :: GenesisKeyDelegation -> Certificate +foreign import certificate_newMoveInstantaneousRewardsCert :: MoveInstantaneousRewardsCert -> Certificate +foreign import certificate_kind :: Certificate -> Number +foreign import certificate_asStakeRegistration :: Certificate -> Nullable StakeRegistration +foreign import certificate_asStakeDeregistration :: Certificate -> Nullable StakeDeregistration +foreign import certificate_asStakeDelegation :: Certificate -> Nullable StakeDelegation +foreign import certificate_asPoolRegistration :: Certificate -> Nullable PoolRegistration +foreign import certificate_asPoolRetirement :: Certificate -> Nullable PoolRetirement +foreign import certificate_asGenesisKeyDelegation :: Certificate -> Nullable GenesisKeyDelegation +foreign import certificate_asMoveInstantaneousRewardsCert :: Certificate -> Nullable MoveInstantaneousRewardsCert + +instance IsCsl Certificate where + className _ = "Certificate" +instance IsBytes Certificate +instance IsJson Certificate +instance EncodeAeson Certificate where encodeAeson = cslToAeson +instance DecodeAeson Certificate where decodeAeson = cslFromAeson +instance Show Certificate where show = showViaJson + +------------------------------------------------------------------------------------- +-- Certificates + +foreign import data Certificates :: Type + +foreign import certificates_new :: Effect Certificates + +instance IsCsl Certificates where + className _ = "Certificates" +instance IsBytes Certificates +instance IsJson Certificates +instance EncodeAeson Certificates where encodeAeson = cslToAeson +instance DecodeAeson Certificates where decodeAeson = cslFromAeson +instance Show Certificates where show = showViaJson + +instance IsListContainer Certificates Certificate + +------------------------------------------------------------------------------------- +-- Constr plutus data + +foreign import data ConstrPlutusData :: Type + +foreign import constrPlutusData_alternative :: ConstrPlutusData -> BigNum +foreign import constrPlutusData_data :: ConstrPlutusData -> PlutusList +foreign import constrPlutusData_new :: BigNum -> PlutusList -> ConstrPlutusData + +instance IsCsl ConstrPlutusData where + className _ = "ConstrPlutusData" +instance IsBytes ConstrPlutusData +instance EncodeAeson ConstrPlutusData where encodeAeson = cslToAesonViaBytes +instance DecodeAeson ConstrPlutusData where decodeAeson = cslFromAesonViaBytes +instance Show ConstrPlutusData where show = showViaBytes + +------------------------------------------------------------------------------------- +-- Cost model + +foreign import data CostModel :: Type + +foreign import costModel_new :: Effect CostModel +foreign import costModel_set :: CostModel -> Number -> Int -> Effect Int + +instance IsCsl CostModel where + className _ = "CostModel" +instance IsBytes CostModel +instance IsJson CostModel +instance EncodeAeson CostModel where encodeAeson = cslToAeson +instance DecodeAeson CostModel where decodeAeson = cslFromAeson +instance Show CostModel where show = showViaJson + +------------------------------------------------------------------------------------- +-- Costmdls + +foreign import data Costmdls :: Type + +foreign import costmdls_new :: Effect Costmdls +foreign import costmdls_retainLanguageVersions :: Costmdls -> Languages -> Costmdls + +instance IsCsl Costmdls where + className _ = "Costmdls" +instance IsBytes Costmdls +instance IsJson Costmdls +instance EncodeAeson Costmdls where encodeAeson = cslToAeson +instance DecodeAeson Costmdls where decodeAeson = cslFromAeson +instance Show Costmdls where show = showViaJson + +instance IsMapContainer Costmdls Language CostModel + +------------------------------------------------------------------------------------- +-- DNSRecord aor aaaa + +foreign import data DNSRecordAorAAAA :: Type + +foreign import dnsRecordAorAAAA_new :: String -> DNSRecordAorAAAA +foreign import dnsRecordAorAAAA_record :: DNSRecordAorAAAA -> String + +instance IsCsl DNSRecordAorAAAA where + className _ = "DNSRecordAorAAAA" +instance IsBytes DNSRecordAorAAAA +instance IsJson DNSRecordAorAAAA +instance EncodeAeson DNSRecordAorAAAA where encodeAeson = cslToAeson +instance DecodeAeson DNSRecordAorAAAA where decodeAeson = cslFromAeson +instance Show DNSRecordAorAAAA where show = showViaJson + +------------------------------------------------------------------------------------- +-- DNSRecord srv + +foreign import data DNSRecordSRV :: Type + +foreign import dnsRecordSRV_new :: String -> DNSRecordSRV +foreign import dnsRecordSRV_record :: DNSRecordSRV -> String + +instance IsCsl DNSRecordSRV where + className _ = "DNSRecordSRV" +instance IsBytes DNSRecordSRV +instance IsJson DNSRecordSRV +instance EncodeAeson DNSRecordSRV where encodeAeson = cslToAeson +instance DecodeAeson DNSRecordSRV where decodeAeson = cslFromAeson +instance Show DNSRecordSRV where show = showViaJson + +------------------------------------------------------------------------------------- +-- Data cost + +foreign import data DataCost :: Type + +foreign import dataCost_newCoinsPerWord :: BigNum -> DataCost +foreign import dataCost_newCoinsPerByte :: BigNum -> DataCost +foreign import dataCost_coinsPerByte :: DataCost -> BigNum + +instance IsCsl DataCost where + className _ = "DataCost" + +------------------------------------------------------------------------------------- +-- Data hash + +foreign import data DataHash :: Type + +foreign import dataHash_toBech32 :: DataHash -> String -> String +foreign import dataHash_fromBech32 :: String -> Nullable DataHash + +instance IsCsl DataHash where + className _ = "DataHash" +instance IsBytes DataHash +instance EncodeAeson DataHash where encodeAeson = cslToAesonViaBytes +instance DecodeAeson DataHash where decodeAeson = cslFromAesonViaBytes +instance Show DataHash where show = showViaBytes + +------------------------------------------------------------------------------------- +-- Datum source + +foreign import data DatumSource :: Type + +foreign import datumSource_new :: PlutusData -> DatumSource +foreign import datumSource_newRefInput :: TransactionInput -> DatumSource + +instance IsCsl DatumSource where + className _ = "DatumSource" + +------------------------------------------------------------------------------------- +-- Ed25519 key hash + +foreign import data Ed25519KeyHash :: Type + +foreign import ed25519KeyHash_toBech32 :: Ed25519KeyHash -> String -> String +foreign import ed25519KeyHash_fromBech32 :: String -> Nullable Ed25519KeyHash + +instance IsCsl Ed25519KeyHash where + className _ = "Ed25519KeyHash" +instance IsBytes Ed25519KeyHash +instance EncodeAeson Ed25519KeyHash where encodeAeson = cslToAesonViaBytes +instance DecodeAeson Ed25519KeyHash where decodeAeson = cslFromAesonViaBytes +instance Show Ed25519KeyHash where show = showViaBytes + +------------------------------------------------------------------------------------- +-- Ed25519 key hashes + +foreign import data Ed25519KeyHashes :: Type + +foreign import ed25519KeyHashes_new :: Ed25519KeyHashes +foreign import ed25519KeyHashes_toOption :: Ed25519KeyHashes -> Nullable Ed25519KeyHashes + +instance IsCsl Ed25519KeyHashes where + className _ = "Ed25519KeyHashes" +instance IsBytes Ed25519KeyHashes +instance IsJson Ed25519KeyHashes +instance EncodeAeson Ed25519KeyHashes where encodeAeson = cslToAeson +instance DecodeAeson Ed25519KeyHashes where decodeAeson = cslFromAeson +instance Show Ed25519KeyHashes where show = showViaJson + +instance IsListContainer Ed25519KeyHashes Ed25519KeyHash + +------------------------------------------------------------------------------------- +-- Ed25519 signature + +foreign import data Ed25519Signature :: Type + +foreign import ed25519Signature_toBech32 :: Ed25519Signature -> String +foreign import ed25519Signature_fromBech32 :: String -> Nullable Ed25519Signature + +instance IsCsl Ed25519Signature where + className _ = "Ed25519Signature" +instance IsBytes Ed25519Signature +instance EncodeAeson Ed25519Signature where encodeAeson = cslToAesonViaBytes +instance DecodeAeson Ed25519Signature where decodeAeson = cslFromAesonViaBytes +instance Show Ed25519Signature where show = showViaBytes + +------------------------------------------------------------------------------------- +-- Enterprise address + +foreign import data EnterpriseAddress :: Type + +foreign import enterpriseAddress_new :: Number -> StakeCredential -> EnterpriseAddress +foreign import enterpriseAddress_paymentCred :: EnterpriseAddress -> StakeCredential +foreign import enterpriseAddress_toAddress :: EnterpriseAddress -> Address +foreign import enterpriseAddress_fromAddress :: Address -> Nullable EnterpriseAddress + +instance IsCsl EnterpriseAddress where + className _ = "EnterpriseAddress" + +------------------------------------------------------------------------------------- +-- Ex unit prices + +foreign import data ExUnitPrices :: Type + +foreign import exUnitPrices_memPrice :: ExUnitPrices -> UnitInterval +foreign import exUnitPrices_stepPrice :: ExUnitPrices -> UnitInterval +foreign import exUnitPrices_new :: UnitInterval -> UnitInterval -> ExUnitPrices + +instance IsCsl ExUnitPrices where + className _ = "ExUnitPrices" +instance IsBytes ExUnitPrices +instance IsJson ExUnitPrices +instance EncodeAeson ExUnitPrices where encodeAeson = cslToAeson +instance DecodeAeson ExUnitPrices where decodeAeson = cslFromAeson +instance Show ExUnitPrices where show = showViaJson + +------------------------------------------------------------------------------------- +-- Ex units + +foreign import data ExUnits :: Type + +foreign import exUnits_mem :: ExUnits -> BigNum +foreign import exUnits_steps :: ExUnits -> BigNum +foreign import exUnits_new :: BigNum -> BigNum -> ExUnits + +instance IsCsl ExUnits where + className _ = "ExUnits" +instance IsBytes ExUnits +instance IsJson ExUnits +instance EncodeAeson ExUnits where encodeAeson = cslToAeson +instance DecodeAeson ExUnits where decodeAeson = cslFromAeson +instance Show ExUnits where show = showViaJson + +------------------------------------------------------------------------------------- +-- Fixed transaction + +foreign import data FixedTransaction :: Type + +foreign import fixedTransaction_new :: ByteArray -> ByteArray -> Boolean -> FixedTransaction +foreign import fixedTransaction_newWithAuxiliary :: ByteArray -> ByteArray -> ByteArray -> Boolean -> FixedTransaction +foreign import fixedTransaction_body :: FixedTransaction -> TransactionBody +foreign import fixedTransaction_rawBody :: FixedTransaction -> ByteArray +foreign import fixedTransaction_setBody :: FixedTransaction -> ByteArray -> Nullable Unit +foreign import fixedTransaction_setWitnessSet :: FixedTransaction -> ByteArray -> Nullable Unit +foreign import fixedTransaction_witnessSet :: FixedTransaction -> TransactionWitnessSet +foreign import fixedTransaction_rawWitnessSet :: FixedTransaction -> ByteArray +foreign import fixedTransaction_setIsValid :: FixedTransaction -> Boolean -> Nullable Unit +foreign import fixedTransaction_isValid :: FixedTransaction -> Boolean +foreign import fixedTransaction_setAuxiliaryData :: FixedTransaction -> ByteArray -> Nullable Unit +foreign import fixedTransaction_auxiliaryData :: FixedTransaction -> Nullable AuxiliaryData +foreign import fixedTransaction_rawAuxiliaryData :: FixedTransaction -> Nullable ByteArray + +instance IsCsl FixedTransaction where + className _ = "FixedTransaction" +instance IsBytes FixedTransaction +instance EncodeAeson FixedTransaction where encodeAeson = cslToAesonViaBytes +instance DecodeAeson FixedTransaction where decodeAeson = cslFromAesonViaBytes +instance Show FixedTransaction where show = showViaBytes + +------------------------------------------------------------------------------------- +-- General transaction metadata + +foreign import data GeneralTransactionMetadata :: Type + +foreign import generalTransactionMetadata_new :: Effect GeneralTransactionMetadata + +instance IsCsl GeneralTransactionMetadata where + className _ = "GeneralTransactionMetadata" +instance IsBytes GeneralTransactionMetadata +instance IsJson GeneralTransactionMetadata +instance EncodeAeson GeneralTransactionMetadata where encodeAeson = cslToAeson +instance DecodeAeson GeneralTransactionMetadata where decodeAeson = cslFromAeson +instance Show GeneralTransactionMetadata where show = showViaJson + +instance IsMapContainer GeneralTransactionMetadata BigNum TransactionMetadatum + +------------------------------------------------------------------------------------- +-- Genesis delegate hash + +foreign import data GenesisDelegateHash :: Type + +foreign import genesisDelegateHash_toBech32 :: GenesisDelegateHash -> String -> String +foreign import genesisDelegateHash_fromBech32 :: String -> Nullable GenesisDelegateHash + +instance IsCsl GenesisDelegateHash where + className _ = "GenesisDelegateHash" +instance IsBytes GenesisDelegateHash +instance EncodeAeson GenesisDelegateHash where encodeAeson = cslToAesonViaBytes +instance DecodeAeson GenesisDelegateHash where decodeAeson = cslFromAesonViaBytes +instance Show GenesisDelegateHash where show = showViaBytes + +------------------------------------------------------------------------------------- +-- Genesis hash + +foreign import data GenesisHash :: Type + +foreign import genesisHash_toBech32 :: GenesisHash -> String -> String +foreign import genesisHash_fromBech32 :: String -> Nullable GenesisHash + +instance IsCsl GenesisHash where + className _ = "GenesisHash" +instance IsBytes GenesisHash +instance EncodeAeson GenesisHash where encodeAeson = cslToAesonViaBytes +instance DecodeAeson GenesisHash where decodeAeson = cslFromAesonViaBytes +instance Show GenesisHash where show = showViaBytes + +------------------------------------------------------------------------------------- +-- Genesis hashes + +foreign import data GenesisHashes :: Type + +foreign import genesisHashes_new :: Effect GenesisHashes + +instance IsCsl GenesisHashes where + className _ = "GenesisHashes" +instance IsBytes GenesisHashes +instance IsJson GenesisHashes +instance EncodeAeson GenesisHashes where encodeAeson = cslToAeson +instance DecodeAeson GenesisHashes where decodeAeson = cslFromAeson +instance Show GenesisHashes where show = showViaJson + +instance IsListContainer GenesisHashes GenesisHash + +------------------------------------------------------------------------------------- +-- Genesis key delegation + +foreign import data GenesisKeyDelegation :: Type + +foreign import genesisKeyDelegation_genesishash :: GenesisKeyDelegation -> GenesisHash +foreign import genesisKeyDelegation_genesisDelegateHash :: GenesisKeyDelegation -> GenesisDelegateHash +foreign import genesisKeyDelegation_vrfKeyhash :: GenesisKeyDelegation -> VRFKeyHash +foreign import genesisKeyDelegation_new :: GenesisHash -> GenesisDelegateHash -> VRFKeyHash -> GenesisKeyDelegation + +instance IsCsl GenesisKeyDelegation where + className _ = "GenesisKeyDelegation" +instance IsBytes GenesisKeyDelegation +instance IsJson GenesisKeyDelegation +instance EncodeAeson GenesisKeyDelegation where encodeAeson = cslToAeson +instance DecodeAeson GenesisKeyDelegation where decodeAeson = cslFromAeson +instance Show GenesisKeyDelegation where show = showViaJson + +------------------------------------------------------------------------------------- +-- Input with script witness + +foreign import data InputWithScriptWitness :: Type + +foreign import inputWithScriptWitness_newWithNativeScriptWitness :: TransactionInput -> NativeScript -> InputWithScriptWitness +foreign import inputWithScriptWitness_newWithPlutusWitness :: TransactionInput -> PlutusWitness -> InputWithScriptWitness +foreign import inputWithScriptWitness_input :: InputWithScriptWitness -> TransactionInput + +instance IsCsl InputWithScriptWitness where + className _ = "InputWithScriptWitness" + +------------------------------------------------------------------------------------- +-- Inputs with script witness + +foreign import data InputsWithScriptWitness :: Type + +foreign import inputsWithScriptWitness_new :: InputsWithScriptWitness + +instance IsCsl InputsWithScriptWitness where + className _ = "InputsWithScriptWitness" + +instance IsListContainer InputsWithScriptWitness InputWithScriptWitness + +------------------------------------------------------------------------------------- +-- Int + +foreign import data Int :: Type + +foreign import int_new :: BigNum -> Int +foreign import int_newNegative :: BigNum -> Int +foreign import int_newI32 :: Number -> Int +foreign import int_isPositive :: Int -> Boolean +foreign import int_asPositive :: Int -> Nullable BigNum +foreign import int_asNegative :: Int -> Nullable BigNum +foreign import int_asI32 :: Int -> Nullable Number +foreign import int_asI32OrNothing :: Int -> Nullable Number +foreign import int_asI32OrFail :: Int -> Number +foreign import int_toStr :: Int -> String +foreign import int_fromStr :: String -> Nullable Int + +instance IsCsl Int where + className _ = "Int" +instance IsBytes Int +instance IsJson Int +instance EncodeAeson Int where encodeAeson = cslToAeson +instance DecodeAeson Int where decodeAeson = cslFromAeson +instance Show Int where show = showViaJson + +------------------------------------------------------------------------------------- +-- Ipv4 + +foreign import data Ipv4 :: Type + +foreign import ipv4_new :: ByteArray -> Ipv4 +foreign import ipv4_ip :: Ipv4 -> ByteArray + +instance IsCsl Ipv4 where + className _ = "Ipv4" +instance IsBytes Ipv4 +instance IsJson Ipv4 +instance EncodeAeson Ipv4 where encodeAeson = cslToAeson +instance DecodeAeson Ipv4 where decodeAeson = cslFromAeson +instance Show Ipv4 where show = showViaJson + +------------------------------------------------------------------------------------- +-- Ipv6 + +foreign import data Ipv6 :: Type + +foreign import ipv6_new :: ByteArray -> Ipv6 +foreign import ipv6_ip :: Ipv6 -> ByteArray + +instance IsCsl Ipv6 where + className _ = "Ipv6" +instance IsBytes Ipv6 +instance IsJson Ipv6 +instance EncodeAeson Ipv6 where encodeAeson = cslToAeson +instance DecodeAeson Ipv6 where decodeAeson = cslFromAeson +instance Show Ipv6 where show = showViaJson + +------------------------------------------------------------------------------------- +-- KESSignature + +foreign import data KESSignature :: Type + + + +instance IsCsl KESSignature where + className _ = "KESSignature" +instance IsBytes KESSignature +instance EncodeAeson KESSignature where encodeAeson = cslToAesonViaBytes +instance DecodeAeson KESSignature where decodeAeson = cslFromAesonViaBytes +instance Show KESSignature where show = showViaBytes + +------------------------------------------------------------------------------------- +-- KESVKey + +foreign import data KESVKey :: Type + +foreign import kesvKey_toBech32 :: KESVKey -> String -> String +foreign import kesvKey_fromBech32 :: String -> Nullable KESVKey + +instance IsCsl KESVKey where + className _ = "KESVKey" +instance IsBytes KESVKey +instance EncodeAeson KESVKey where encodeAeson = cslToAesonViaBytes +instance DecodeAeson KESVKey where decodeAeson = cslFromAesonViaBytes +instance Show KESVKey where show = showViaBytes + +------------------------------------------------------------------------------------- +-- Language + +foreign import data Language :: Type + +foreign import language_newPlutusV1 :: Language +foreign import language_newPlutusV2 :: Language +foreign import language_kind :: Language -> Number + +instance IsCsl Language where + className _ = "Language" +instance IsBytes Language +instance IsJson Language +instance EncodeAeson Language where encodeAeson = cslToAeson +instance DecodeAeson Language where decodeAeson = cslFromAeson +instance Show Language where show = showViaJson + +------------------------------------------------------------------------------------- +-- Languages + +foreign import data Languages :: Type + +foreign import languages_new :: Effect Languages +foreign import languages_list :: Languages + +instance IsCsl Languages where + className _ = "Languages" + +instance IsListContainer Languages Language + +------------------------------------------------------------------------------------- +-- Legacy daedalus private key + +foreign import data LegacyDaedalusPrivateKey :: Type + +foreign import legacyDaedalusPrivateKey_asBytes :: LegacyDaedalusPrivateKey -> ByteArray +foreign import legacyDaedalusPrivateKey_chaincode :: LegacyDaedalusPrivateKey -> ByteArray + +instance IsCsl LegacyDaedalusPrivateKey where + className _ = "LegacyDaedalusPrivateKey" + +------------------------------------------------------------------------------------- +-- Linear fee + +foreign import data LinearFee :: Type + +foreign import linearFee_constant :: LinearFee -> BigNum +foreign import linearFee_coefficient :: LinearFee -> BigNum +foreign import linearFee_new :: BigNum -> BigNum -> LinearFee + +instance IsCsl LinearFee where + className _ = "LinearFee" + +------------------------------------------------------------------------------------- +-- MIRTo stake credentials + +foreign import data MIRToStakeCredentials :: Type + +foreign import mirToStakeCredentials_new :: Effect MIRToStakeCredentials + +instance IsCsl MIRToStakeCredentials where + className _ = "MIRToStakeCredentials" +instance IsBytes MIRToStakeCredentials +instance IsJson MIRToStakeCredentials +instance EncodeAeson MIRToStakeCredentials where encodeAeson = cslToAeson +instance DecodeAeson MIRToStakeCredentials where decodeAeson = cslFromAeson +instance Show MIRToStakeCredentials where show = showViaJson + +instance IsMapContainer MIRToStakeCredentials StakeCredential Int + +------------------------------------------------------------------------------------- +-- Metadata list + +foreign import data MetadataList :: Type + +foreign import metadataList_new :: Effect MetadataList + +instance IsCsl MetadataList where + className _ = "MetadataList" +instance IsBytes MetadataList +instance EncodeAeson MetadataList where encodeAeson = cslToAesonViaBytes +instance DecodeAeson MetadataList where decodeAeson = cslFromAesonViaBytes +instance Show MetadataList where show = showViaBytes + +instance IsListContainer MetadataList TransactionMetadatum + +------------------------------------------------------------------------------------- +-- Metadata map + +foreign import data MetadataMap :: Type + +foreign import metadataMap_new :: Effect MetadataMap +foreign import metadataMap_insertStr :: MetadataMap -> String -> TransactionMetadatum -> Effect ((Nullable TransactionMetadatum)) +foreign import metadataMap_insertI32 :: MetadataMap -> Number -> TransactionMetadatum -> Effect ((Nullable TransactionMetadatum)) +foreign import metadataMap_getStr :: MetadataMap -> String -> Effect TransactionMetadatum +foreign import metadataMap_getI32 :: MetadataMap -> Number -> Effect TransactionMetadatum +foreign import metadataMap_has :: MetadataMap -> TransactionMetadatum -> Effect Boolean + +instance IsCsl MetadataMap where + className _ = "MetadataMap" +instance IsBytes MetadataMap +instance EncodeAeson MetadataMap where encodeAeson = cslToAesonViaBytes +instance DecodeAeson MetadataMap where decodeAeson = cslFromAesonViaBytes +instance Show MetadataMap where show = showViaBytes + +instance IsMapContainer MetadataMap TransactionMetadatum TransactionMetadatum + +------------------------------------------------------------------------------------- +-- Mint + +foreign import data Mint :: Type + +foreign import mint_new :: Effect Mint +foreign import mint_newFromEntry :: ScriptHash -> MintAssets -> Effect Mint +foreign import mint_getAll :: Mint -> ScriptHash -> Nullable MintsAssets +foreign import mint_asPositiveMultiasset :: Mint -> Effect MultiAsset +foreign import mint_asNegativeMultiasset :: Mint -> Effect MultiAsset + +instance IsCsl Mint where + className _ = "Mint" +instance IsBytes Mint +instance IsJson Mint +instance EncodeAeson Mint where encodeAeson = cslToAeson +instance DecodeAeson Mint where decodeAeson = cslFromAeson +instance Show Mint where show = showViaJson + +instance IsMapContainer Mint ScriptHash MintAssets + +------------------------------------------------------------------------------------- +-- Mint assets + +foreign import data MintAssets :: Type + +foreign import mintAssets_new :: Effect MintAssets +foreign import mintAssets_newFromEntry :: AssetName -> Int -> MintAssets + +instance IsCsl MintAssets where + className _ = "MintAssets" + +instance IsMapContainer MintAssets AssetName Int + +------------------------------------------------------------------------------------- +-- Mint witness + +foreign import data MintWitness :: Type + +foreign import mintWitness_newNativeScript :: NativeScript -> MintWitness +foreign import mintWitness_newPlutusScript :: PlutusScriptSource -> Redeemer -> MintWitness + +instance IsCsl MintWitness where + className _ = "MintWitness" + +------------------------------------------------------------------------------------- +-- Mints assets + +foreign import data MintsAssets :: Type + + + +instance IsCsl MintsAssets where + className _ = "MintsAssets" + +------------------------------------------------------------------------------------- +-- Move instantaneous reward + +foreign import data MoveInstantaneousReward :: Type + +foreign import moveInstantaneousReward_newToOtherPot :: Number -> BigNum -> MoveInstantaneousReward +foreign import moveInstantaneousReward_newToStakeCreds :: Number -> MIRToStakeCredentials -> MoveInstantaneousReward +foreign import moveInstantaneousReward_pot :: MoveInstantaneousReward -> Number +foreign import moveInstantaneousReward_kind :: MoveInstantaneousReward -> Number +foreign import moveInstantaneousReward_asToOtherPot :: MoveInstantaneousReward -> Nullable BigNum +foreign import moveInstantaneousReward_asToStakeCreds :: MoveInstantaneousReward -> Nullable MIRToStakeCredentials + +instance IsCsl MoveInstantaneousReward where + className _ = "MoveInstantaneousReward" +instance IsBytes MoveInstantaneousReward +instance IsJson MoveInstantaneousReward +instance EncodeAeson MoveInstantaneousReward where encodeAeson = cslToAeson +instance DecodeAeson MoveInstantaneousReward where decodeAeson = cslFromAeson +instance Show MoveInstantaneousReward where show = showViaJson + +------------------------------------------------------------------------------------- +-- Move instantaneous rewards cert + +foreign import data MoveInstantaneousRewardsCert :: Type + +foreign import moveInstantaneousRewardsCert_moveInstantaneousReward :: MoveInstantaneousRewardsCert -> MoveInstantaneousReward +foreign import moveInstantaneousRewardsCert_new :: MoveInstantaneousReward -> MoveInstantaneousRewardsCert + +instance IsCsl MoveInstantaneousRewardsCert where + className _ = "MoveInstantaneousRewardsCert" +instance IsBytes MoveInstantaneousRewardsCert +instance IsJson MoveInstantaneousRewardsCert +instance EncodeAeson MoveInstantaneousRewardsCert where encodeAeson = cslToAeson +instance DecodeAeson MoveInstantaneousRewardsCert where decodeAeson = cslFromAeson +instance Show MoveInstantaneousRewardsCert where show = showViaJson + +------------------------------------------------------------------------------------- +-- Multi asset + +foreign import data MultiAsset :: Type + +foreign import multiAsset_new :: Effect MultiAsset +foreign import multiAsset_setAsset :: MultiAsset -> ScriptHash -> AssetName -> BigNum -> Effect ((Nullable BigNum)) +foreign import multiAsset_getAsset :: MultiAsset -> ScriptHash -> AssetName -> Effect BigNum +foreign import multiAsset_sub :: MultiAsset -> MultiAsset -> Effect MultiAsset + +instance IsCsl MultiAsset where + className _ = "MultiAsset" +instance IsBytes MultiAsset +instance IsJson MultiAsset +instance EncodeAeson MultiAsset where encodeAeson = cslToAeson +instance DecodeAeson MultiAsset where decodeAeson = cslFromAeson +instance Show MultiAsset where show = showViaJson + +instance IsMapContainer MultiAsset ScriptHash Assets + +------------------------------------------------------------------------------------- +-- Multi host name + +foreign import data MultiHostName :: Type + +foreign import multiHostName_dnsName :: MultiHostName -> DNSRecordSRV +foreign import multiHostName_new :: DNSRecordSRV -> MultiHostName + +instance IsCsl MultiHostName where + className _ = "MultiHostName" +instance IsBytes MultiHostName +instance IsJson MultiHostName +instance EncodeAeson MultiHostName where encodeAeson = cslToAeson +instance DecodeAeson MultiHostName where decodeAeson = cslFromAeson +instance Show MultiHostName where show = showViaJson + +------------------------------------------------------------------------------------- +-- Native script + +foreign import data NativeScript :: Type + +foreign import nativeScript_hash :: NativeScript -> ScriptHash +foreign import nativeScript_newScriptPubkey :: ScriptPubkey -> NativeScript +foreign import nativeScript_newScriptAll :: ScriptAll -> NativeScript +foreign import nativeScript_newScriptAny :: ScriptAny -> NativeScript +foreign import nativeScript_newScriptNOfK :: ScriptNOfK -> NativeScript +foreign import nativeScript_newTimelockStart :: TimelockStart -> NativeScript +foreign import nativeScript_newTimelockExpiry :: TimelockExpiry -> NativeScript +foreign import nativeScript_kind :: NativeScript -> Number +foreign import nativeScript_asScriptPubkey :: NativeScript -> Nullable ScriptPubkey +foreign import nativeScript_asScriptAll :: NativeScript -> Nullable ScriptAll +foreign import nativeScript_asScriptAny :: NativeScript -> Nullable ScriptAny +foreign import nativeScript_asScriptNOfK :: NativeScript -> Nullable ScriptNOfK +foreign import nativeScript_asTimelockStart :: NativeScript -> Nullable TimelockStart +foreign import nativeScript_asTimelockExpiry :: NativeScript -> Nullable TimelockExpiry +foreign import nativeScript_getRequiredSigners :: NativeScript -> Ed25519KeyHashes + +instance IsCsl NativeScript where + className _ = "NativeScript" +instance IsBytes NativeScript +instance IsJson NativeScript +instance EncodeAeson NativeScript where encodeAeson = cslToAeson +instance DecodeAeson NativeScript where decodeAeson = cslFromAeson +instance Show NativeScript where show = showViaJson + +------------------------------------------------------------------------------------- +-- Native scripts + +foreign import data NativeScripts :: Type + +foreign import nativeScripts_new :: Effect NativeScripts + +instance IsCsl NativeScripts where + className _ = "NativeScripts" + +instance IsListContainer NativeScripts NativeScript + +------------------------------------------------------------------------------------- +-- Network id + +foreign import data NetworkId :: Type + +foreign import networkId_testnet :: NetworkId +foreign import networkId_mainnet :: NetworkId +foreign import networkId_kind :: NetworkId -> Number + +instance IsCsl NetworkId where + className _ = "NetworkId" +instance IsBytes NetworkId +instance IsJson NetworkId +instance EncodeAeson NetworkId where encodeAeson = cslToAeson +instance DecodeAeson NetworkId where decodeAeson = cslFromAeson +instance Show NetworkId where show = showViaJson + +------------------------------------------------------------------------------------- +-- Network info + +foreign import data NetworkInfo :: Type + +foreign import networkInfo_new :: Number -> Number -> NetworkInfo +foreign import networkInfo_networkId :: NetworkInfo -> Number +foreign import networkInfo_protocolMagic :: NetworkInfo -> Number +foreign import networkInfo_testnetPreview :: NetworkInfo +foreign import networkInfo_testnetPreprod :: NetworkInfo +foreign import networkInfo_testnet :: NetworkInfo +foreign import networkInfo_mainnet :: NetworkInfo + +instance IsCsl NetworkInfo where + className _ = "NetworkInfo" + +------------------------------------------------------------------------------------- +-- Nonce + +foreign import data Nonce :: Type + +foreign import nonce_newIdentity :: Nonce +foreign import nonce_newFromHash :: ByteArray -> Nonce +foreign import nonce_getHash :: Nonce -> Nullable ByteArray + +instance IsCsl Nonce where + className _ = "Nonce" +instance IsBytes Nonce +instance IsJson Nonce +instance EncodeAeson Nonce where encodeAeson = cslToAeson +instance DecodeAeson Nonce where decodeAeson = cslFromAeson +instance Show Nonce where show = showViaJson + +------------------------------------------------------------------------------------- +-- Operational cert + +foreign import data OperationalCert :: Type + +foreign import operationalCert_hotVkey :: OperationalCert -> KESVKey +foreign import operationalCert_sequenceNumber :: OperationalCert -> Number +foreign import operationalCert_kesPeriod :: OperationalCert -> Number +foreign import operationalCert_sigma :: OperationalCert -> Ed25519Signature +foreign import operationalCert_new :: KESVKey -> Number -> Number -> Ed25519Signature -> OperationalCert + +instance IsCsl OperationalCert where + className _ = "OperationalCert" +instance IsBytes OperationalCert +instance IsJson OperationalCert +instance EncodeAeson OperationalCert where encodeAeson = cslToAeson +instance DecodeAeson OperationalCert where decodeAeson = cslFromAeson +instance Show OperationalCert where show = showViaJson + +------------------------------------------------------------------------------------- +-- Output datum + +foreign import data OutputDatum :: Type + +foreign import outputDatum_newDataHash :: DataHash -> OutputDatum +foreign import outputDatum_newData :: PlutusData -> OutputDatum +foreign import outputDatum_dataHash :: OutputDatum -> Nullable DataHash +foreign import outputDatum_data :: OutputDatum -> Nullable PlutusData + +instance IsCsl OutputDatum where + className _ = "OutputDatum" + +------------------------------------------------------------------------------------- +-- Plutus data + +foreign import data PlutusData :: Type + +foreign import plutusData_newConstrPlutusData :: ConstrPlutusData -> PlutusData +foreign import plutusData_newEmptyConstrPlutusData :: BigNum -> PlutusData +foreign import plutusData_newSingleValueConstrPlutusData :: BigNum -> PlutusData -> PlutusData +foreign import plutusData_newMap :: PlutusMap -> PlutusData +foreign import plutusData_newList :: PlutusList -> PlutusData +foreign import plutusData_newInteger :: BigInt -> PlutusData +foreign import plutusData_newBytes :: ByteArray -> PlutusData +foreign import plutusData_kind :: PlutusData -> Number +foreign import plutusData_asConstrPlutusData :: PlutusData -> Nullable ConstrPlutusData +foreign import plutusData_asMap :: PlutusData -> Nullable PlutusMap +foreign import plutusData_asList :: PlutusData -> Nullable PlutusList +foreign import plutusData_asInteger :: PlutusData -> Nullable BigInt +foreign import plutusData_asBytes :: PlutusData -> Nullable ByteArray +foreign import plutusData_fromAddress :: Address -> PlutusData + +instance IsCsl PlutusData where + className _ = "PlutusData" +instance IsBytes PlutusData +instance IsJson PlutusData +instance EncodeAeson PlutusData where encodeAeson = cslToAeson +instance DecodeAeson PlutusData where decodeAeson = cslFromAeson +instance Show PlutusData where show = showViaJson + +------------------------------------------------------------------------------------- +-- Plutus list + +foreign import data PlutusList :: Type + +foreign import plutusList_new :: Effect PlutusList + +instance IsCsl PlutusList where + className _ = "PlutusList" +instance IsBytes PlutusList +instance EncodeAeson PlutusList where encodeAeson = cslToAesonViaBytes +instance DecodeAeson PlutusList where decodeAeson = cslFromAesonViaBytes +instance Show PlutusList where show = showViaBytes + +instance IsListContainer PlutusList PlutusData + +------------------------------------------------------------------------------------- +-- Plutus map + +foreign import data PlutusMap :: Type + +foreign import plutusMap_new :: Effect PlutusMap + +instance IsCsl PlutusMap where + className _ = "PlutusMap" +instance IsBytes PlutusMap +instance EncodeAeson PlutusMap where encodeAeson = cslToAesonViaBytes +instance DecodeAeson PlutusMap where decodeAeson = cslFromAesonViaBytes +instance Show PlutusMap where show = showViaBytes + +instance IsMapContainer PlutusMap PlutusData PlutusData + +------------------------------------------------------------------------------------- +-- Plutus script + +foreign import data PlutusScript :: Type + +foreign import plutusScript_new :: ByteArray -> PlutusScript +foreign import plutusScript_newV2 :: ByteArray -> PlutusScript +foreign import plutusScript_newWithVersion :: ByteArray -> Language -> PlutusScript +foreign import plutusScript_bytes :: PlutusScript -> ByteArray +foreign import plutusScript_fromBytesV2 :: ByteArray -> PlutusScript +foreign import plutusScript_fromBytesWithVersion :: ByteArray -> Language -> PlutusScript +foreign import plutusScript_fromHexWithVersion :: String -> Language -> PlutusScript +foreign import plutusScript_hash :: PlutusScript -> ScriptHash +foreign import plutusScript_languageVersion :: PlutusScript -> Language + +instance IsCsl PlutusScript where + className _ = "PlutusScript" +instance IsBytes PlutusScript +instance EncodeAeson PlutusScript where encodeAeson = cslToAesonViaBytes +instance DecodeAeson PlutusScript where decodeAeson = cslFromAesonViaBytes +instance Show PlutusScript where show = showViaBytes + +------------------------------------------------------------------------------------- +-- Plutus script source + +foreign import data PlutusScriptSource :: Type + +foreign import plutusScriptSource_new :: PlutusScript -> PlutusScriptSource +foreign import plutusScriptSource_newRefInput :: ScriptHash -> TransactionInput -> PlutusScriptSource +foreign import plutusScriptSource_newRefInputWithLangVer :: ScriptHash -> TransactionInput -> Language -> PlutusScriptSource + +instance IsCsl PlutusScriptSource where + className _ = "PlutusScriptSource" + +------------------------------------------------------------------------------------- +-- Plutus scripts + +foreign import data PlutusScripts :: Type + +foreign import plutusScripts_new :: Effect PlutusScripts + +instance IsCsl PlutusScripts where + className _ = "PlutusScripts" +instance IsBytes PlutusScripts +instance IsJson PlutusScripts +instance EncodeAeson PlutusScripts where encodeAeson = cslToAeson +instance DecodeAeson PlutusScripts where decodeAeson = cslFromAeson +instance Show PlutusScripts where show = showViaJson + +instance IsListContainer PlutusScripts PlutusScript + +------------------------------------------------------------------------------------- +-- Plutus witness + +foreign import data PlutusWitness :: Type + +foreign import plutusWitness_new :: PlutusScript -> PlutusData -> Redeemer -> PlutusWitness +foreign import plutusWitness_newWithRef :: PlutusScriptSource -> DatumSource -> Redeemer -> PlutusWitness +foreign import plutusWitness_newWithoutDatum :: PlutusScript -> Redeemer -> PlutusWitness +foreign import plutusWitness_newWithRefWithoutDatum :: PlutusScriptSource -> Redeemer -> PlutusWitness +foreign import plutusWitness_script :: PlutusWitness -> Nullable PlutusScript +foreign import plutusWitness_datum :: PlutusWitness -> Nullable PlutusData +foreign import plutusWitness_redeemer :: PlutusWitness -> Redeemer + +instance IsCsl PlutusWitness where + className _ = "PlutusWitness" + +------------------------------------------------------------------------------------- +-- Plutus witnesses + +foreign import data PlutusWitnesses :: Type + +foreign import plutusWitnesses_new :: Effect PlutusWitnesses + +instance IsCsl PlutusWitnesses where + className _ = "PlutusWitnesses" + +instance IsListContainer PlutusWitnesses PlutusWitness + +------------------------------------------------------------------------------------- +-- Pointer + +foreign import data Pointer :: Type + +foreign import pointer_new :: Number -> Number -> Number -> Pointer +foreign import pointer_newPointer :: BigNum -> BigNum -> BigNum -> Pointer +foreign import pointer_slot :: Pointer -> Number +foreign import pointer_txIndex :: Pointer -> Number +foreign import pointer_certIndex :: Pointer -> Number +foreign import pointer_slotBignum :: Pointer -> BigNum +foreign import pointer_txIndexBignum :: Pointer -> BigNum +foreign import pointer_certIndexBignum :: Pointer -> BigNum + +instance IsCsl Pointer where + className _ = "Pointer" + +------------------------------------------------------------------------------------- +-- Pointer address + +foreign import data PointerAddress :: Type + +foreign import pointerAddress_new :: Number -> StakeCredential -> Pointer -> PointerAddress +foreign import pointerAddress_paymentCred :: PointerAddress -> StakeCredential +foreign import pointerAddress_stakePointer :: PointerAddress -> Pointer +foreign import pointerAddress_toAddress :: PointerAddress -> Address +foreign import pointerAddress_fromAddress :: Address -> Nullable PointerAddress + +instance IsCsl PointerAddress where + className _ = "PointerAddress" + +------------------------------------------------------------------------------------- +-- Pool metadata + +foreign import data PoolMetadata :: Type + +foreign import poolMetadata_url :: PoolMetadata -> URL +foreign import poolMetadata_poolMetadataHash :: PoolMetadata -> PoolMetadataHash +foreign import poolMetadata_new :: URL -> PoolMetadataHash -> PoolMetadata + +instance IsCsl PoolMetadata where + className _ = "PoolMetadata" +instance IsBytes PoolMetadata +instance IsJson PoolMetadata +instance EncodeAeson PoolMetadata where encodeAeson = cslToAeson +instance DecodeAeson PoolMetadata where decodeAeson = cslFromAeson +instance Show PoolMetadata where show = showViaJson + +------------------------------------------------------------------------------------- +-- Pool metadata hash + +foreign import data PoolMetadataHash :: Type + +foreign import poolMetadataHash_toBech32 :: PoolMetadataHash -> String -> String +foreign import poolMetadataHash_fromBech32 :: String -> Nullable PoolMetadataHash + +instance IsCsl PoolMetadataHash where + className _ = "PoolMetadataHash" +instance IsBytes PoolMetadataHash +instance EncodeAeson PoolMetadataHash where encodeAeson = cslToAesonViaBytes +instance DecodeAeson PoolMetadataHash where decodeAeson = cslFromAesonViaBytes +instance Show PoolMetadataHash where show = showViaBytes + +------------------------------------------------------------------------------------- +-- Pool params + +foreign import data PoolParams :: Type + +foreign import poolParams_operator :: PoolParams -> Ed25519KeyHash +foreign import poolParams_vrfKeyhash :: PoolParams -> VRFKeyHash +foreign import poolParams_pledge :: PoolParams -> BigNum +foreign import poolParams_cost :: PoolParams -> BigNum +foreign import poolParams_margin :: PoolParams -> UnitInterval +foreign import poolParams_rewardAccount :: PoolParams -> RewardAddress +foreign import poolParams_poolOwners :: PoolParams -> Ed25519KeyHashes +foreign import poolParams_relays :: PoolParams -> Relays +foreign import poolParams_poolMetadata :: PoolParams -> Nullable PoolMetadata +foreign import poolParams_new :: Ed25519KeyHash -> VRFKeyHash -> BigNum -> BigNum -> UnitInterval -> RewardAddress -> Ed25519KeyHashes -> Relays -> PoolMetadata -> PoolParams + +instance IsCsl PoolParams where + className _ = "PoolParams" +instance IsBytes PoolParams +instance IsJson PoolParams +instance EncodeAeson PoolParams where encodeAeson = cslToAeson +instance DecodeAeson PoolParams where decodeAeson = cslFromAeson +instance Show PoolParams where show = showViaJson + +------------------------------------------------------------------------------------- +-- Pool registration + +foreign import data PoolRegistration :: Type + +foreign import poolRegistration_poolParams :: PoolRegistration -> PoolParams +foreign import poolRegistration_new :: PoolParams -> PoolRegistration + +instance IsCsl PoolRegistration where + className _ = "PoolRegistration" +instance IsBytes PoolRegistration +instance IsJson PoolRegistration +instance EncodeAeson PoolRegistration where encodeAeson = cslToAeson +instance DecodeAeson PoolRegistration where decodeAeson = cslFromAeson +instance Show PoolRegistration where show = showViaJson + +------------------------------------------------------------------------------------- +-- Pool retirement + +foreign import data PoolRetirement :: Type + +foreign import poolRetirement_poolKeyhash :: PoolRetirement -> Ed25519KeyHash +foreign import poolRetirement_epoch :: PoolRetirement -> Number +foreign import poolRetirement_new :: Ed25519KeyHash -> Number -> PoolRetirement + +instance IsCsl PoolRetirement where + className _ = "PoolRetirement" +instance IsBytes PoolRetirement +instance IsJson PoolRetirement +instance EncodeAeson PoolRetirement where encodeAeson = cslToAeson +instance DecodeAeson PoolRetirement where decodeAeson = cslFromAeson +instance Show PoolRetirement where show = showViaJson + +------------------------------------------------------------------------------------- +-- Private key + +foreign import data PrivateKey :: Type + +foreign import privateKey_free :: PrivateKey -> Nullable Unit +foreign import privateKey_toPublic :: PrivateKey -> PublicKey +foreign import privateKey_generateEd25519 :: PrivateKey +foreign import privateKey_generateEd25519extended :: PrivateKey +foreign import privateKey_fromBech32 :: String -> Nullable PrivateKey +foreign import privateKey_toBech32 :: PrivateKey -> String +foreign import privateKey_asBytes :: PrivateKey -> ByteArray +foreign import privateKey_fromExtendedBytes :: ByteArray -> Nullable PrivateKey +foreign import privateKey_fromNormalBytes :: ByteArray -> Nullable PrivateKey +foreign import privateKey_sign :: PrivateKey -> ByteArray -> Ed25519Signature +foreign import privateKey_toHex :: PrivateKey -> String +foreign import privateKey_fromHex :: String -> Nullable PrivateKey + +instance IsCsl PrivateKey where + className _ = "PrivateKey" + +------------------------------------------------------------------------------------- +-- Proposed protocol parameter updates + +foreign import data ProposedProtocolParameterUpdates :: Type + +foreign import proposedProtocolParameterUpdates_new :: Effect ProposedProtocolParameterUpdates + +instance IsCsl ProposedProtocolParameterUpdates where + className _ = "ProposedProtocolParameterUpdates" +instance IsBytes ProposedProtocolParameterUpdates +instance IsJson ProposedProtocolParameterUpdates +instance EncodeAeson ProposedProtocolParameterUpdates where encodeAeson = cslToAeson +instance DecodeAeson ProposedProtocolParameterUpdates where decodeAeson = cslFromAeson +instance Show ProposedProtocolParameterUpdates where show = showViaJson + +instance IsMapContainer ProposedProtocolParameterUpdates GenesisHash ProtocolParamUpdate + +------------------------------------------------------------------------------------- +-- Protocol param update + +foreign import data ProtocolParamUpdate :: Type + +foreign import protocolParamUpdate_setMinfeeA :: ProtocolParamUpdate -> BigNum -> Nullable Unit +foreign import protocolParamUpdate_minfeeA :: ProtocolParamUpdate -> Nullable BigNum +foreign import protocolParamUpdate_setMinfeeB :: ProtocolParamUpdate -> BigNum -> Nullable Unit +foreign import protocolParamUpdate_minfeeB :: ProtocolParamUpdate -> Nullable BigNum +foreign import protocolParamUpdate_setMaxBlockBodySize :: ProtocolParamUpdate -> Number -> Nullable Unit +foreign import protocolParamUpdate_maxBlockBodySize :: ProtocolParamUpdate -> Nullable Number +foreign import protocolParamUpdate_setMaxTxSize :: ProtocolParamUpdate -> Number -> Nullable Unit +foreign import protocolParamUpdate_maxTxSize :: ProtocolParamUpdate -> Nullable Number +foreign import protocolParamUpdate_setMaxBlockHeaderSize :: ProtocolParamUpdate -> Number -> Nullable Unit +foreign import protocolParamUpdate_maxBlockHeaderSize :: ProtocolParamUpdate -> Nullable Number +foreign import protocolParamUpdate_setKeyDeposit :: ProtocolParamUpdate -> BigNum -> Nullable Unit +foreign import protocolParamUpdate_keyDeposit :: ProtocolParamUpdate -> Nullable BigNum +foreign import protocolParamUpdate_setPoolDeposit :: ProtocolParamUpdate -> BigNum -> Nullable Unit +foreign import protocolParamUpdate_poolDeposit :: ProtocolParamUpdate -> Nullable BigNum +foreign import protocolParamUpdate_setMaxEpoch :: ProtocolParamUpdate -> Number -> Nullable Unit +foreign import protocolParamUpdate_maxEpoch :: ProtocolParamUpdate -> Nullable Number +foreign import protocolParamUpdate_setNOpt :: ProtocolParamUpdate -> Number -> Nullable Unit +foreign import protocolParamUpdate_nOpt :: ProtocolParamUpdate -> Nullable Number +foreign import protocolParamUpdate_setPoolPledgeInfluence :: ProtocolParamUpdate -> UnitInterval -> Nullable Unit +foreign import protocolParamUpdate_poolPledgeInfluence :: ProtocolParamUpdate -> Nullable UnitInterval +foreign import protocolParamUpdate_setExpansionRate :: ProtocolParamUpdate -> UnitInterval -> Nullable Unit +foreign import protocolParamUpdate_expansionRate :: ProtocolParamUpdate -> Nullable UnitInterval +foreign import protocolParamUpdate_setTreasuryGrowthRate :: ProtocolParamUpdate -> UnitInterval -> Nullable Unit +foreign import protocolParamUpdate_treasuryGrowthRate :: ProtocolParamUpdate -> Nullable UnitInterval +foreign import protocolParamUpdate_d :: ProtocolParamUpdate -> Nullable UnitInterval +foreign import protocolParamUpdate_extraEntropy :: ProtocolParamUpdate -> Nullable Nonce +foreign import protocolParamUpdate_setProtocolVersion :: ProtocolParamUpdate -> ProtocolVersion -> Nullable Unit +foreign import protocolParamUpdate_protocolVersion :: ProtocolParamUpdate -> Nullable ProtocolVersion +foreign import protocolParamUpdate_setMinPoolCost :: ProtocolParamUpdate -> BigNum -> Nullable Unit +foreign import protocolParamUpdate_minPoolCost :: ProtocolParamUpdate -> Nullable BigNum +foreign import protocolParamUpdate_setAdaPerUtxoByte :: ProtocolParamUpdate -> BigNum -> Nullable Unit +foreign import protocolParamUpdate_adaPerUtxoByte :: ProtocolParamUpdate -> Nullable BigNum +foreign import protocolParamUpdate_setCostModels :: ProtocolParamUpdate -> Costmdls -> Nullable Unit +foreign import protocolParamUpdate_costModels :: ProtocolParamUpdate -> Nullable Costmdls +foreign import protocolParamUpdate_setExecutionCosts :: ProtocolParamUpdate -> ExUnitPrices -> Nullable Unit +foreign import protocolParamUpdate_executionCosts :: ProtocolParamUpdate -> Nullable ExUnitPrices +foreign import protocolParamUpdate_setMaxTxExUnits :: ProtocolParamUpdate -> ExUnits -> Nullable Unit +foreign import protocolParamUpdate_maxTxExUnits :: ProtocolParamUpdate -> Nullable ExUnits +foreign import protocolParamUpdate_setMaxBlockExUnits :: ProtocolParamUpdate -> ExUnits -> Nullable Unit +foreign import protocolParamUpdate_maxBlockExUnits :: ProtocolParamUpdate -> Nullable ExUnits +foreign import protocolParamUpdate_setMaxValueSize :: ProtocolParamUpdate -> Number -> Nullable Unit +foreign import protocolParamUpdate_maxValueSize :: ProtocolParamUpdate -> Nullable Number +foreign import protocolParamUpdate_setCollateralPercentage :: ProtocolParamUpdate -> Number -> Nullable Unit +foreign import protocolParamUpdate_collateralPercentage :: ProtocolParamUpdate -> Nullable Number +foreign import protocolParamUpdate_setMaxCollateralInputs :: ProtocolParamUpdate -> Number -> Nullable Unit +foreign import protocolParamUpdate_maxCollateralInputs :: ProtocolParamUpdate -> Nullable Number +foreign import protocolParamUpdate_new :: ProtocolParamUpdate + +instance IsCsl ProtocolParamUpdate where + className _ = "ProtocolParamUpdate" +instance IsBytes ProtocolParamUpdate +instance IsJson ProtocolParamUpdate +instance EncodeAeson ProtocolParamUpdate where encodeAeson = cslToAeson +instance DecodeAeson ProtocolParamUpdate where decodeAeson = cslFromAeson +instance Show ProtocolParamUpdate where show = showViaJson + +------------------------------------------------------------------------------------- +-- Protocol version + +foreign import data ProtocolVersion :: Type + +foreign import protocolVersion_major :: ProtocolVersion -> Number +foreign import protocolVersion_minor :: ProtocolVersion -> Number +foreign import protocolVersion_new :: Number -> Number -> ProtocolVersion + +instance IsCsl ProtocolVersion where + className _ = "ProtocolVersion" +instance IsBytes ProtocolVersion +instance IsJson ProtocolVersion +instance EncodeAeson ProtocolVersion where encodeAeson = cslToAeson +instance DecodeAeson ProtocolVersion where decodeAeson = cslFromAeson +instance Show ProtocolVersion where show = showViaJson + +------------------------------------------------------------------------------------- +-- Public key + +foreign import data PublicKey :: Type + +foreign import publicKey_free :: PublicKey -> Nullable Unit +foreign import publicKey_fromBech32 :: String -> Nullable PublicKey +foreign import publicKey_toBech32 :: PublicKey -> String +foreign import publicKey_asBytes :: PublicKey -> ByteArray +foreign import publicKey_fromBytes :: ByteArray -> Nullable PublicKey +foreign import publicKey_verify :: PublicKey -> ByteArray -> Ed25519Signature -> Boolean +foreign import publicKey_hash :: PublicKey -> Ed25519KeyHash +foreign import publicKey_toHex :: PublicKey -> String +foreign import publicKey_fromHex :: String -> Nullable PublicKey + +instance IsCsl PublicKey where + className _ = "PublicKey" + +------------------------------------------------------------------------------------- +-- Redeemer + +foreign import data Redeemer :: Type + +foreign import redeemer_tag :: Redeemer -> RedeemerTag +foreign import redeemer_index :: Redeemer -> BigNum +foreign import redeemer_data :: Redeemer -> PlutusData +foreign import redeemer_exUnits :: Redeemer -> ExUnits +foreign import redeemer_new :: RedeemerTag -> BigNum -> PlutusData -> ExUnits -> Redeemer + +instance IsCsl Redeemer where + className _ = "Redeemer" +instance IsBytes Redeemer +instance IsJson Redeemer +instance EncodeAeson Redeemer where encodeAeson = cslToAeson +instance DecodeAeson Redeemer where decodeAeson = cslFromAeson +instance Show Redeemer where show = showViaJson + +------------------------------------------------------------------------------------- +-- Redeemer tag + +foreign import data RedeemerTag :: Type + +foreign import redeemerTag_newSpend :: RedeemerTag +foreign import redeemerTag_newMint :: RedeemerTag +foreign import redeemerTag_newCert :: RedeemerTag +foreign import redeemerTag_newReward :: RedeemerTag +foreign import redeemerTag_kind :: RedeemerTag -> Number + +instance IsCsl RedeemerTag where + className _ = "RedeemerTag" +instance IsBytes RedeemerTag +instance IsJson RedeemerTag +instance EncodeAeson RedeemerTag where encodeAeson = cslToAeson +instance DecodeAeson RedeemerTag where decodeAeson = cslFromAeson +instance Show RedeemerTag where show = showViaJson + +------------------------------------------------------------------------------------- +-- Redeemers + +foreign import data Redeemers :: Type + +foreign import redeemers_new :: Effect Redeemers +foreign import redeemers_totalExUnits :: Redeemers -> ExUnits + +instance IsCsl Redeemers where + className _ = "Redeemers" +instance IsBytes Redeemers +instance IsJson Redeemers +instance EncodeAeson Redeemers where encodeAeson = cslToAeson +instance DecodeAeson Redeemers where decodeAeson = cslFromAeson +instance Show Redeemers where show = showViaJson + +instance IsListContainer Redeemers Redeemer + +------------------------------------------------------------------------------------- +-- Relay + +foreign import data Relay :: Type + +foreign import relay_newSingleHostAddr :: SingleHostAddr -> Relay +foreign import relay_newSingleHostName :: SingleHostName -> Relay +foreign import relay_newMultiHostName :: MultiHostName -> Relay +foreign import relay_kind :: Relay -> Number +foreign import relay_asSingleHostAddr :: Relay -> Nullable SingleHostAddr +foreign import relay_asSingleHostName :: Relay -> Nullable SingleHostName +foreign import relay_asMultiHostName :: Relay -> Nullable MultiHostName + +instance IsCsl Relay where + className _ = "Relay" +instance IsBytes Relay +instance IsJson Relay +instance EncodeAeson Relay where encodeAeson = cslToAeson +instance DecodeAeson Relay where decodeAeson = cslFromAeson +instance Show Relay where show = showViaJson + +------------------------------------------------------------------------------------- +-- Relays + +foreign import data Relays :: Type + +foreign import relays_new :: Effect Relays + +instance IsCsl Relays where + className _ = "Relays" +instance IsBytes Relays +instance IsJson Relays +instance EncodeAeson Relays where encodeAeson = cslToAeson +instance DecodeAeson Relays where decodeAeson = cslFromAeson +instance Show Relays where show = showViaJson + +instance IsListContainer Relays Relay + +------------------------------------------------------------------------------------- +-- Reward address + +foreign import data RewardAddress :: Type + +foreign import rewardAddress_new :: Number -> StakeCredential -> RewardAddress +foreign import rewardAddress_paymentCred :: RewardAddress -> StakeCredential +foreign import rewardAddress_toAddress :: RewardAddress -> Address +foreign import rewardAddress_fromAddress :: Address -> Nullable RewardAddress + +instance IsCsl RewardAddress where + className _ = "RewardAddress" + +------------------------------------------------------------------------------------- +-- Reward addresses + +foreign import data RewardAddresses :: Type + +foreign import rewardAddresses_new :: Effect RewardAddresses + +instance IsCsl RewardAddresses where + className _ = "RewardAddresses" +instance IsBytes RewardAddresses +instance IsJson RewardAddresses +instance EncodeAeson RewardAddresses where encodeAeson = cslToAeson +instance DecodeAeson RewardAddresses where decodeAeson = cslFromAeson +instance Show RewardAddresses where show = showViaJson + +instance IsListContainer RewardAddresses RewardAddress + +------------------------------------------------------------------------------------- +-- Script all + +foreign import data ScriptAll :: Type + +foreign import scriptAll_nativeScripts :: ScriptAll -> NativeScripts +foreign import scriptAll_new :: NativeScripts -> ScriptAll + +instance IsCsl ScriptAll where + className _ = "ScriptAll" +instance IsBytes ScriptAll +instance IsJson ScriptAll +instance EncodeAeson ScriptAll where encodeAeson = cslToAeson +instance DecodeAeson ScriptAll where decodeAeson = cslFromAeson +instance Show ScriptAll where show = showViaJson + +------------------------------------------------------------------------------------- +-- Script any + +foreign import data ScriptAny :: Type + +foreign import scriptAny_nativeScripts :: ScriptAny -> NativeScripts +foreign import scriptAny_new :: NativeScripts -> ScriptAny + +instance IsCsl ScriptAny where + className _ = "ScriptAny" +instance IsBytes ScriptAny +instance IsJson ScriptAny +instance EncodeAeson ScriptAny where encodeAeson = cslToAeson +instance DecodeAeson ScriptAny where decodeAeson = cslFromAeson +instance Show ScriptAny where show = showViaJson + +------------------------------------------------------------------------------------- +-- Script data hash + +foreign import data ScriptDataHash :: Type + +foreign import scriptDataHash_toBech32 :: ScriptDataHash -> String -> String +foreign import scriptDataHash_fromBech32 :: String -> Nullable ScriptDataHash + +instance IsCsl ScriptDataHash where + className _ = "ScriptDataHash" +instance IsBytes ScriptDataHash +instance EncodeAeson ScriptDataHash where encodeAeson = cslToAesonViaBytes +instance DecodeAeson ScriptDataHash where decodeAeson = cslFromAesonViaBytes +instance Show ScriptDataHash where show = showViaBytes + +------------------------------------------------------------------------------------- +-- Script hash + +foreign import data ScriptHash :: Type + +foreign import scriptHash_toBech32 :: ScriptHash -> String -> String +foreign import scriptHash_fromBech32 :: String -> Nullable ScriptHash + +instance IsCsl ScriptHash where + className _ = "ScriptHash" +instance IsBytes ScriptHash +instance EncodeAeson ScriptHash where encodeAeson = cslToAesonViaBytes +instance DecodeAeson ScriptHash where decodeAeson = cslFromAesonViaBytes +instance Show ScriptHash where show = showViaBytes + +------------------------------------------------------------------------------------- +-- Script hashes + +foreign import data ScriptHashes :: Type + +foreign import scriptHashes_new :: Effect ScriptHashes + +instance IsCsl ScriptHashes where + className _ = "ScriptHashes" +instance IsBytes ScriptHashes +instance IsJson ScriptHashes +instance EncodeAeson ScriptHashes where encodeAeson = cslToAeson +instance DecodeAeson ScriptHashes where decodeAeson = cslFromAeson +instance Show ScriptHashes where show = showViaJson + +instance IsListContainer ScriptHashes ScriptHash + +------------------------------------------------------------------------------------- +-- Script nOf k + +foreign import data ScriptNOfK :: Type + +foreign import scriptNOfK_n :: ScriptNOfK -> Number +foreign import scriptNOfK_nativeScripts :: ScriptNOfK -> NativeScripts +foreign import scriptNOfK_new :: Number -> NativeScripts -> ScriptNOfK + +instance IsCsl ScriptNOfK where + className _ = "ScriptNOfK" +instance IsBytes ScriptNOfK +instance IsJson ScriptNOfK +instance EncodeAeson ScriptNOfK where encodeAeson = cslToAeson +instance DecodeAeson ScriptNOfK where decodeAeson = cslFromAeson +instance Show ScriptNOfK where show = showViaJson + +------------------------------------------------------------------------------------- +-- Script pubkey + +foreign import data ScriptPubkey :: Type + +foreign import scriptPubkey_addrKeyhash :: ScriptPubkey -> Ed25519KeyHash +foreign import scriptPubkey_new :: Ed25519KeyHash -> ScriptPubkey + +instance IsCsl ScriptPubkey where + className _ = "ScriptPubkey" +instance IsBytes ScriptPubkey +instance IsJson ScriptPubkey +instance EncodeAeson ScriptPubkey where encodeAeson = cslToAeson +instance DecodeAeson ScriptPubkey where decodeAeson = cslFromAeson +instance Show ScriptPubkey where show = showViaJson + +------------------------------------------------------------------------------------- +-- Script ref + +foreign import data ScriptRef :: Type + +foreign import scriptRef_newNativeScript :: NativeScript -> ScriptRef +foreign import scriptRef_newPlutusScript :: PlutusScript -> ScriptRef +foreign import scriptRef_isNativeScript :: ScriptRef -> Boolean +foreign import scriptRef_isPlutusScript :: ScriptRef -> Boolean +foreign import scriptRef_nativeScript :: ScriptRef -> Nullable NativeScript +foreign import scriptRef_plutusScript :: ScriptRef -> Nullable PlutusScript + +instance IsCsl ScriptRef where + className _ = "ScriptRef" +instance IsBytes ScriptRef +instance IsJson ScriptRef +instance EncodeAeson ScriptRef where encodeAeson = cslToAeson +instance DecodeAeson ScriptRef where decodeAeson = cslFromAeson +instance Show ScriptRef where show = showViaJson + +------------------------------------------------------------------------------------- +-- Single host addr + +foreign import data SingleHostAddr :: Type + +foreign import singleHostAddr_port :: SingleHostAddr -> Nullable Number +foreign import singleHostAddr_ipv4 :: SingleHostAddr -> Nullable Ipv4 +foreign import singleHostAddr_ipv6 :: SingleHostAddr -> Nullable Ipv6 +foreign import singleHostAddr_new :: Number -> Ipv4 -> Ipv6 -> SingleHostAddr + +instance IsCsl SingleHostAddr where + className _ = "SingleHostAddr" +instance IsBytes SingleHostAddr +instance IsJson SingleHostAddr +instance EncodeAeson SingleHostAddr where encodeAeson = cslToAeson +instance DecodeAeson SingleHostAddr where decodeAeson = cslFromAeson +instance Show SingleHostAddr where show = showViaJson + +------------------------------------------------------------------------------------- +-- Single host name + +foreign import data SingleHostName :: Type + +foreign import singleHostName_port :: SingleHostName -> Nullable Number +foreign import singleHostName_dnsName :: SingleHostName -> DNSRecordAorAAAA +foreign import singleHostName_new :: Nullable Number -> DNSRecordAorAAAA -> SingleHostName + +instance IsCsl SingleHostName where + className _ = "SingleHostName" +instance IsBytes SingleHostName +instance IsJson SingleHostName +instance EncodeAeson SingleHostName where encodeAeson = cslToAeson +instance DecodeAeson SingleHostName where decodeAeson = cslFromAeson +instance Show SingleHostName where show = showViaJson + +------------------------------------------------------------------------------------- +-- Stake credential + +foreign import data StakeCredential :: Type + +foreign import stakeCredential_fromKeyhash :: Ed25519KeyHash -> StakeCredential +foreign import stakeCredential_fromScripthash :: ScriptHash -> StakeCredential +foreign import stakeCredential_toKeyhash :: StakeCredential -> Nullable Ed25519KeyHash +foreign import stakeCredential_toScripthash :: StakeCredential -> Nullable ScriptHash +foreign import stakeCredential_kind :: StakeCredential -> Number + +instance IsCsl StakeCredential where + className _ = "StakeCredential" +instance IsBytes StakeCredential +instance IsJson StakeCredential +instance EncodeAeson StakeCredential where encodeAeson = cslToAeson +instance DecodeAeson StakeCredential where decodeAeson = cslFromAeson +instance Show StakeCredential where show = showViaJson + +------------------------------------------------------------------------------------- +-- Stake credentials + +foreign import data StakeCredentials :: Type + +foreign import stakeCredentials_new :: Effect StakeCredentials + +instance IsCsl StakeCredentials where + className _ = "StakeCredentials" +instance IsBytes StakeCredentials +instance IsJson StakeCredentials +instance EncodeAeson StakeCredentials where encodeAeson = cslToAeson +instance DecodeAeson StakeCredentials where decodeAeson = cslFromAeson +instance Show StakeCredentials where show = showViaJson + +instance IsListContainer StakeCredentials StakeCredential + +------------------------------------------------------------------------------------- +-- Stake delegation + +foreign import data StakeDelegation :: Type + +foreign import stakeDelegation_stakeCredential :: StakeDelegation -> StakeCredential +foreign import stakeDelegation_poolKeyhash :: StakeDelegation -> Ed25519KeyHash +foreign import stakeDelegation_new :: StakeCredential -> Ed25519KeyHash -> StakeDelegation + +instance IsCsl StakeDelegation where + className _ = "StakeDelegation" +instance IsBytes StakeDelegation +instance IsJson StakeDelegation +instance EncodeAeson StakeDelegation where encodeAeson = cslToAeson +instance DecodeAeson StakeDelegation where decodeAeson = cslFromAeson +instance Show StakeDelegation where show = showViaJson + +------------------------------------------------------------------------------------- +-- Stake deregistration + +foreign import data StakeDeregistration :: Type + +foreign import stakeDeregistration_stakeCredential :: StakeDeregistration -> StakeCredential +foreign import stakeDeregistration_new :: StakeCredential -> StakeDeregistration + +instance IsCsl StakeDeregistration where + className _ = "StakeDeregistration" +instance IsBytes StakeDeregistration +instance IsJson StakeDeregistration +instance EncodeAeson StakeDeregistration where encodeAeson = cslToAeson +instance DecodeAeson StakeDeregistration where decodeAeson = cslFromAeson +instance Show StakeDeregistration where show = showViaJson + +------------------------------------------------------------------------------------- +-- Stake registration + +foreign import data StakeRegistration :: Type + +foreign import stakeRegistration_stakeCredential :: StakeRegistration -> StakeCredential +foreign import stakeRegistration_new :: StakeCredential -> StakeRegistration + +instance IsCsl StakeRegistration where + className _ = "StakeRegistration" +instance IsBytes StakeRegistration +instance IsJson StakeRegistration +instance EncodeAeson StakeRegistration where encodeAeson = cslToAeson +instance DecodeAeson StakeRegistration where decodeAeson = cslFromAeson +instance Show StakeRegistration where show = showViaJson + +------------------------------------------------------------------------------------- +-- Timelock expiry + +foreign import data TimelockExpiry :: Type + +foreign import timelockExpiry_slot :: TimelockExpiry -> Number +foreign import timelockExpiry_slotBignum :: TimelockExpiry -> BigNum +foreign import timelockExpiry_new :: Number -> TimelockExpiry +foreign import timelockExpiry_newTimelockexpiry :: BigNum -> TimelockExpiry + +instance IsCsl TimelockExpiry where + className _ = "TimelockExpiry" +instance IsBytes TimelockExpiry +instance IsJson TimelockExpiry +instance EncodeAeson TimelockExpiry where encodeAeson = cslToAeson +instance DecodeAeson TimelockExpiry where decodeAeson = cslFromAeson +instance Show TimelockExpiry where show = showViaJson + +------------------------------------------------------------------------------------- +-- Timelock start + +foreign import data TimelockStart :: Type + +foreign import timelockStart_slot :: TimelockStart -> Number +foreign import timelockStart_slotBignum :: TimelockStart -> BigNum +foreign import timelockStart_new :: Number -> TimelockStart +foreign import timelockStart_newTimelockstart :: BigNum -> TimelockStart + +instance IsCsl TimelockStart where + className _ = "TimelockStart" +instance IsBytes TimelockStart +instance IsJson TimelockStart +instance EncodeAeson TimelockStart where encodeAeson = cslToAeson +instance DecodeAeson TimelockStart where decodeAeson = cslFromAeson +instance Show TimelockStart where show = showViaJson + +------------------------------------------------------------------------------------- +-- Transaction + +foreign import data Transaction :: Type + +foreign import transaction_body :: Transaction -> TransactionBody +foreign import transaction_witnessSet :: Transaction -> TransactionWitnessSet +foreign import transaction_isValid :: Transaction -> Boolean +foreign import transaction_auxiliaryData :: Transaction -> Nullable AuxiliaryData +foreign import transaction_setIsValid :: Transaction -> Boolean -> Nullable Unit +foreign import transaction_new :: TransactionBody -> TransactionWitnessSet -> AuxiliaryData -> Transaction + +instance IsCsl Transaction where + className _ = "Transaction" +instance IsBytes Transaction +instance IsJson Transaction +instance EncodeAeson Transaction where encodeAeson = cslToAeson +instance DecodeAeson Transaction where decodeAeson = cslFromAeson +instance Show Transaction where show = showViaJson + +------------------------------------------------------------------------------------- +-- Transaction batch + +foreign import data TransactionBatch :: Type + + + +instance IsCsl TransactionBatch where + className _ = "TransactionBatch" + +------------------------------------------------------------------------------------- +-- Transaction batch list + +foreign import data TransactionBatchList :: Type + + + +instance IsCsl TransactionBatchList where + className _ = "TransactionBatchList" + +------------------------------------------------------------------------------------- +-- Transaction body + +foreign import data TransactionBody :: Type + +foreign import transactionBody_inputs :: TransactionBody -> TransactionInputs +foreign import transactionBody_outputs :: TransactionBody -> TransactionOutputs +foreign import transactionBody_fee :: TransactionBody -> BigNum +foreign import transactionBody_ttl :: TransactionBody -> Nullable Number +foreign import transactionBody_ttlBignum :: TransactionBody -> Nullable BigNum +foreign import transactionBody_setTtl :: TransactionBody -> BigNum -> Nullable Unit +foreign import transactionBody_removeTtl :: TransactionBody -> Nullable Unit +foreign import transactionBody_setCerts :: TransactionBody -> Certificates -> Nullable Unit +foreign import transactionBody_certs :: TransactionBody -> Nullable Certificates +foreign import transactionBody_setWithdrawals :: TransactionBody -> Withdrawals -> Nullable Unit +foreign import transactionBody_withdrawals :: TransactionBody -> Nullable Withdrawals +foreign import transactionBody_setUpdate :: TransactionBody -> Update -> Nullable Unit +foreign import transactionBody_update :: TransactionBody -> Nullable Update +foreign import transactionBody_setAuxiliaryDataHash :: TransactionBody -> AuxiliaryDataHash -> Nullable Unit +foreign import transactionBody_auxiliaryDataHash :: TransactionBody -> Nullable AuxiliaryDataHash +foreign import transactionBody_setValidityStartInterval :: TransactionBody -> Number -> Nullable Unit +foreign import transactionBody_setValidityStartIntervalBignum :: TransactionBody -> BigNum -> Nullable Unit +foreign import transactionBody_validityStartIntervalBignum :: TransactionBody -> Nullable BigNum +foreign import transactionBody_validityStartInterval :: TransactionBody -> Nullable Number +foreign import transactionBody_setMint :: TransactionBody -> Mint -> Nullable Unit +foreign import transactionBody_mint :: TransactionBody -> Nullable Mint +foreign import transactionBody_multiassets :: TransactionBody -> Nullable Mint +foreign import transactionBody_setReferenceInputs :: TransactionBody -> TransactionInputs -> Nullable Unit +foreign import transactionBody_referenceInputs :: TransactionBody -> Nullable TransactionInputs +foreign import transactionBody_setScriptDataHash :: TransactionBody -> ScriptDataHash -> Nullable Unit +foreign import transactionBody_scriptDataHash :: TransactionBody -> Nullable ScriptDataHash +foreign import transactionBody_setCollateral :: TransactionBody -> TransactionInputs -> Nullable Unit +foreign import transactionBody_collateral :: TransactionBody -> Nullable TransactionInputs +foreign import transactionBody_setRequiredSigners :: TransactionBody -> Ed25519KeyHashes -> Nullable Unit +foreign import transactionBody_requiredSigners :: TransactionBody -> Nullable Ed25519KeyHashes +foreign import transactionBody_setNetworkId :: TransactionBody -> NetworkId -> Nullable Unit +foreign import transactionBody_networkId :: TransactionBody -> Nullable NetworkId +foreign import transactionBody_setCollateralReturn :: TransactionBody -> TransactionOutput -> Nullable Unit +foreign import transactionBody_collateralReturn :: TransactionBody -> Nullable TransactionOutput +foreign import transactionBody_setTotalCollateral :: TransactionBody -> BigNum -> Nullable Unit +foreign import transactionBody_totalCollateral :: TransactionBody -> Nullable BigNum +foreign import transactionBody_new :: TransactionInputs -> TransactionOutputs -> BigNum -> Number -> TransactionBody +foreign import transactionBody_newTxBody :: TransactionInputs -> TransactionOutputs -> BigNum -> TransactionBody + +instance IsCsl TransactionBody where + className _ = "TransactionBody" +instance IsBytes TransactionBody +instance IsJson TransactionBody +instance EncodeAeson TransactionBody where encodeAeson = cslToAeson +instance DecodeAeson TransactionBody where decodeAeson = cslFromAeson +instance Show TransactionBody where show = showViaJson + +------------------------------------------------------------------------------------- +-- Transaction hash + +foreign import data TransactionHash :: Type + +foreign import transactionHash_toBech32 :: TransactionHash -> String -> String +foreign import transactionHash_fromBech32 :: String -> Nullable TransactionHash + +instance IsCsl TransactionHash where + className _ = "TransactionHash" +instance IsBytes TransactionHash +instance EncodeAeson TransactionHash where encodeAeson = cslToAesonViaBytes +instance DecodeAeson TransactionHash where decodeAeson = cslFromAesonViaBytes +instance Show TransactionHash where show = showViaBytes + +------------------------------------------------------------------------------------- +-- Transaction input + +foreign import data TransactionInput :: Type + +foreign import transactionInput_transactionId :: TransactionInput -> TransactionHash +foreign import transactionInput_index :: TransactionInput -> Number +foreign import transactionInput_new :: TransactionHash -> Number -> TransactionInput + +instance IsCsl TransactionInput where + className _ = "TransactionInput" +instance IsBytes TransactionInput +instance IsJson TransactionInput +instance EncodeAeson TransactionInput where encodeAeson = cslToAeson +instance DecodeAeson TransactionInput where decodeAeson = cslFromAeson +instance Show TransactionInput where show = showViaJson + +------------------------------------------------------------------------------------- +-- Transaction inputs + +foreign import data TransactionInputs :: Type + +foreign import transactionInputs_new :: Effect TransactionInputs +foreign import transactionInputs_toOption :: TransactionInputs -> Nullable TransactionInputs + +instance IsCsl TransactionInputs where + className _ = "TransactionInputs" +instance IsBytes TransactionInputs +instance IsJson TransactionInputs +instance EncodeAeson TransactionInputs where encodeAeson = cslToAeson +instance DecodeAeson TransactionInputs where decodeAeson = cslFromAeson +instance Show TransactionInputs where show = showViaJson + +instance IsListContainer TransactionInputs TransactionInput + +------------------------------------------------------------------------------------- +-- Transaction metadatum + +foreign import data TransactionMetadatum :: Type + +foreign import transactionMetadatum_newMap :: MetadataMap -> TransactionMetadatum +foreign import transactionMetadatum_newList :: MetadataList -> TransactionMetadatum +foreign import transactionMetadatum_newInt :: Int -> TransactionMetadatum +foreign import transactionMetadatum_newBytes :: ByteArray -> TransactionMetadatum +foreign import transactionMetadatum_newText :: String -> TransactionMetadatum +foreign import transactionMetadatum_kind :: TransactionMetadatum -> Number +foreign import transactionMetadatum_asMap :: TransactionMetadatum -> MetadataMap +foreign import transactionMetadatum_asList :: TransactionMetadatum -> MetadataList +foreign import transactionMetadatum_asInt :: TransactionMetadatum -> Int +foreign import transactionMetadatum_asBytes :: TransactionMetadatum -> ByteArray +foreign import transactionMetadatum_asText :: TransactionMetadatum -> String + +instance IsCsl TransactionMetadatum where + className _ = "TransactionMetadatum" +instance IsBytes TransactionMetadatum +instance EncodeAeson TransactionMetadatum where encodeAeson = cslToAesonViaBytes +instance DecodeAeson TransactionMetadatum where decodeAeson = cslFromAesonViaBytes +instance Show TransactionMetadatum where show = showViaBytes + +------------------------------------------------------------------------------------- +-- Transaction metadatum labels + +foreign import data TransactionMetadatumLabels :: Type + +foreign import transactionMetadatumLabels_new :: Effect TransactionMetadatumLabels + +instance IsCsl TransactionMetadatumLabels where + className _ = "TransactionMetadatumLabels" +instance IsBytes TransactionMetadatumLabels +instance EncodeAeson TransactionMetadatumLabels where encodeAeson = cslToAesonViaBytes +instance DecodeAeson TransactionMetadatumLabels where decodeAeson = cslFromAesonViaBytes +instance Show TransactionMetadatumLabels where show = showViaBytes + +instance IsListContainer TransactionMetadatumLabels BigNum + +------------------------------------------------------------------------------------- +-- Transaction output + +foreign import data TransactionOutput :: Type + +foreign import transactionOutput_address :: TransactionOutput -> Address +foreign import transactionOutput_amount :: TransactionOutput -> Value +foreign import transactionOutput_dataHash :: TransactionOutput -> Nullable DataHash +foreign import transactionOutput_plutusData :: TransactionOutput -> Nullable PlutusData +foreign import transactionOutput_scriptRef :: TransactionOutput -> Nullable ScriptRef +foreign import transactionOutput_setScriptRef :: TransactionOutput -> ScriptRef -> Effect Unit +foreign import transactionOutput_setPlutusData :: TransactionOutput -> PlutusData -> Effect Unit +foreign import transactionOutput_setDataHash :: TransactionOutput -> DataHash -> Effect Unit +foreign import transactionOutput_hasPlutusData :: TransactionOutput -> Boolean +foreign import transactionOutput_hasDataHash :: TransactionOutput -> Boolean +foreign import transactionOutput_hasScriptRef :: TransactionOutput -> Boolean +foreign import transactionOutput_new :: Address -> Value -> TransactionOutput +foreign import transactionOutput_serializationFormat :: TransactionOutput -> Nullable Number + +instance IsCsl TransactionOutput where + className _ = "TransactionOutput" +instance IsBytes TransactionOutput +instance IsJson TransactionOutput +instance EncodeAeson TransactionOutput where encodeAeson = cslToAeson +instance DecodeAeson TransactionOutput where decodeAeson = cslFromAeson +instance Show TransactionOutput where show = showViaJson + +------------------------------------------------------------------------------------- +-- Transaction outputs + +foreign import data TransactionOutputs :: Type + +foreign import transactionOutputs_new :: Effect TransactionOutputs + +instance IsCsl TransactionOutputs where + className _ = "TransactionOutputs" +instance IsBytes TransactionOutputs +instance IsJson TransactionOutputs +instance EncodeAeson TransactionOutputs where encodeAeson = cslToAeson +instance DecodeAeson TransactionOutputs where decodeAeson = cslFromAeson +instance Show TransactionOutputs where show = showViaJson + +instance IsListContainer TransactionOutputs TransactionOutput + +------------------------------------------------------------------------------------- +-- Transaction unspent output + +foreign import data TransactionUnspentOutput :: Type + +foreign import transactionUnspentOutput_new :: TransactionInput -> TransactionOutput -> TransactionUnspentOutput +foreign import transactionUnspentOutput_input :: TransactionUnspentOutput -> TransactionInput +foreign import transactionUnspentOutput_output :: TransactionUnspentOutput -> TransactionOutput + +instance IsCsl TransactionUnspentOutput where + className _ = "TransactionUnspentOutput" +instance IsBytes TransactionUnspentOutput +instance IsJson TransactionUnspentOutput +instance EncodeAeson TransactionUnspentOutput where encodeAeson = cslToAeson +instance DecodeAeson TransactionUnspentOutput where decodeAeson = cslFromAeson +instance Show TransactionUnspentOutput where show = showViaJson + +------------------------------------------------------------------------------------- +-- Transaction unspent outputs + +foreign import data TransactionUnspentOutputs :: Type + +foreign import transactionUnspentOutputs_new :: Effect TransactionUnspentOutputs + +instance IsCsl TransactionUnspentOutputs where + className _ = "TransactionUnspentOutputs" +instance IsJson TransactionUnspentOutputs +instance EncodeAeson TransactionUnspentOutputs where encodeAeson = cslToAeson +instance DecodeAeson TransactionUnspentOutputs where decodeAeson = cslFromAeson +instance Show TransactionUnspentOutputs where show = showViaJson + +instance IsListContainer TransactionUnspentOutputs TransactionUnspentOutput + +------------------------------------------------------------------------------------- +-- Transaction witness set + +foreign import data TransactionWitnessSet :: Type + +foreign import transactionWitnessSet_setVkeys :: TransactionWitnessSet -> Vkeywitnesses -> Effect Unit +foreign import transactionWitnessSet_vkeys :: TransactionWitnessSet -> Effect ((Nullable Vkeywitnesses)) +foreign import transactionWitnessSet_setNativeScripts :: TransactionWitnessSet -> NativeScripts -> Effect Unit +foreign import transactionWitnessSet_nativeScripts :: TransactionWitnessSet -> Effect ((Nullable NativeScripts)) +foreign import transactionWitnessSet_setBootstraps :: TransactionWitnessSet -> BootstrapWitnesses -> Effect Unit +foreign import transactionWitnessSet_bootstraps :: TransactionWitnessSet -> Effect ((Nullable BootstrapWitnesses)) +foreign import transactionWitnessSet_setPlutusScripts :: TransactionWitnessSet -> PlutusScripts -> Effect Unit +foreign import transactionWitnessSet_plutusScripts :: TransactionWitnessSet -> Effect ((Nullable PlutusScripts)) +foreign import transactionWitnessSet_setPlutusData :: TransactionWitnessSet -> PlutusList -> Effect Unit +foreign import transactionWitnessSet_plutusData :: TransactionWitnessSet -> Effect ((Nullable PlutusList)) +foreign import transactionWitnessSet_setRedeemers :: TransactionWitnessSet -> Redeemers -> Effect Unit +foreign import transactionWitnessSet_redeemers :: TransactionWitnessSet -> Effect ((Nullable Redeemers)) +foreign import transactionWitnessSet_new :: Effect TransactionWitnessSet + +instance IsCsl TransactionWitnessSet where + className _ = "TransactionWitnessSet" +instance IsBytes TransactionWitnessSet +instance IsJson TransactionWitnessSet +instance EncodeAeson TransactionWitnessSet where encodeAeson = cslToAeson +instance DecodeAeson TransactionWitnessSet where decodeAeson = cslFromAeson +instance Show TransactionWitnessSet where show = showViaJson + +------------------------------------------------------------------------------------- +-- URL + +foreign import data URL :: Type + +foreign import url_new :: String -> URL +foreign import url_url :: URL -> String + +instance IsCsl URL where + className _ = "URL" +instance IsBytes URL +instance IsJson URL +instance EncodeAeson URL where encodeAeson = cslToAeson +instance DecodeAeson URL where decodeAeson = cslFromAeson +instance Show URL where show = showViaJson + +------------------------------------------------------------------------------------- +-- Unit interval + +foreign import data UnitInterval :: Type + +foreign import unitInterval_numerator :: UnitInterval -> BigNum +foreign import unitInterval_denominator :: UnitInterval -> BigNum +foreign import unitInterval_new :: BigNum -> BigNum -> UnitInterval + +instance IsCsl UnitInterval where + className _ = "UnitInterval" +instance IsBytes UnitInterval +instance IsJson UnitInterval +instance EncodeAeson UnitInterval where encodeAeson = cslToAeson +instance DecodeAeson UnitInterval where decodeAeson = cslFromAeson +instance Show UnitInterval where show = showViaJson + +------------------------------------------------------------------------------------- +-- Update + +foreign import data Update :: Type + +foreign import update_proposedProtocolParameterUpdates :: Update -> ProposedProtocolParameterUpdates +foreign import update_epoch :: Update -> Number +foreign import update_new :: ProposedProtocolParameterUpdates -> Number -> Update + +instance IsCsl Update where + className _ = "Update" +instance IsBytes Update +instance IsJson Update +instance EncodeAeson Update where encodeAeson = cslToAeson +instance DecodeAeson Update where decodeAeson = cslFromAeson +instance Show Update where show = showViaJson + +------------------------------------------------------------------------------------- +-- VRFCert + +foreign import data VRFCert :: Type + +foreign import vrfCert_output :: VRFCert -> ByteArray +foreign import vrfCert_proof :: VRFCert -> ByteArray +foreign import vrfCert_new :: ByteArray -> ByteArray -> VRFCert + +instance IsCsl VRFCert where + className _ = "VRFCert" +instance IsBytes VRFCert +instance IsJson VRFCert +instance EncodeAeson VRFCert where encodeAeson = cslToAeson +instance DecodeAeson VRFCert where decodeAeson = cslFromAeson +instance Show VRFCert where show = showViaJson + +------------------------------------------------------------------------------------- +-- VRFKey hash + +foreign import data VRFKeyHash :: Type + +foreign import vrfKeyHash_toBech32 :: VRFKeyHash -> String -> String +foreign import vrfKeyHash_fromBech32 :: String -> Nullable VRFKeyHash + +instance IsCsl VRFKeyHash where + className _ = "VRFKeyHash" +instance IsBytes VRFKeyHash +instance EncodeAeson VRFKeyHash where encodeAeson = cslToAesonViaBytes +instance DecodeAeson VRFKeyHash where decodeAeson = cslFromAesonViaBytes +instance Show VRFKeyHash where show = showViaBytes + +------------------------------------------------------------------------------------- +-- VRFVKey + +foreign import data VRFVKey :: Type + +foreign import vrfvKey_toBech32 :: VRFVKey -> String -> String +foreign import vrfvKey_fromBech32 :: String -> Nullable VRFVKey + +instance IsCsl VRFVKey where + className _ = "VRFVKey" +instance IsBytes VRFVKey +instance EncodeAeson VRFVKey where encodeAeson = cslToAesonViaBytes +instance DecodeAeson VRFVKey where decodeAeson = cslFromAesonViaBytes +instance Show VRFVKey where show = showViaBytes + +------------------------------------------------------------------------------------- +-- Value + +foreign import data Value :: Type + +foreign import value_new :: BigNum -> Value +foreign import value_newFromAssets :: MultiAsset -> Value +foreign import value_newWithAssets :: BigNum -> MultiAsset -> Value +foreign import value_zero :: Value +foreign import value_isZero :: Value -> Boolean +foreign import value_coin :: Value -> BigNum +foreign import value_setCoin :: Value -> BigNum -> Nullable Unit +foreign import value_multiasset :: Value -> Nullable MultiAsset +foreign import value_setMultiasset :: Value -> MultiAsset -> Effect Unit +foreign import value_checkedAdd :: Value -> Value -> Nullable Value +foreign import value_checkedSub :: Value -> Value -> Nullable Value +foreign import value_clampedSub :: Value -> Value -> Value +foreign import value_compare :: Value -> Value -> Nullable Number + +instance IsCsl Value where + className _ = "Value" +instance IsBytes Value +instance IsJson Value +instance EncodeAeson Value where encodeAeson = cslToAeson +instance DecodeAeson Value where decodeAeson = cslFromAeson +instance Show Value where show = showViaJson + +------------------------------------------------------------------------------------- +-- Vkey + +foreign import data Vkey :: Type + +foreign import vkey_new :: PublicKey -> Vkey +foreign import vkey_publicKey :: Vkey -> PublicKey + +instance IsCsl Vkey where + className _ = "Vkey" +instance IsBytes Vkey +instance IsJson Vkey +instance EncodeAeson Vkey where encodeAeson = cslToAeson +instance DecodeAeson Vkey where decodeAeson = cslFromAeson +instance Show Vkey where show = showViaJson + +------------------------------------------------------------------------------------- +-- Vkeys + +foreign import data Vkeys :: Type + +foreign import vkeys_new :: Effect Vkeys + +instance IsCsl Vkeys where + className _ = "Vkeys" + +instance IsListContainer Vkeys Vkey + +------------------------------------------------------------------------------------- +-- Vkeywitness + +foreign import data Vkeywitness :: Type + +foreign import vkeywitness_new :: Vkey -> Ed25519Signature -> Vkeywitness +foreign import vkeywitness_vkey :: Vkeywitness -> Vkey +foreign import vkeywitness_signature :: Vkeywitness -> Ed25519Signature + +instance IsCsl Vkeywitness where + className _ = "Vkeywitness" +instance IsBytes Vkeywitness +instance IsJson Vkeywitness +instance EncodeAeson Vkeywitness where encodeAeson = cslToAeson +instance DecodeAeson Vkeywitness where decodeAeson = cslFromAeson +instance Show Vkeywitness where show = showViaJson + +------------------------------------------------------------------------------------- +-- Vkeywitnesses + +foreign import data Vkeywitnesses :: Type + +foreign import vkeywitnesses_new :: Effect Vkeywitnesses + +instance IsCsl Vkeywitnesses where + className _ = "Vkeywitnesses" +instance IsBytes Vkeywitnesses +instance IsJson Vkeywitnesses +instance EncodeAeson Vkeywitnesses where encodeAeson = cslToAeson +instance DecodeAeson Vkeywitnesses where decodeAeson = cslFromAeson +instance Show Vkeywitnesses where show = showViaJson + +instance IsListContainer Vkeywitnesses Vkeywitness + +------------------------------------------------------------------------------------- +-- Withdrawals + +foreign import data Withdrawals :: Type + +foreign import withdrawals_new :: Effect Withdrawals + +instance IsCsl Withdrawals where + className _ = "Withdrawals" +instance IsBytes Withdrawals +instance IsJson Withdrawals +instance EncodeAeson Withdrawals where encodeAeson = cslToAeson +instance DecodeAeson Withdrawals where decodeAeson = cslFromAeson +instance Show Withdrawals where show = showViaJson + +instance IsMapContainer Withdrawals RewardAddress BigNum + diff --git a/src/Cardano/Serialization/Lib/Internal.js b/src/Cardano/Serialization/Lib/Internal.js new file mode 100644 index 0000000..4ecde41 --- /dev/null +++ b/src/Cardano/Serialization/Lib/Internal.js @@ -0,0 +1,173 @@ +module Cardano.Serialization.Lib.Internal where + +import Prelude + +import Aeson (Aeson, decodeAeson, encodeAeson, jsonToAeson, stringifyAeson) +import Data.Argonaut (Json, JsonDecodeError(TypeMismatch), jsonParser, stringify) +import Data.Bifunctor (lmap) +import Data.ByteArray (ByteArray) +import Data.Either (Either, note) +import Data.Map (Map) +import Data.Map as Map +import Data.Maybe (Maybe(Nothing, Just)) +import Data.Profunctor.Strong ((***)) +import Data.Tuple (Tuple(Tuple)) +import Data.Tuple.Nested (type (/\), (/\)) +import Type.Proxy (Proxy(Proxy)) + +-- all types + +class IsCsl (a :: Type) where + className :: Proxy a -> String + +-- byte-representable types + +class IsCsl a <= IsBytes (a :: Type) + +toBytes :: forall a. IsCsl a => IsBytes a => a -> ByteArray +toBytes = _toBytes + +fromBytes :: forall a. IsCsl a => IsBytes a => ByteArray -> Maybe a +fromBytes = _fromBytes (className (Proxy :: Proxy a)) Nothing Just + +foreign import _toBytes :: forall a. a -> ByteArray + +foreign import _fromBytes + :: forall b + . String + -> (forall a. Maybe a) + -> (forall a. a -> Maybe a) + -> ByteArray + -> Maybe b + +-- json + +class IsCsl a <= IsJson (a :: Type) + +-- containers + +class IsListContainer (c :: Type) (e :: Type) | c -> e + +packListContainer :: forall c e. IsCsl c => IsListContainer c e => Array e -> c +packListContainer = _packListContainer (className (Proxy :: Proxy c)) + +unpackListContainer :: forall c e. IsListContainer c e => c -> Array e +unpackListContainer = _unpackListContainer + +foreign import _packListContainer :: forall c e. String -> Array e -> c +foreign import _unpackListContainer :: forall c e. c -> Array e + +class IsMapContainer (c :: Type) (k :: Type) (v :: Type) | c -> k, c -> v + +packMapContainer + :: forall c k v + . IsMapContainer c k v + => IsCsl c + => Array (k /\ v) + -> c +packMapContainer = map toKeyValues >>> _packMapContainer (className (Proxy :: Proxy c)) + where + toKeyValues (Tuple key value) = { key, value } + +packMapContainerFromMap + :: forall c k v + . IsMapContainer c k v + => IsCsl c + => IsCsl k + => IsCsl v + => Map k v + -> c +packMapContainerFromMap = packMapContainer <<< Map.toUnfoldable + +unpackMapContainer + :: forall c k v + . IsMapContainer c k v + => c + -> Array (k /\ v) +unpackMapContainer = _unpackMapContainer >>> map fromKV + where fromKV { key, value } = key /\ value + +unpackMapContainerToMapWith + :: forall c k v k1 v1 + . IsMapContainer c k v + => Ord k1 + => (k -> k1) + -> (v -> v1) + -> c + -> Map k1 v1 +unpackMapContainerToMapWith mapKey mapValue container = + unpackMapContainer container + # map (mapKey *** mapValue) >>> Map.fromFoldable + +foreign import _packMapContainer + :: forall c k v + . String + -> Array { key :: k, value :: v } + -> c + +foreign import _unpackMapContainer + :: forall c k v + . c + -> Array { key :: k, value :: v } + +-- Aeson + +cslFromAeson + :: forall a + . IsJson a + => Aeson + -> Either JsonDecodeError a +cslFromAeson aeson = + (lmap (const $ TypeMismatch "JSON") $ jsonParser $ stringifyAeson aeson) + >>= cslFromJson >>> note (TypeMismatch $ className (Proxy :: Proxy a)) + +cslToAeson + :: forall a + . IsJson a + => a -> Aeson +cslToAeson = _cslToJson >>> jsonToAeson + +cslToAesonViaBytes + :: forall a + . IsBytes a + => a -> Aeson +cslToAesonViaBytes = toBytes >>> encodeAeson + +cslFromAesonViaBytes + :: forall a + . IsBytes a + => Aeson -> Either JsonDecodeError a +cslFromAesonViaBytes aeson = do + bytes <- decodeAeson aeson + note (TypeMismatch $ className (Proxy :: Proxy a)) $ fromBytes bytes + +-- Show + +showViaBytes + :: forall a + . IsBytes a + => a + -> String +showViaBytes a = "(unsafePartial $ fromJust $ fromBytes " <> show (toBytes a) <> ")" + +showViaJson + :: forall a + . IsJson a + => a + -> String +showViaJson a = "(unsafePartial $ fromJust $ cslFromJson $ jsonParser " <> show (stringify (_cslToJson a)) <> ")" + +--- Json + +cslFromJson :: forall a. IsCsl a => IsJson a => Json -> Maybe a +cslFromJson = _cslFromJson (className (Proxy :: Proxy a)) Nothing Just + +foreign import _cslFromJson + :: forall b + . String + -> (forall a. Maybe a) + -> (forall a. a -> Maybe a) + -> Json + -> Maybe b + +foreign import _cslToJson :: forall a. a -> Json diff --git a/src/Cardano/Serialization/Lib/Internal.purs b/src/Cardano/Serialization/Lib/Internal.purs new file mode 100644 index 0000000..4ecde41 --- /dev/null +++ b/src/Cardano/Serialization/Lib/Internal.purs @@ -0,0 +1,173 @@ +module Cardano.Serialization.Lib.Internal where + +import Prelude + +import Aeson (Aeson, decodeAeson, encodeAeson, jsonToAeson, stringifyAeson) +import Data.Argonaut (Json, JsonDecodeError(TypeMismatch), jsonParser, stringify) +import Data.Bifunctor (lmap) +import Data.ByteArray (ByteArray) +import Data.Either (Either, note) +import Data.Map (Map) +import Data.Map as Map +import Data.Maybe (Maybe(Nothing, Just)) +import Data.Profunctor.Strong ((***)) +import Data.Tuple (Tuple(Tuple)) +import Data.Tuple.Nested (type (/\), (/\)) +import Type.Proxy (Proxy(Proxy)) + +-- all types + +class IsCsl (a :: Type) where + className :: Proxy a -> String + +-- byte-representable types + +class IsCsl a <= IsBytes (a :: Type) + +toBytes :: forall a. IsCsl a => IsBytes a => a -> ByteArray +toBytes = _toBytes + +fromBytes :: forall a. IsCsl a => IsBytes a => ByteArray -> Maybe a +fromBytes = _fromBytes (className (Proxy :: Proxy a)) Nothing Just + +foreign import _toBytes :: forall a. a -> ByteArray + +foreign import _fromBytes + :: forall b + . String + -> (forall a. Maybe a) + -> (forall a. a -> Maybe a) + -> ByteArray + -> Maybe b + +-- json + +class IsCsl a <= IsJson (a :: Type) + +-- containers + +class IsListContainer (c :: Type) (e :: Type) | c -> e + +packListContainer :: forall c e. IsCsl c => IsListContainer c e => Array e -> c +packListContainer = _packListContainer (className (Proxy :: Proxy c)) + +unpackListContainer :: forall c e. IsListContainer c e => c -> Array e +unpackListContainer = _unpackListContainer + +foreign import _packListContainer :: forall c e. String -> Array e -> c +foreign import _unpackListContainer :: forall c e. c -> Array e + +class IsMapContainer (c :: Type) (k :: Type) (v :: Type) | c -> k, c -> v + +packMapContainer + :: forall c k v + . IsMapContainer c k v + => IsCsl c + => Array (k /\ v) + -> c +packMapContainer = map toKeyValues >>> _packMapContainer (className (Proxy :: Proxy c)) + where + toKeyValues (Tuple key value) = { key, value } + +packMapContainerFromMap + :: forall c k v + . IsMapContainer c k v + => IsCsl c + => IsCsl k + => IsCsl v + => Map k v + -> c +packMapContainerFromMap = packMapContainer <<< Map.toUnfoldable + +unpackMapContainer + :: forall c k v + . IsMapContainer c k v + => c + -> Array (k /\ v) +unpackMapContainer = _unpackMapContainer >>> map fromKV + where fromKV { key, value } = key /\ value + +unpackMapContainerToMapWith + :: forall c k v k1 v1 + . IsMapContainer c k v + => Ord k1 + => (k -> k1) + -> (v -> v1) + -> c + -> Map k1 v1 +unpackMapContainerToMapWith mapKey mapValue container = + unpackMapContainer container + # map (mapKey *** mapValue) >>> Map.fromFoldable + +foreign import _packMapContainer + :: forall c k v + . String + -> Array { key :: k, value :: v } + -> c + +foreign import _unpackMapContainer + :: forall c k v + . c + -> Array { key :: k, value :: v } + +-- Aeson + +cslFromAeson + :: forall a + . IsJson a + => Aeson + -> Either JsonDecodeError a +cslFromAeson aeson = + (lmap (const $ TypeMismatch "JSON") $ jsonParser $ stringifyAeson aeson) + >>= cslFromJson >>> note (TypeMismatch $ className (Proxy :: Proxy a)) + +cslToAeson + :: forall a + . IsJson a + => a -> Aeson +cslToAeson = _cslToJson >>> jsonToAeson + +cslToAesonViaBytes + :: forall a + . IsBytes a + => a -> Aeson +cslToAesonViaBytes = toBytes >>> encodeAeson + +cslFromAesonViaBytes + :: forall a + . IsBytes a + => Aeson -> Either JsonDecodeError a +cslFromAesonViaBytes aeson = do + bytes <- decodeAeson aeson + note (TypeMismatch $ className (Proxy :: Proxy a)) $ fromBytes bytes + +-- Show + +showViaBytes + :: forall a + . IsBytes a + => a + -> String +showViaBytes a = "(unsafePartial $ fromJust $ fromBytes " <> show (toBytes a) <> ")" + +showViaJson + :: forall a + . IsJson a + => a + -> String +showViaJson a = "(unsafePartial $ fromJust $ cslFromJson $ jsonParser " <> show (stringify (_cslToJson a)) <> ")" + +--- Json + +cslFromJson :: forall a. IsCsl a => IsJson a => Json -> Maybe a +cslFromJson = _cslFromJson (className (Proxy :: Proxy a)) Nothing Just + +foreign import _cslFromJson + :: forall b + . String + -> (forall a. Maybe a) + -> (forall a. a -> Maybe a) + -> Json + -> Maybe b + +foreign import _cslToJson :: forall a. a -> Json diff --git a/src/Csl.js b/src/Csl.js deleted file mode 100644 index 47c546b..0000000 --- a/src/Csl.js +++ /dev/null @@ -1,2007 +0,0 @@ -"use strict"; - -import * as CSL from "@emurgo/cardano-serialization-lib-browser"; - -// Pass in a function and its list of arguments, that is expected to fail on evaluation, wraps in Either - function errorableToPurs(f, ...vars) { - return left => right => { - try { - return right(f(...vars)); - } - catch (err) { - if(typeof err === "string") return left(err) - else return left(err.message); - } - } - } - -// funs - -export const minFee = tx => linear_fee => CSL.min_fee(tx, linear_fee); -export const calculateExUnitsCeilCost = ex_units => ex_unit_prices => CSL.calculate_ex_units_ceil_cost(ex_units, ex_unit_prices); -export const minScriptFee = tx => ex_unit_prices => CSL.min_script_fee(tx, ex_unit_prices); -export const encryptWithPassword = password => salt => nonce => data => CSL.encrypt_with_password(password, salt, nonce, data); -export const decryptWithPassword = password => data => CSL.decrypt_with_password(password, data); -export const makeDaedalusBootstrapWitness = tx_body_hash => addr => key => CSL.make_daedalus_bootstrap_witness(tx_body_hash, addr, key); -export const makeIcarusBootstrapWitness = tx_body_hash => addr => key => CSL.make_icarus_bootstrap_witness(tx_body_hash, addr, key); -export const makeVkeyWitness = tx_body_hash => sk => CSL.make_vkey_witness(tx_body_hash, sk); -export const hashAuxiliaryData = auxiliary_data => CSL.hash_auxiliary_data(auxiliary_data); -export const hashTx = tx_body => CSL.hash_transaction(tx_body); -export const hashPlutusData = plutus_data => CSL.hash_plutus_data(plutus_data); -export const hashScriptData = redeemers => cost_models => datums => CSL.hash_script_data(redeemers, cost_models, datums); -export const getImplicitIn = txbody => pool_deposit => key_deposit => CSL.get_implicit_input(txbody, pool_deposit, key_deposit); -export const getDeposit = txbody => pool_deposit => key_deposit => CSL.get_deposit(txbody, pool_deposit, key_deposit); -export const minAdaForOut = output => data_cost => CSL.min_ada_for_output(output, data_cost); -export const minAdaRequired = assets => has_data_hash => coins_per_utxo_word => CSL.min_ada_required(assets, has_data_hash, coins_per_utxo_word); -export const encodeJsonStrToNativeScript = json => self_xpub => schema => CSL.encode_json_str_to_native_script(json, self_xpub, schema); -export const encodeJsonStrToPlutusDatum = json => schema => CSL.encode_json_str_to_plutus_datum(json, schema); -export const decodePlutusDatumToJsonStr = datum => schema => CSL.decode_plutus_datum_to_json_str(datum, schema); -export const encodeArbitraryBytesAsMetadatum = bytes => CSL.encode_arbitrary_bytes_as_metadatum(bytes); -export const decodeArbitraryBytesFromMetadatum = metadata => CSL.decode_arbitrary_bytes_from_metadatum(metadata); -export const encodeJsonStrToMetadatum = json => schema => CSL.encode_json_str_to_metadatum(json, schema); -export const decodeMetadatumToJsonStr = metadatum => schema => CSL.decode_metadatum_to_json_str(metadatum, schema); - -// ---------------------------------------------------------------------- -// types - -// Address -export const address_free = self => () => self.free(); -export const address_fromBytes = data => errorableToPurs(CSL.Address.from_bytes, data); -export const address_toJson = self => self.to_json(); -export const address_toJsValue = self => self.to_js_value(); -export const address_fromJson = json => errorableToPurs(CSL.Address.from_json, json); -export const address_toHex = self => self.to_hex(); -export const address_fromHex = hex_str => errorableToPurs(CSL.Address.from_hex, hex_str); -export const address_toBytes = self => self.to_bytes(); -export const address_toBech32 = self => prefix => self.to_bech32(prefix); -export const address_fromBech32 = bech_str => errorableToPurs(CSL.Address.from_bech32, bech_str); -export const address_networkId = self => self.network_id(); - -// AssetName -export const assetName_free = self => () => self.free(); -export const assetName_toBytes = self => self.to_bytes(); -export const assetName_fromBytes = bytes => errorableToPurs(CSL.AssetName.from_bytes, bytes); -export const assetName_toHex = self => self.to_hex(); -export const assetName_fromHex = hex_str => errorableToPurs(CSL.AssetName.from_hex, hex_str); -export const assetName_toJson = self => self.to_json(); -export const assetName_toJsValue = self => self.to_js_value(); -export const assetName_fromJson = json => errorableToPurs(CSL.AssetName.from_json, json); -export const assetName_new = name => CSL.AssetName.new(name); -export const assetName_name = self => self.name(); - -// AssetNames -export const assetNames_free = self => () => self.free(); -export const assetNames_toBytes = self => self.to_bytes(); -export const assetNames_fromBytes = bytes => errorableToPurs(CSL.AssetNames.from_bytes, bytes); -export const assetNames_toHex = self => self.to_hex(); -export const assetNames_fromHex = hex_str => errorableToPurs(CSL.AssetNames.from_hex, hex_str); -export const assetNames_toJson = self => self.to_json(); -export const assetNames_toJsValue = self => self.to_js_value(); -export const assetNames_fromJson = json => errorableToPurs(CSL.AssetNames.from_json, json); -export const assetNames_new = () => CSL.AssetNames.new(); -export const assetNames_len = self => () => self.len(); -export const assetNames_get = self => index => () => self.get(index); -export const assetNames_add = self => elem => () => self.add(elem); - -// Assets -export const assets_free = self => () => self.free(); -export const assets_toBytes = self => self.to_bytes(); -export const assets_fromBytes = bytes => errorableToPurs(CSL.Assets.from_bytes, bytes); -export const assets_toHex = self => self.to_hex(); -export const assets_fromHex = hex_str => errorableToPurs(CSL.Assets.from_hex, hex_str); -export const assets_toJson = self => self.to_json(); -export const assets_toJsValue = self => self.to_js_value(); -export const assets_fromJson = json => errorableToPurs(CSL.Assets.from_json, json); -export const assets_new = () => CSL.Assets.new(); -export const assets_len = self => () => self.len(); -export const assets_insert = self => key => value => () => self.insert(key, value); -export const assets_get = self => key => () => self.get(key); -export const assets_keys = self => () => self.keys(); - -// AuxiliaryData -export const auxiliaryData_free = self => () => self.free(); -export const auxiliaryData_toBytes = self => self.to_bytes(); -export const auxiliaryData_fromBytes = bytes => errorableToPurs(CSL.AuxiliaryData.from_bytes, bytes); -export const auxiliaryData_toHex = self => self.to_hex(); -export const auxiliaryData_fromHex = hex_str => errorableToPurs(CSL.AuxiliaryData.from_hex, hex_str); -export const auxiliaryData_toJson = self => self.to_json(); -export const auxiliaryData_toJsValue = self => self.to_js_value(); -export const auxiliaryData_fromJson = json => errorableToPurs(CSL.AuxiliaryData.from_json, json); -export const auxiliaryData_new = () => CSL.AuxiliaryData.new(); -export const auxiliaryData_metadata = self => self.metadata(); -export const auxiliaryData_setMetadata = self => metadata => () => self.set_metadata(metadata); -export const auxiliaryData_nativeScripts = self => () => self.native_scripts(); -export const auxiliaryData_setNativeScripts = self => native_scripts => () => self.set_native_scripts(native_scripts); -export const auxiliaryData_plutusScripts = self => () => self.plutus_scripts(); -export const auxiliaryData_setPlutusScripts = self => plutus_scripts => () => self.set_plutus_scripts(plutus_scripts); - -// AuxiliaryDataHash -export const auxiliaryDataHash_free = self => () => self.free(); -export const auxiliaryDataHash_fromBytes = bytes => errorableToPurs(CSL.AuxiliaryDataHash.from_bytes, bytes); -export const auxiliaryDataHash_toBytes = self => self.to_bytes(); -export const auxiliaryDataHash_toBech32 = self => prefix => self.to_bech32(prefix); -export const auxiliaryDataHash_fromBech32 = bech_str => errorableToPurs(CSL.AuxiliaryDataHash.from_bech32, bech_str); -export const auxiliaryDataHash_toHex = self => self.to_hex(); -export const auxiliaryDataHash_fromHex = hex => errorableToPurs(CSL.AuxiliaryDataHash.from_hex, hex); - -// AuxiliaryDataSet -export const auxiliaryDataSet_free = self => () => self.free(); -export const auxiliaryDataSet_new = () => CSL.AuxiliaryDataSet.new(); -export const auxiliaryDataSet_len = self => self.len(); -export const auxiliaryDataSet_insert = self => tx_index => data => () => self.insert(tx_index, data); -export const auxiliaryDataSet_get = self => tx_index => () => self.get(tx_index); -export const auxiliaryDataSet_indices = self => () => self.indices(); - -// BaseAddress -export const baseAddress_free = self => () => self.free(); -export const baseAddress_new = network => payment => stake => CSL.BaseAddress.new(network, payment, stake); -export const baseAddress_paymentCred = self => self.payment_cred(); -export const baseAddress_stakeCred = self => self.stake_cred(); -export const baseAddress_toAddress = self => self.to_address(); -export const baseAddress_fromAddress = addr => CSL.BaseAddress.from_address(addr); - -// BigInt -export const bigInt_free = self => () => self.free(); -export const bigInt_toBytes = self => self.to_bytes(); -export const bigInt_fromBytes = bytes => errorableToPurs(CSL.BigInt.from_bytes, bytes); -export const bigInt_toHex = self => self.to_hex(); -export const bigInt_fromHex = hex_str => errorableToPurs(CSL.BigInt.from_hex, hex_str); -export const bigInt_toJson = self => self.to_json(); -export const bigInt_toJsValue = self => self.to_js_value(); -export const bigInt_fromJson = json => errorableToPurs(CSL.BigInt.from_json, json); -export const bigInt_isZero = self => self.is_zero(); -export const bigInt_asU64 = self => self.as_u64(); -export const bigInt_asInt = self => self.as_int(); -export const bigInt_fromStr = text => errorableToPurs(CSL.BigInt.from_str, text); -export const bigInt_toStr = self => self.to_str(); -export const bigInt_add = self => other => self.add(other); -export const bigInt_mul = self => other => self.mul(other); -export const bigInt_one = CSL.BigInt.one(); -export const bigInt_increment = self => self.increment(); -export const bigInt_divCeil = self => other => self.div_ceil(other); - -// BigNum -export const bigNum_free = self => () => self.free(); -export const bigNum_toBytes = self => self.to_bytes(); -export const bigNum_fromBytes = bytes => errorableToPurs(CSL.BigNum.from_bytes, bytes); -export const bigNum_toHex = self => self.to_hex(); -export const bigNum_fromHex = hex_str => errorableToPurs(CSL.BigNum.from_hex, hex_str); -export const bigNum_toJson = self => self.to_json(); -export const bigNum_toJsValue = self => self.to_js_value(); -export const bigNum_fromJson = json => errorableToPurs(CSL.BigNum.from_json, json); -export const bigNum_fromStr = string => errorableToPurs(CSL.BigNum.from_str, string); -export const bigNum_toStr = self => self.to_str(); -export const bigNum_zero = CSL.BigNum.zero(); -export const bigNum_one = CSL.BigNum.one(); -export const bigNum_isZero = self => self.is_zero(); -export const bigNum_divFloor = self => other => self.div_floor(other); -export const bigNum_checkedMul = self => other => self.checked_mul(other); -export const bigNum_checkedAdd = self => other => self.checked_add(other); -export const bigNum_checkedSub = self => other => self.checked_sub(other); -export const bigNum_clampedSub = self => other => self.clamped_sub(other); -export const bigNum_compare = self => rhs_value => self.compare(rhs_value); -export const bigNum_lessThan = self => rhs_value => self.less_than(rhs_value); -export const bigNum_max = a => b => CSL.BigNum.max(a, b); - -// Bip32PrivateKey -export const bip32PrivateKey_free = self => () => self.free(); -export const bip32PrivateKey_derive = self => index => self.derive(index); -export const bip32PrivateKey_from128Xprv = bytes => CSL.Bip32PrivateKey.from_128_xprv(bytes); -export const bip32PrivateKey_to128Xprv = self => self.to_128_xprv(); -export const bip32PrivateKey_generateEd25519Bip32 = CSL.Bip32PrivateKey.generate_ed25519_bip32(); -export const bip32PrivateKey_toRawKey = self => self.to_raw_key(); -export const bip32PrivateKey_toPublic = self => self.to_public(); -export const bip32PrivateKey_fromBytes = bytes => errorableToPurs(CSL.Bip32PrivateKey.from_bytes, bytes); -export const bip32PrivateKey_asBytes = self => self.as_bytes(); -export const bip32PrivateKey_fromBech32 = bech32_str => errorableToPurs(CSL.Bip32PrivateKey.from_bech32, bech32_str); -export const bip32PrivateKey_toBech32 = self => self.to_bech32(); -export const bip32PrivateKey_fromBip39Entropy = entropy => password => CSL.Bip32PrivateKey.from_bip39_entropy(entropy, password); -export const bip32PrivateKey_chaincode = self => self.chaincode(); -export const bip32PrivateKey_toHex = self => self.to_hex(); -export const bip32PrivateKey_fromHex = hex_str => errorableToPurs(CSL.Bip32PrivateKey.from_hex, hex_str); - -// Bip32PublicKey -export const bip32PublicKey_free = self => () => self.free(); -export const bip32PublicKey_derive = self => index => self.derive(index); -export const bip32PublicKey_toRawKey = self => self.to_raw_key(); -export const bip32PublicKey_fromBytes = bytes => errorableToPurs(CSL.Bip32PublicKey.from_bytes, bytes); -export const bip32PublicKey_asBytes = self => self.as_bytes(); -export const bip32PublicKey_fromBech32 = bech32_str => errorableToPurs(CSL.Bip32PublicKey.from_bech32, bech32_str); -export const bip32PublicKey_toBech32 = self => self.to_bech32(); -export const bip32PublicKey_chaincode = self => self.chaincode(); -export const bip32PublicKey_toHex = self => self.to_hex(); -export const bip32PublicKey_fromHex = hex_str => errorableToPurs(CSL.Bip32PublicKey.from_hex, hex_str); - -// Block -export const block_free = self => () => self.free(); -export const block_toBytes = self => self.to_bytes(); -export const block_fromBytes = bytes => errorableToPurs(CSL.Block.from_bytes, bytes); -export const block_toHex = self => self.to_hex(); -export const block_fromHex = hex_str => errorableToPurs(CSL.Block.from_hex, hex_str); -export const block_toJson = self => self.to_json(); -export const block_toJsValue = self => self.to_js_value(); -export const block_fromJson = json => errorableToPurs(CSL.Block.from_json, json); -export const block_header = self => self.header(); -export const block_txBodies = self => self.transaction_bodies(); -export const block_txWitnessSets = self => self.transaction_witness_sets(); -export const block_auxiliaryDataSet = self => self.auxiliary_data_set(); -export const block_invalidTxs = self => self.invalid_transactions(); -export const block_new = header => transaction_bodies => transaction_witness_sets => auxiliary_data_set => invalid_transactions => CSL.Block.new(header, transaction_bodies, transaction_witness_sets, auxiliary_data_set, invalid_transactions); - -// BlockHash -export const blockHash_free = self => () => self.free(); -export const blockHash_fromBytes = bytes => errorableToPurs(CSL.BlockHash.from_bytes, bytes); -export const blockHash_toBytes = self => self.to_bytes(); -export const blockHash_toBech32 = self => prefix => self.to_bech32(prefix); -export const blockHash_fromBech32 = bech_str => errorableToPurs(CSL.BlockHash.from_bech32, bech_str); -export const blockHash_toHex = self => self.to_hex(); -export const blockHash_fromHex = hex => errorableToPurs(CSL.BlockHash.from_hex, hex); - -// BootstrapWitness -export const bootstrapWitness_free = self => () => self.free(); -export const bootstrapWitness_toBytes = self => self.to_bytes(); -export const bootstrapWitness_fromBytes = bytes => errorableToPurs(CSL.BootstrapWitness.from_bytes, bytes); -export const bootstrapWitness_toHex = self => self.to_hex(); -export const bootstrapWitness_fromHex = hex_str => errorableToPurs(CSL.BootstrapWitness.from_hex, hex_str); -export const bootstrapWitness_toJson = self => self.to_json(); -export const bootstrapWitness_toJsValue = self => self.to_js_value(); -export const bootstrapWitness_fromJson = json => errorableToPurs(CSL.BootstrapWitness.from_json, json); -export const bootstrapWitness_vkey = self => self.vkey(); -export const bootstrapWitness_signature = self => self.signature(); -export const bootstrapWitness_chainCode = self => self.chain_code(); -export const bootstrapWitness_attributes = self => self.attributes(); -export const bootstrapWitness_new = vkey => signature => chain_code => attributes => CSL.BootstrapWitness.new(vkey, signature, chain_code, attributes); - -// BootstrapWitnesses -export const bootstrapWitnesses_free = self => () => self.free(); -export const bootstrapWitnesses_new = () => CSL.BootstrapWitnesses.new(); -export const bootstrapWitnesses_len = self => () => self.len(); -export const bootstrapWitnesses_get = self => index => () => self.get(index); -export const bootstrapWitnesses_add = self => elem => () => self.add(elem); - -// ByronAddress -export const byronAddress_free = self => () => self.free(); -export const byronAddress_toBase58 = self => self.to_base58(); -export const byronAddress_toBytes = self => self.to_bytes(); -export const byronAddress_fromBytes = bytes => errorableToPurs(CSL.ByronAddress.from_bytes, bytes); -export const byronAddress_byronProtocolMagic = self => self.byron_protocol_magic(); -export const byronAddress_attributes = self => self.attributes(); -export const byronAddress_networkId = self => self.network_id(); -export const byronAddress_fromBase58 = s => CSL.ByronAddress.from_base58(s); -export const byronAddress_icarusFromKey = key => protocol_magic => CSL.ByronAddress.icarus_from_key(key, protocol_magic); -export const byronAddress_isValid = s => CSL.ByronAddress.is_valid(s); -export const byronAddress_toAddress = self => self.to_address(); -export const byronAddress_fromAddress = addr => CSL.ByronAddress.from_address(addr); - -// Certificate -export const certificate_free = self => () => self.free(); -export const certificate_toBytes = self => self.to_bytes(); -export const certificate_fromBytes = bytes => errorableToPurs(CSL.Certificate.from_bytes, bytes); -export const certificate_toHex = self => self.to_hex(); -export const certificate_fromHex = hex_str => errorableToPurs(CSL.Certificate.from_hex, hex_str); -export const certificate_toJson = self => self.to_json(); -export const certificate_toJsValue = self => self.to_js_value(); -export const certificate_fromJson = json => errorableToPurs(CSL.Certificate.from_json, json); -export const certificate_newStakeRegistration = stake_registration => CSL.Certificate.new_stake_registration(stake_registration); -export const certificate_newStakeDeregistration = stake_deregistration => CSL.Certificate.new_stake_deregistration(stake_deregistration); -export const certificate_newStakeDelegation = stake_delegation => CSL.Certificate.new_stake_delegation(stake_delegation); -export const certificate_newPoolRegistration = pool_registration => CSL.Certificate.new_pool_registration(pool_registration); -export const certificate_newPoolRetirement = pool_retirement => CSL.Certificate.new_pool_retirement(pool_retirement); -export const certificate_newGenesisKeyDelegation = genesis_key_delegation => CSL.Certificate.new_genesis_key_delegation(genesis_key_delegation); -export const certificate_newMoveInstantaneousRewardsCert = move_instantaneous_rewards_cert => CSL.Certificate.new_move_instantaneous_rewards_cert(move_instantaneous_rewards_cert); -export const certificate_kind = self => self.kind(); -export const certificate_asStakeRegistration = self => self.as_stake_registration(); -export const certificate_asStakeDeregistration = self => self.as_stake_deregistration(); -export const certificate_asStakeDelegation = self => self.as_stake_delegation(); -export const certificate_asPoolRegistration = self => self.as_pool_registration(); -export const certificate_asPoolRetirement = self => self.as_pool_retirement(); -export const certificate_asGenesisKeyDelegation = self => self.as_genesis_key_delegation(); -export const certificate_asMoveInstantaneousRewardsCert = self => self.as_move_instantaneous_rewards_cert(); - -// Certificates -export const certificates_free = self => () => self.free(); -export const certificates_toBytes = self => self.to_bytes(); -export const certificates_fromBytes = bytes => errorableToPurs(CSL.Certificates.from_bytes, bytes); -export const certificates_toHex = self => self.to_hex(); -export const certificates_fromHex = hex_str => errorableToPurs(CSL.Certificates.from_hex, hex_str); -export const certificates_toJson = self => self.to_json(); -export const certificates_toJsValue = self => self.to_js_value(); -export const certificates_fromJson = json => errorableToPurs(CSL.Certificates.from_json, json); -export const certificates_new = () => CSL.Certificates.new(); -export const certificates_len = self => () => self.len(); -export const certificates_get = self => index => () => self.get(index); -export const certificates_add = self => elem => () => self.add(elem); - -// ConstrPlutusData -export const constrPlutusData_free = self => () => self.free(); -export const constrPlutusData_toBytes = self => self.to_bytes(); -export const constrPlutusData_fromBytes = bytes => errorableToPurs(CSL.ConstrPlutusData.from_bytes, bytes); -export const constrPlutusData_toHex = self => self.to_hex(); -export const constrPlutusData_fromHex = hex_str => errorableToPurs(CSL.ConstrPlutusData.from_hex, hex_str); -export const constrPlutusData_toJson = self => self.to_json(); -export const constrPlutusData_toJsValue = self => self.to_js_value(); -export const constrPlutusData_fromJson = json => errorableToPurs(CSL.ConstrPlutusData.from_json, json); -export const constrPlutusData_alternative = self => self.alternative(); -export const constrPlutusData_data = self => self.data(); -export const constrPlutusData_new = alternative => data => CSL.ConstrPlutusData.new(alternative, data); - -// CostModel -export const costModel_free = self => () => self.free(); -export const costModel_toBytes = self => self.to_bytes(); -export const costModel_fromBytes = bytes => errorableToPurs(CSL.CostModel.from_bytes, bytes); -export const costModel_toHex = self => self.to_hex(); -export const costModel_fromHex = hex_str => errorableToPurs(CSL.CostModel.from_hex, hex_str); -export const costModel_toJson = self => self.to_json(); -export const costModel_toJsValue = self => self.to_js_value(); -export const costModel_fromJson = json => errorableToPurs(CSL.CostModel.from_json, json); -export const costModel_new = () => CSL.CostModel.new(); -export const costModel_set = self => operation => cost => () => self.set(operation, cost); -export const costModel_get = self => operation => () => self.get(operation); -export const costModel_len = self => () => self.len(); - -// Costmdls -export const costmdls_free = self => () => self.free(); -export const costmdls_toBytes = self => self.to_bytes(); -export const costmdls_fromBytes = bytes => errorableToPurs(CSL.Costmdls.from_bytes, bytes); -export const costmdls_toHex = self => self.to_hex(); -export const costmdls_fromHex = hex_str => errorableToPurs(CSL.Costmdls.from_hex, hex_str); -export const costmdls_toJson = self => self.to_json(); -export const costmdls_toJsValue = self => self.to_js_value(); -export const costmdls_fromJson = json => errorableToPurs(CSL.Costmdls.from_json, json); -export const costmdls_new = () => CSL.Costmdls.new(); -export const costmdls_len = self => () => self.len(); -export const costmdls_insert = self => key => value => () => self.insert(key, value); -export const costmdls_get = self => key => () => self.get(key); -export const costmdls_keys = self => () => self.keys(); -export const costmdls_retainLanguageVersions = self => languages => self.retain_language_versions(languages); - -// DNSRecordAorAAAA -export const dnsRecordAorAAAA_free = self => () => self.free(); -export const dnsRecordAorAAAA_toBytes = self => self.to_bytes(); -export const dnsRecordAorAAAA_fromBytes = bytes => errorableToPurs(CSL.DNSRecordAorAAAA.from_bytes, bytes); -export const dnsRecordAorAAAA_toHex = self => self.to_hex(); -export const dnsRecordAorAAAA_fromHex = hex_str => errorableToPurs(CSL.DNSRecordAorAAAA.from_hex, hex_str); -export const dnsRecordAorAAAA_toJson = self => self.to_json(); -export const dnsRecordAorAAAA_toJsValue = self => self.to_js_value(); -export const dnsRecordAorAAAA_fromJson = json => errorableToPurs(CSL.DNSRecordAorAAAA.from_json, json); -export const dnsRecordAorAAAA_new = dns_name => CSL.DNSRecordAorAAAA.new(dns_name); -export const dnsRecordAorAAAA_record = self => self.record(); - -// DNSRecordSRV -export const dnsRecordSRV_free = self => () => self.free(); -export const dnsRecordSRV_toBytes = self => self.to_bytes(); -export const dnsRecordSRV_fromBytes = bytes => errorableToPurs(CSL.DNSRecordSRV.from_bytes, bytes); -export const dnsRecordSRV_toHex = self => self.to_hex(); -export const dnsRecordSRV_fromHex = hex_str => errorableToPurs(CSL.DNSRecordSRV.from_hex, hex_str); -export const dnsRecordSRV_toJson = self => self.to_json(); -export const dnsRecordSRV_toJsValue = self => self.to_js_value(); -export const dnsRecordSRV_fromJson = json => errorableToPurs(CSL.DNSRecordSRV.from_json, json); -export const dnsRecordSRV_new = dns_name => CSL.DNSRecordSRV.new(dns_name); -export const dnsRecordSRV_record = self => self.record(); - -// DataCost -export const dataCost_free = self => () => self.free(); -export const dataCost_newCoinsPerWord = coins_per_word => CSL.DataCost.new_coins_per_word(coins_per_word); -export const dataCost_newCoinsPerByte = coins_per_byte => CSL.DataCost.new_coins_per_byte(coins_per_byte); -export const dataCost_coinsPerByte = self => self.coins_per_byte(); - -// DataHash -export const dataHash_free = self => () => self.free(); -export const dataHash_fromBytes = bytes => errorableToPurs(CSL.DataHash.from_bytes, bytes); -export const dataHash_toBytes = self => self.to_bytes(); -export const dataHash_toBech32 = self => prefix => self.to_bech32(prefix); -export const dataHash_fromBech32 = bech_str => errorableToPurs(CSL.DataHash.from_bech32, bech_str); -export const dataHash_toHex = self => self.to_hex(); -export const dataHash_fromHex = hex => errorableToPurs(CSL.DataHash.from_hex, hex); - -// DatumSource -export const datumSource_free = self => () => self.free(); -export const datumSource_new = datum => CSL.DatumSource.new(datum); -export const datumSource_newRefIn = input => CSL.DatumSource.new_ref_input(input); - -// Ed25519KeyHash -export const ed25519KeyHash_free = self => () => self.free(); -export const ed25519KeyHash_fromBytes = bytes => errorableToPurs(CSL.Ed25519KeyHash.from_bytes, bytes); -export const ed25519KeyHash_toBytes = self => self.to_bytes(); -export const ed25519KeyHash_toBech32 = self => prefix => self.to_bech32(prefix); -export const ed25519KeyHash_fromBech32 = bech_str => errorableToPurs(CSL.Ed25519KeyHash.from_bech32, bech_str); -export const ed25519KeyHash_toHex = self => self.to_hex(); -export const ed25519KeyHash_fromHex = hex => errorableToPurs(CSL.Ed25519KeyHash.from_hex, hex); - -// Ed25519KeyHashes -export const ed25519KeyHashes_free = self => () => self.free(); -export const ed25519KeyHashes_toBytes = self => self.to_bytes(); -export const ed25519KeyHashes_fromBytes = bytes => errorableToPurs(CSL.Ed25519KeyHashes.from_bytes, bytes); -export const ed25519KeyHashes_toHex = self => self.to_hex(); -export const ed25519KeyHashes_fromHex = hex_str => errorableToPurs(CSL.Ed25519KeyHashes.from_hex, hex_str); -export const ed25519KeyHashes_toJson = self => self.to_json(); -export const ed25519KeyHashes_toJsValue = self => self.to_js_value(); -export const ed25519KeyHashes_fromJson = json => errorableToPurs(CSL.Ed25519KeyHashes.from_json, json); -export const ed25519KeyHashes_new = CSL.Ed25519KeyHashes.new(); -export const ed25519KeyHashes_len = self => self.len(); -export const ed25519KeyHashes_get = self => index => self.get(index); -export const ed25519KeyHashes_add = self => elem => () => self.add(elem); -export const ed25519KeyHashes_toOption = self => self.to_option(); - -// Ed25519Signature -export const ed25519Signature_free = self => () => self.free(); -export const ed25519Signature_toBytes = self => self.to_bytes(); -export const ed25519Signature_toBech32 = self => self.to_bech32(); -export const ed25519Signature_toHex = self => self.to_hex(); -export const ed25519Signature_fromBech32 = bech32_str => errorableToPurs(CSL.Ed25519Signature.from_bech32, bech32_str); -export const ed25519Signature_fromHex = input => errorableToPurs(CSL.Ed25519Signature.from_hex, input); -export const ed25519Signature_fromBytes = bytes => errorableToPurs(CSL.Ed25519Signature.from_bytes, bytes); - -// EnterpriseAddress -export const enterpriseAddress_free = self => () => self.free(); -export const enterpriseAddress_new = network => payment => CSL.EnterpriseAddress.new(network, payment); -export const enterpriseAddress_paymentCred = self => self.payment_cred(); -export const enterpriseAddress_toAddress = self => self.to_address(); -export const enterpriseAddress_fromAddress = addr => CSL.EnterpriseAddress.from_address(addr); - -// ExUnitPrices -export const exUnitPrices_free = self => () => self.free(); -export const exUnitPrices_toBytes = self => self.to_bytes(); -export const exUnitPrices_fromBytes = bytes => errorableToPurs(CSL.ExUnitPrices.from_bytes, bytes); -export const exUnitPrices_toHex = self => self.to_hex(); -export const exUnitPrices_fromHex = hex_str => errorableToPurs(CSL.ExUnitPrices.from_hex, hex_str); -export const exUnitPrices_toJson = self => self.to_json(); -export const exUnitPrices_toJsValue = self => self.to_js_value(); -export const exUnitPrices_fromJson = json => errorableToPurs(CSL.ExUnitPrices.from_json, json); -export const exUnitPrices_memPrice = self => self.mem_price(); -export const exUnitPrices_stepPrice = self => self.step_price(); -export const exUnitPrices_new = mem_price => step_price => CSL.ExUnitPrices.new(mem_price, step_price); - -// ExUnits -export const exUnits_free = self => () => self.free(); -export const exUnits_toBytes = self => self.to_bytes(); -export const exUnits_fromBytes = bytes => errorableToPurs(CSL.ExUnits.from_bytes, bytes); -export const exUnits_toHex = self => self.to_hex(); -export const exUnits_fromHex = hex_str => errorableToPurs(CSL.ExUnits.from_hex, hex_str); -export const exUnits_toJson = self => self.to_json(); -export const exUnits_toJsValue = self => self.to_js_value(); -export const exUnits_fromJson = json => errorableToPurs(CSL.ExUnits.from_json, json); -export const exUnits_mem = self => self.mem(); -export const exUnits_steps = self => self.steps(); -export const exUnits_new = mem => steps => CSL.ExUnits.new(mem, steps); - -// GeneralTransactionMetadata -export const generalTxMetadata_free = self => () => self.free(); -export const generalTxMetadata_toBytes = self => self.to_bytes(); -export const generalTxMetadata_fromBytes = bytes => errorableToPurs(CSL.GeneralTransactionMetadata.from_bytes, bytes); -export const generalTxMetadata_toHex = self => self.to_hex(); -export const generalTxMetadata_fromHex = hex_str => errorableToPurs(CSL.GeneralTransactionMetadata.from_hex, hex_str); -export const generalTxMetadata_toJson = self => self.to_json(); -export const generalTxMetadata_toJsValue = self => self.to_js_value(); -export const generalTxMetadata_fromJson = json => errorableToPurs(CSL.GeneralTransactionMetadata.from_json, json); -export const generalTxMetadata_new = () => CSL.GeneralTransactionMetadata.new(); -export const generalTxMetadata_len = self => () => self.len(); -export const generalTxMetadata_insert = self => key => value => () => self.insert(key, value); -export const generalTxMetadata_get = self => key => () => self.get(key); -export const generalTxMetadata_keys = self => () => self.keys(); - -// GenesisDelegateHash -export const genesisDelegateHash_free = self => () => self.free(); -export const genesisDelegateHash_fromBytes = bytes => errorableToPurs(CSL.GenesisDelegateHash.from_bytes, bytes); -export const genesisDelegateHash_toBytes = self => self.to_bytes(); -export const genesisDelegateHash_toBech32 = self => prefix => self.to_bech32(prefix); -export const genesisDelegateHash_fromBech32 = bech_str => errorableToPurs(CSL.GenesisDelegateHash.from_bech32, bech_str); -export const genesisDelegateHash_toHex = self => self.to_hex(); -export const genesisDelegateHash_fromHex = hex => errorableToPurs(CSL.GenesisDelegateHash.from_hex, hex); - -// GenesisHash -export const genesisHash_free = self => () => self.free(); -export const genesisHash_fromBytes = bytes => errorableToPurs(CSL.GenesisHash.from_bytes, bytes); -export const genesisHash_toBytes = self => self.to_bytes(); -export const genesisHash_toBech32 = self => prefix => self.to_bech32(prefix); -export const genesisHash_fromBech32 = bech_str => errorableToPurs(CSL.GenesisHash.from_bech32, bech_str); -export const genesisHash_toHex = self => self.to_hex(); -export const genesisHash_fromHex = hex => errorableToPurs(CSL.GenesisHash.from_hex, hex); - -// GenesisHashes -export const genesisHashes_free = self => () => self.free(); -export const genesisHashes_toBytes = self => self.to_bytes(); -export const genesisHashes_fromBytes = bytes => errorableToPurs(CSL.GenesisHashes.from_bytes, bytes); -export const genesisHashes_toHex = self => self.to_hex(); -export const genesisHashes_fromHex = hex_str => errorableToPurs(CSL.GenesisHashes.from_hex, hex_str); -export const genesisHashes_toJson = self => self.to_json(); -export const genesisHashes_toJsValue = self => self.to_js_value(); -export const genesisHashes_fromJson = json => errorableToPurs(CSL.GenesisHashes.from_json, json); -export const genesisHashes_new = () => CSL.GenesisHashes.new(); -export const genesisHashes_len = self => () => self.len(); -export const genesisHashes_get = self => index => () => self.get(index); -export const genesisHashes_add = self => elem => () => self.add(elem); - -// GenesisKeyDelegation -export const genesisKeyDelegation_free = self => () => self.free(); -export const genesisKeyDelegation_toBytes = self => self.to_bytes(); -export const genesisKeyDelegation_fromBytes = bytes => errorableToPurs(CSL.GenesisKeyDelegation.from_bytes, bytes); -export const genesisKeyDelegation_toHex = self => self.to_hex(); -export const genesisKeyDelegation_fromHex = hex_str => errorableToPurs(CSL.GenesisKeyDelegation.from_hex, hex_str); -export const genesisKeyDelegation_toJson = self => self.to_json(); -export const genesisKeyDelegation_toJsValue = self => self.to_js_value(); -export const genesisKeyDelegation_fromJson = json => errorableToPurs(CSL.GenesisKeyDelegation.from_json, json); -export const genesisKeyDelegation_genesishash = self => self.genesishash(); -export const genesisKeyDelegation_genesisDelegateHash = self => self.genesis_delegate_hash(); -export const genesisKeyDelegation_vrfKeyhash = self => self.vrf_keyhash(); -export const genesisKeyDelegation_new = genesishash => genesis_delegate_hash => vrf_keyhash => CSL.GenesisKeyDelegation.new(genesishash, genesis_delegate_hash, vrf_keyhash); - -// Header -export const header_free = self => () => self.free(); -export const header_toBytes = self => self.to_bytes(); -export const header_fromBytes = bytes => errorableToPurs(CSL.Header.from_bytes, bytes); -export const header_toHex = self => self.to_hex(); -export const header_fromHex = hex_str => errorableToPurs(CSL.Header.from_hex, hex_str); -export const header_toJson = self => self.to_json(); -export const header_toJsValue = self => self.to_js_value(); -export const header_fromJson = json => errorableToPurs(CSL.Header.from_json, json); -export const header_headerBody = self => self.header_body(); -export const header_bodySignature = self => self.body_signature(); -export const header_new = header_body => body_signature => CSL.Header.new(header_body, body_signature); - -// HeaderBody -export const headerBody_free = self => () => self.free(); -export const headerBody_toBytes = self => self.to_bytes(); -export const headerBody_fromBytes = bytes => errorableToPurs(CSL.HeaderBody.from_bytes, bytes); -export const headerBody_toHex = self => self.to_hex(); -export const headerBody_fromHex = hex_str => errorableToPurs(CSL.HeaderBody.from_hex, hex_str); -export const headerBody_toJson = self => self.to_json(); -export const headerBody_toJsValue = self => self.to_js_value(); -export const headerBody_fromJson = json => errorableToPurs(CSL.HeaderBody.from_json, json); -export const headerBody_blockNumber = self => self.block_number(); -export const headerBody_slot = self => self.slot(); -export const headerBody_slotBignum = self => self.slot_bignum(); -export const headerBody_prevHash = self => self.prev_hash(); -export const headerBody_issuerVkey = self => self.issuer_vkey(); -export const headerBody_vrfVkey = self => self.vrf_vkey(); -export const headerBody_hasNonceAndLeaderVrf = self => self.has_nonce_and_leader_vrf(); -export const headerBody_nonceVrfOrNothing = self => self.nonce_vrf_or_nothing(); -export const headerBody_leaderVrfOrNothing = self => self.leader_vrf_or_nothing(); -export const headerBody_hasVrfResult = self => self.has_vrf_result(); -export const headerBody_vrfResultOrNothing = self => self.vrf_result_or_nothing(); -export const headerBody_blockBodySize = self => self.block_body_size(); -export const headerBody_blockBodyHash = self => self.block_body_hash(); -export const headerBody_operationalCert = self => self.operational_cert(); -export const headerBody_protocolVersion = self => self.protocol_version(); -export const headerBody_new = block_number => slot => prev_hash => issuer_vkey => vrf_vkey => vrf_result => block_body_size => block_body_hash => operational_cert => protocol_version => CSL.HeaderBody.new(block_number, slot, prev_hash, issuer_vkey, vrf_vkey, vrf_result, block_body_size, block_body_hash, operational_cert, protocol_version); -export const headerBody_newHeaderbody = block_number => slot => prev_hash => issuer_vkey => vrf_vkey => vrf_result => block_body_size => block_body_hash => operational_cert => protocol_version => CSL.HeaderBody.new_headerbody(block_number, slot, prev_hash, issuer_vkey, vrf_vkey, vrf_result, block_body_size, block_body_hash, operational_cert, protocol_version); - -// Int -export const int_free = self => () => self.free(); -export const int_toBytes = self => self.to_bytes(); -export const int_fromBytes = bytes => errorableToPurs(CSL.Int.from_bytes, bytes); -export const int_toHex = self => self.to_hex(); -export const int_fromHex = hex_str => errorableToPurs(CSL.Int.from_hex, hex_str); -export const int_toJson = self => self.to_json(); -export const int_toJsValue = self => self.to_js_value(); -export const int_fromJson = json => errorableToPurs(CSL.Int.from_json, json); -export const int_new = x => CSL.Int.new(x); -export const int_newNegative = x => CSL.Int.new_negative(x); -export const int_newI32 = x => CSL.Int.new_i32(x); -export const int_isPositive = self => self.is_positive(); -export const int_asPositive = self => self.as_positive(); -export const int_asNegative = self => self.as_negative(); -export const int_asI32 = self => self.as_i32(); -export const int_asI32OrNothing = self => self.as_i32_or_nothing(); -export const int_asI32OrFail = self => self.as_i32_or_fail(); -export const int_toStr = self => self.to_str(); -export const int_fromStr = string => errorableToPurs(CSL.Int.from_str, string); - -// Ipv4 -export const ipv4_free = self => () => self.free(); -export const ipv4_toBytes = self => self.to_bytes(); -export const ipv4_fromBytes = bytes => errorableToPurs(CSL.Ipv4.from_bytes, bytes); -export const ipv4_toHex = self => self.to_hex(); -export const ipv4_fromHex = hex_str => errorableToPurs(CSL.Ipv4.from_hex, hex_str); -export const ipv4_toJson = self => self.to_json(); -export const ipv4_toJsValue = self => self.to_js_value(); -export const ipv4_fromJson = json => errorableToPurs(CSL.Ipv4.from_json, json); -export const ipv4_new = data => CSL.Ipv4.new(data); -export const ipv4_ip = self => self.ip(); - -// Ipv6 -export const ipv6_free = self => () => self.free(); -export const ipv6_toBytes = self => self.to_bytes(); -export const ipv6_fromBytes = bytes => errorableToPurs(CSL.Ipv6.from_bytes, bytes); -export const ipv6_toHex = self => self.to_hex(); -export const ipv6_fromHex = hex_str => errorableToPurs(CSL.Ipv6.from_hex, hex_str); -export const ipv6_toJson = self => self.to_json(); -export const ipv6_toJsValue = self => self.to_js_value(); -export const ipv6_fromJson = json => errorableToPurs(CSL.Ipv6.from_json, json); -export const ipv6_new = data => CSL.Ipv6.new(data); -export const ipv6_ip = self => self.ip(); - -// KESSignature -export const kesSignature_free = self => () => self.free(); -export const kesSignature_toBytes = self => self.to_bytes(); -export const kesSignature_fromBytes = bytes => errorableToPurs(CSL.KESSignature.from_bytes, bytes); - -// KESVKey -export const kesvKey_free = self => () => self.free(); -export const kesvKey_fromBytes = bytes => errorableToPurs(CSL.KESVKey.from_bytes, bytes); -export const kesvKey_toBytes = self => self.to_bytes(); -export const kesvKey_toBech32 = self => prefix => self.to_bech32(prefix); -export const kesvKey_fromBech32 = bech_str => errorableToPurs(CSL.KESVKey.from_bech32, bech_str); -export const kesvKey_toHex = self => self.to_hex(); -export const kesvKey_fromHex = hex => errorableToPurs(CSL.KESVKey.from_hex, hex); - -// Language -export const language_free = self => () => self.free(); -export const language_toBytes = self => self.to_bytes(); -export const language_fromBytes = bytes => errorableToPurs(CSL.Language.from_bytes, bytes); -export const language_toHex = self => self.to_hex(); -export const language_fromHex = hex_str => errorableToPurs(CSL.Language.from_hex, hex_str); -export const language_toJson = self => self.to_json(); -export const language_toJsValue = self => self.to_js_value(); -export const language_fromJson = json => errorableToPurs(CSL.Language.from_json, json); -export const language_newPlutusV1 = CSL.Language.new_plutus_v1(); -export const language_newPlutusV2 = CSL.Language.new_plutus_v2(); -export const language_kind = self => self.kind(); - -// Languages -export const languages_free = self => () => self.free(); -export const languages_new = () => CSL.Languages.new(); -export const languages_len = self => () => self.len(); -export const languages_get = self => index => () => self.get(index); -export const languages_add = self => elem => () => self.add(elem); - -// LegacyDaedalusPrivateKey -export const legacyDaedalusPrivateKey_free = self => () => self.free(); -export const legacyDaedalusPrivateKey_fromBytes = bytes => errorableToPurs(CSL.LegacyDaedalusPrivateKey.from_bytes, bytes); -export const legacyDaedalusPrivateKey_asBytes = self => self.as_bytes(); -export const legacyDaedalusPrivateKey_chaincode = self => self.chaincode(); - -// LinearFee -export const linearFee_free = self => () => self.free(); -export const linearFee_constant = self => self.constant(); -export const linearFee_coefficient = self => self.coefficient(); -export const linearFee_new = coefficient => constant => CSL.LinearFee.new(coefficient, constant); - -// MIRToStakeCredentials -export const mirToStakeCredentials_free = self => () => self.free(); -export const mirToStakeCredentials_toBytes = self => self.to_bytes(); -export const mirToStakeCredentials_fromBytes = bytes => errorableToPurs(CSL.MIRToStakeCredentials.from_bytes, bytes); -export const mirToStakeCredentials_toHex = self => self.to_hex(); -export const mirToStakeCredentials_fromHex = hex_str => errorableToPurs(CSL.MIRToStakeCredentials.from_hex, hex_str); -export const mirToStakeCredentials_toJson = self => self.to_json(); -export const mirToStakeCredentials_toJsValue = self => self.to_js_value(); -export const mirToStakeCredentials_fromJson = json => errorableToPurs(CSL.MIRToStakeCredentials.from_json, json); -export const mirToStakeCredentials_new = () => CSL.MIRToStakeCredentials.new(); -export const mirToStakeCredentials_len = self => () => self.len(); -export const mirToStakeCredentials_insert = self => cred => delta => () => self.insert(cred, delta); -export const mirToStakeCredentials_get = self => cred => () => self.get(cred); -export const mirToStakeCredentials_keys = self => () => self.keys(); - -// MetadataList -export const metadataList_free = self => () => self.free(); -export const metadataList_toBytes = self => self.to_bytes(); -export const metadataList_fromBytes = bytes => errorableToPurs(CSL.MetadataList.from_bytes, bytes); -export const metadataList_toHex = self => self.to_hex(); -export const metadataList_fromHex = hex_str => errorableToPurs(CSL.MetadataList.from_hex, hex_str); -export const metadataList_new = () => CSL.MetadataList.new(); -export const metadataList_len = self => () => self.len(); -export const metadataList_get = self => index => () => self.get(index); -export const metadataList_add = self => elem => () => self.add(elem); - -// MetadataMap -export const metadataMap_free = self => () => self.free(); -export const metadataMap_toBytes = self => self.to_bytes(); -export const metadataMap_fromBytes = bytes => errorableToPurs(CSL.MetadataMap.from_bytes, bytes); -export const metadataMap_toHex = self => self.to_hex(); -export const metadataMap_fromHex = hex_str => errorableToPurs(CSL.MetadataMap.from_hex, hex_str); -export const metadataMap_new = () => CSL.MetadataMap.new(); -export const metadataMap_len = self => self.len(); -export const metadataMap_insert = self => key => value => () => self.insert(key, value); -export const metadataMap_insertStr = self => key => value => () => self.insert_str(key, value); -export const metadataMap_insertI32 = self => key => value => () => self.insert_i32(key, value); -export const metadataMap_get = self => key => () => self.get(key); -export const metadataMap_getStr = self => key => () => self.get_str(key); -export const metadataMap_getI32 = self => key => () => self.get_i32(key); -export const metadataMap_has = self => key => () => self.has(key); -export const metadataMap_keys = self => () => self.keys(); - -// Mint -export const mint_free = self => () => self.free(); -export const mint_toBytes = self => self.to_bytes(); -export const mint_fromBytes = bytes => errorableToPurs(CSL.Mint.from_bytes, bytes); -export const mint_toHex = self => self.to_hex(); -export const mint_fromHex = hex_str => errorableToPurs(CSL.Mint.from_hex, hex_str); -export const mint_toJson = self => self.to_json(); -export const mint_toJsValue = self => self.to_js_value(); -export const mint_fromJson = json => errorableToPurs(CSL.Mint.from_json, json); -export const mint_new = () => CSL.Mint.new(); -export const mint_newFromEntry = key => value => () => CSL.Mint.new_from_entry(key, value); -export const mint_len = self => () => self.len(); -export const mint_insert = self => key => value => () => self.insert(key, value); -export const mint_get = self => key => () => self.get(key); -export const mint_keys = self => () => self.keys(); -export const mint_asPositiveMultiasset = self => () => self.as_positive_multiasset(); -export const mint_asNegativeMultiasset = self => () => self.as_negative_multiasset(); - -// MintAssets -export const mintAssets_free = self => () => self.free(); -export const mintAssets_new = () => CSL.MintAssets.new(); -export const mintAssets_newFromEntry = key => value => CSL.MintAssets.new_from_entry(key, value); -export const mintAssets_len = self => () => self.len(); -export const mintAssets_insert = self => key => value => () => self.insert(key, value); -export const mintAssets_get = self => key => () => self.get(key); -export const mintAssets_keys = self => () => self.keys(); - -// MoveInstantaneousReward -export const moveInstantaneousReward_free = self => () => self.free(); -export const moveInstantaneousReward_toBytes = self => self.to_bytes(); -export const moveInstantaneousReward_fromBytes = bytes => errorableToPurs(CSL.MoveInstantaneousReward.from_bytes, bytes); -export const moveInstantaneousReward_toHex = self => self.to_hex(); -export const moveInstantaneousReward_fromHex = hex_str => errorableToPurs(CSL.MoveInstantaneousReward.from_hex, hex_str); -export const moveInstantaneousReward_toJson = self => self.to_json(); -export const moveInstantaneousReward_toJsValue = self => self.to_js_value(); -export const moveInstantaneousReward_fromJson = json => errorableToPurs(CSL.MoveInstantaneousReward.from_json, json); -export const moveInstantaneousReward_newToOtherPot = pot => amount => CSL.MoveInstantaneousReward.new_to_other_pot(pot, amount); -export const moveInstantaneousReward_newToStakeCreds = pot => amounts => CSL.MoveInstantaneousReward.new_to_stake_creds(pot, amounts); -export const moveInstantaneousReward_pot = self => self.pot(); -export const moveInstantaneousReward_kind = self => self.kind(); -export const moveInstantaneousReward_asToOtherPot = self => self.as_to_other_pot(); -export const moveInstantaneousReward_asToStakeCreds = self => self.as_to_stake_creds(); - -// MoveInstantaneousRewardsCert -export const moveInstantaneousRewardsCert_free = self => () => self.free(); -export const moveInstantaneousRewardsCert_toBytes = self => self.to_bytes(); -export const moveInstantaneousRewardsCert_fromBytes = bytes => errorableToPurs(CSL.MoveInstantaneousRewardsCert.from_bytes, bytes); -export const moveInstantaneousRewardsCert_toHex = self => self.to_hex(); -export const moveInstantaneousRewardsCert_fromHex = hex_str => errorableToPurs(CSL.MoveInstantaneousRewardsCert.from_hex, hex_str); -export const moveInstantaneousRewardsCert_toJson = self => self.to_json(); -export const moveInstantaneousRewardsCert_toJsValue = self => self.to_js_value(); -export const moveInstantaneousRewardsCert_fromJson = json => errorableToPurs(CSL.MoveInstantaneousRewardsCert.from_json, json); -export const moveInstantaneousRewardsCert_moveInstantaneousReward = self => self.move_instantaneous_reward(); -export const moveInstantaneousRewardsCert_new = move_instantaneous_reward => CSL.MoveInstantaneousRewardsCert.new(move_instantaneous_reward); - -// MultiAsset -export const multiAsset_free = self => () => self.free(); -export const multiAsset_toBytes = self => self.to_bytes(); -export const multiAsset_fromBytes = bytes => errorableToPurs(CSL.MultiAsset.from_bytes, bytes); -export const multiAsset_toHex = self => self.to_hex(); -export const multiAsset_fromHex = hex_str => errorableToPurs(CSL.MultiAsset.from_hex, hex_str); -export const multiAsset_toJson = self => self.to_json(); -export const multiAsset_toJsValue = self => self.to_js_value(); -export const multiAsset_fromJson = json => errorableToPurs(CSL.MultiAsset.from_json, json); -export const multiAsset_new = () => CSL.MultiAsset.new(); -export const multiAsset_len = self => () => self.len(); -export const multiAsset_insert = self => policy_id => assets => self.insert(policy_id, assets); -export const multiAsset_get = self => policy_id => () => self.get(policy_id); -export const multiAsset_setAsset = self => policy_id => asset_name => value => () => self.set_asset(policy_id, asset_name, value); -export const multiAsset_getAsset = self => policy_id => asset_name => () => self.get_asset(policy_id, asset_name); -export const multiAsset_keys = self => () => self.keys(); -export const multiAsset_sub = self => rhs_ma => () => self.sub(rhs_ma); - -// MultiHostName -export const multiHostName_free = self => () => self.free(); -export const multiHostName_toBytes = self => self.to_bytes(); -export const multiHostName_fromBytes = bytes => errorableToPurs(CSL.MultiHostName.from_bytes, bytes); -export const multiHostName_toHex = self => self.to_hex(); -export const multiHostName_fromHex = hex_str => errorableToPurs(CSL.MultiHostName.from_hex, hex_str); -export const multiHostName_toJson = self => self.to_json(); -export const multiHostName_toJsValue = self => self.to_js_value(); -export const multiHostName_fromJson = json => errorableToPurs(CSL.MultiHostName.from_json, json); -export const multiHostName_dnsName = self => self.dns_name(); -export const multiHostName_new = dns_name => CSL.MultiHostName.new(dns_name); - -// NativeScript -export const nativeScript_free = self => () => self.free(); -export const nativeScript_toBytes = self => self.to_bytes(); -export const nativeScript_fromBytes = bytes => errorableToPurs(CSL.NativeScript.from_bytes, bytes); -export const nativeScript_toHex = self => self.to_hex(); -export const nativeScript_fromHex = hex_str => errorableToPurs(CSL.NativeScript.from_hex, hex_str); -export const nativeScript_toJson = self => self.to_json(); -export const nativeScript_toJsValue = self => self.to_js_value(); -export const nativeScript_fromJson = json => errorableToPurs(CSL.NativeScript.from_json, json); -export const nativeScript_hash = self => self.hash(); -export const nativeScript_newScriptPubkey = script_pubkey => CSL.NativeScript.new_script_pubkey(script_pubkey); -export const nativeScript_newScriptAll = script_all => CSL.NativeScript.new_script_all(script_all); -export const nativeScript_newScriptAny = script_any => CSL.NativeScript.new_script_any(script_any); -export const nativeScript_newScriptNOfK = script_n_of_k => CSL.NativeScript.new_script_n_of_k(script_n_of_k); -export const nativeScript_newTimelockStart = timelock_start => CSL.NativeScript.new_timelock_start(timelock_start); -export const nativeScript_newTimelockExpiry = timelock_expiry => CSL.NativeScript.new_timelock_expiry(timelock_expiry); -export const nativeScript_kind = self => self.kind(); -export const nativeScript_asScriptPubkey = self => self.as_script_pubkey(); -export const nativeScript_asScriptAll = self => self.as_script_all(); -export const nativeScript_asScriptAny = self => self.as_script_any(); -export const nativeScript_asScriptNOfK = self => self.as_script_n_of_k(); -export const nativeScript_asTimelockStart = self => self.as_timelock_start(); -export const nativeScript_asTimelockExpiry = self => self.as_timelock_expiry(); -export const nativeScript_getRequiredSigners = self => self.get_required_signers(); - -// NativeScripts -export const nativeScripts_free = self => () => self.free(); -export const nativeScripts_new = () => CSL.NativeScripts.new(); -export const nativeScripts_len = self => () => self.len(); -export const nativeScripts_get = self => index => () => self.get(index); -export const nativeScripts_add = self => elem => () => self.add(elem); - -// NetworkId -export const networkId_free = self => () => self.free(); -export const networkId_toBytes = self => self.to_bytes(); -export const networkId_fromBytes = bytes => errorableToPurs(CSL.NetworkId.from_bytes, bytes); -export const networkId_toHex = self => self.to_hex(); -export const networkId_fromHex = hex_str => errorableToPurs(CSL.NetworkId.from_hex, hex_str); -export const networkId_toJson = self => self.to_json(); -export const networkId_toJsValue = self => self.to_js_value(); -export const networkId_fromJson = json => errorableToPurs(CSL.NetworkId.from_json, json); -export const networkId_testnet = CSL.NetworkId.testnet(); -export const networkId_mainnet = CSL.NetworkId.mainnet(); -export const networkId_kind = self => self.kind(); - -// NetworkInfo -export const networkInfo_free = self => () => self.free(); -export const networkInfo_new = network_id => protocol_magic => CSL.NetworkInfo.new(network_id, protocol_magic); -export const networkInfo_networkId = self => self.network_id(); -export const networkInfo_protocolMagic = self => self.protocol_magic(); -export const networkInfo_testnet = CSL.NetworkInfo.testnet(); -export const networkInfo_mainnet = CSL.NetworkInfo.mainnet(); - -// Nonce -export const nonce_free = self => () => self.free(); -export const nonce_toBytes = self => self.to_bytes(); -export const nonce_fromBytes = bytes => errorableToPurs(CSL.Nonce.from_bytes, bytes); -export const nonce_toHex = self => self.to_hex(); -export const nonce_fromHex = hex_str => errorableToPurs(CSL.Nonce.from_hex, hex_str); -export const nonce_toJson = self => self.to_json(); -export const nonce_toJsValue = self => self.to_js_value(); -export const nonce_fromJson = json => errorableToPurs(CSL.Nonce.from_json, json); -export const nonce_newIdentity = CSL.Nonce.new_identity(); -export const nonce_newFromHash = hash => CSL.Nonce.new_from_hash(hash); -export const nonce_getHash = self => self.get_hash(); - -// OperationalCert -export const operationalCert_free = self => () => self.free(); -export const operationalCert_toBytes = self => self.to_bytes(); -export const operationalCert_fromBytes = bytes => errorableToPurs(CSL.OperationalCert.from_bytes, bytes); -export const operationalCert_toHex = self => self.to_hex(); -export const operationalCert_fromHex = hex_str => errorableToPurs(CSL.OperationalCert.from_hex, hex_str); -export const operationalCert_toJson = self => self.to_json(); -export const operationalCert_toJsValue = self => self.to_js_value(); -export const operationalCert_fromJson = json => errorableToPurs(CSL.OperationalCert.from_json, json); -export const operationalCert_hotVkey = self => self.hot_vkey(); -export const operationalCert_sequenceNumber = self => self.sequence_number(); -export const operationalCert_kesPeriod = self => self.kes_period(); -export const operationalCert_sigma = self => self.sigma(); -export const operationalCert_new = hot_vkey => sequence_number => kes_period => sigma => CSL.OperationalCert.new(hot_vkey, sequence_number, kes_period, sigma); - -// PlutusData -export const plutusData_free = self => () => self.free(); -export const plutusData_toBytes = self => self.to_bytes(); -export const plutusData_fromBytes = bytes => errorableToPurs(CSL.PlutusData.from_bytes, bytes); -export const plutusData_toHex = self => self.to_hex(); -export const plutusData_fromHex = hex_str => errorableToPurs(CSL.PlutusData.from_hex, hex_str); -export const plutusData_toJson = self => self.to_json(); -export const plutusData_toJsValue = self => self.to_js_value(); -export const plutusData_fromJson = json => errorableToPurs(CSL.PlutusData.from_json, json); -export const plutusData_newConstrPlutusData = constr_plutus_data => CSL.PlutusData.new_constr_plutus_data(constr_plutus_data); -export const plutusData_newEmptyConstrPlutusData = alternative => CSL.PlutusData.new_empty_constr_plutus_data(alternative); -export const plutusData_newMap = map => CSL.PlutusData.new_map(map); -export const plutusData_newList = list => CSL.PlutusData.new_list(list); -export const plutusData_newInteger = integer => CSL.PlutusData.new_integer(integer); -export const plutusData_newBytes = bytes => CSL.PlutusData.new_bytes(bytes); -export const plutusData_kind = self => self.kind(); -export const plutusData_asConstrPlutusData = self => self.as_constr_plutus_data(); -export const plutusData_asMap = self => self.as_map(); -export const plutusData_asList = self => self.as_list(); -export const plutusData_asInteger = self => self.as_integer(); -export const plutusData_asBytes = self => self.as_bytes(); - -// PlutusList -export const plutusList_free = self => () => self.free(); -export const plutusList_toBytes = self => self.to_bytes(); -export const plutusList_fromBytes = bytes => errorableToPurs(CSL.PlutusList.from_bytes, bytes); -export const plutusList_toHex = self => self.to_hex(); -export const plutusList_fromHex = hex_str => errorableToPurs(CSL.PlutusList.from_hex, hex_str); -export const plutusList_toJson = self => self.to_json(); -export const plutusList_toJsValue = self => self.to_js_value(); -export const plutusList_fromJson = json => errorableToPurs(CSL.PlutusList.from_json, json); -export const plutusList_new = () => CSL.PlutusList.new(); -export const plutusList_len = self => () => self.len(); -export const plutusList_get = self => index => () => self.get(index); -export const plutusList_add = self => elem => () => self.add(elem); - -// PlutusMap -export const plutusMap_free = self => () => self.free(); -export const plutusMap_toBytes = self => self.to_bytes(); -export const plutusMap_fromBytes = bytes => errorableToPurs(CSL.PlutusMap.from_bytes, bytes); -export const plutusMap_toHex = self => self.to_hex(); -export const plutusMap_fromHex = hex_str => errorableToPurs(CSL.PlutusMap.from_hex, hex_str); -export const plutusMap_toJson = self => self.to_json(); -export const plutusMap_toJsValue = self => self.to_js_value(); -export const plutusMap_fromJson = json => errorableToPurs(CSL.PlutusMap.from_json, json); -export const plutusMap_new = () => CSL.PlutusMap.new(); -export const plutusMap_len = self => () => self.len(); -export const plutusMap_insert = self => key => value => () => self.insert(key, value); -export const plutusMap_get = self => key => () => self.get(key); -export const plutusMap_keys = self => () => self.keys(); - -// PlutusScript -export const plutusScript_free = self => () => self.free(); -export const plutusScript_toBytes = self => self.to_bytes(); -export const plutusScript_fromBytes = bytes => errorableToPurs(CSL.PlutusScript.from_bytes, bytes); -export const plutusScript_toHex = self => self.to_hex(); -export const plutusScript_fromHex = hex_str => errorableToPurs(CSL.PlutusScript.from_hex, hex_str); -export const plutusScript_new = bytes => CSL.PlutusScript.new(bytes); -export const plutusScript_newV2 = bytes => CSL.PlutusScript.new_v2(bytes); -export const plutusScript_newWithVersion = bytes => language => CSL.PlutusScript.new_with_version(bytes, language); -export const plutusScript_bytes = self => self.bytes(); -export const plutusScript_fromBytesV2 = bytes => CSL.PlutusScript.from_bytes_v2(bytes); -export const plutusScript_fromBytesWithVersion = bytes => language => CSL.PlutusScript.from_bytes_with_version(bytes, language); -export const plutusScript_hash = self => self.hash(); -export const plutusScript_languageVersion = self => self.language_version(); - -// PlutusScriptSource -export const plutusScriptSource_free = self => () => self.free(); -export const plutusScriptSource_new = script => CSL.PlutusScriptSource.new(script); -export const plutusScriptSource_newRefIn = script_hash => input => CSL.PlutusScriptSource.new_ref_input(script_hash, input); - -// PlutusScripts -export const plutusScripts_free = self => () => self.free(); -export const plutusScripts_toBytes = self => self.to_bytes(); -export const plutusScripts_fromBytes = bytes => errorableToPurs(CSL.PlutusScripts.from_bytes, bytes); -export const plutusScripts_toHex = self => self.to_hex(); -export const plutusScripts_fromHex = hex_str => errorableToPurs(CSL.PlutusScripts.from_hex, hex_str); -export const plutusScripts_toJson = self => self.to_json(); -export const plutusScripts_toJsValue = self => self.to_js_value(); -export const plutusScripts_fromJson = json => errorableToPurs(CSL.PlutusScripts.from_json, json); -export const plutusScripts_new = () => CSL.PlutusScripts.new(); -export const plutusScripts_len = self => () => self.len(); -export const plutusScripts_get = self => index => () => self.get(index); -export const plutusScripts_add = self => elem => () => self.add(elem); - -// PlutusWitness -export const plutusWitness_free = self => () => self.free(); -export const plutusWitness_new = script => datum => redeemer => CSL.PlutusWitness.new(script, datum, redeemer); -export const plutusWitness_newWithRef = script => datum => redeemer => CSL.PlutusWitness.new_with_ref(script, datum, redeemer); -export const plutusWitness_script = self => self.script(); -export const plutusWitness_datum = self => self.datum(); -export const plutusWitness_redeemer = self => self.redeemer(); - -// PlutusWitnesses -export const plutusWitnesses_free = self => () => self.free(); -export const plutusWitnesses_new = () => CSL.PlutusWitnesses.new(); -export const plutusWitnesses_len = self => () => self.len(); -export const plutusWitnesses_get = self => index => () => self.get(index); -export const plutusWitnesses_add = self => elem => () => self.add(elem); - -// Pointer -export const pointer_free = self => () => self.free(); -export const pointer_new = slot => tx_index => cert_index => CSL.Pointer.new(slot, tx_index, cert_index); -export const pointer_newPointer = slot => tx_index => cert_index => CSL.Pointer.new_pointer(slot, tx_index, cert_index); -export const pointer_slot = self => self.slot(); -export const pointer_txIndex = self => self.tx_index(); -export const pointer_certIndex = self => self.cert_index(); -export const pointer_slotBignum = self => self.slot_bignum(); -export const pointer_txIndexBignum = self => self.tx_index_bignum(); -export const pointer_certIndexBignum = self => self.cert_index_bignum(); - -// PointerAddress -export const pointerAddress_free = self => () => self.free(); -export const pointerAddress_new = network => payment => stake => CSL.PointerAddress.new(network, payment, stake); -export const pointerAddress_paymentCred = self => self.payment_cred(); -export const pointerAddress_stakePointer = self => self.stake_pointer(); -export const pointerAddress_toAddress = self => self.to_address(); -export const pointerAddress_fromAddress = addr => CSL.PointerAddress.from_address(addr); - -// PoolMetadata -export const poolMetadata_free = self => () => self.free(); -export const poolMetadata_toBytes = self => self.to_bytes(); -export const poolMetadata_fromBytes = bytes => errorableToPurs(CSL.PoolMetadata.from_bytes, bytes); -export const poolMetadata_toHex = self => self.to_hex(); -export const poolMetadata_fromHex = hex_str => errorableToPurs(CSL.PoolMetadata.from_hex, hex_str); -export const poolMetadata_toJson = self => self.to_json(); -export const poolMetadata_toJsValue = self => self.to_js_value(); -export const poolMetadata_fromJson = json => errorableToPurs(CSL.PoolMetadata.from_json, json); -export const poolMetadata_url = self => self.url(); -export const poolMetadata_poolMetadataHash = self => self.pool_metadata_hash(); -export const poolMetadata_new = url => pool_metadata_hash => CSL.PoolMetadata.new(url, pool_metadata_hash); - -// PoolMetadataHash -export const poolMetadataHash_free = self => () => self.free(); -export const poolMetadataHash_fromBytes = bytes => errorableToPurs(CSL.PoolMetadataHash.from_bytes, bytes); -export const poolMetadataHash_toBytes = self => self.to_bytes(); -export const poolMetadataHash_toBech32 = self => prefix => self.to_bech32(prefix); -export const poolMetadataHash_fromBech32 = bech_str => errorableToPurs(CSL.PoolMetadataHash.from_bech32, bech_str); -export const poolMetadataHash_toHex = self => self.to_hex(); -export const poolMetadataHash_fromHex = hex => errorableToPurs(CSL.PoolMetadataHash.from_hex, hex); - -// PoolParams -export const poolParams_free = self => () => self.free(); -export const poolParams_toBytes = self => self.to_bytes(); -export const poolParams_fromBytes = bytes => errorableToPurs(CSL.PoolParams.from_bytes, bytes); -export const poolParams_toHex = self => self.to_hex(); -export const poolParams_fromHex = hex_str => errorableToPurs(CSL.PoolParams.from_hex, hex_str); -export const poolParams_toJson = self => self.to_json(); -export const poolParams_toJsValue = self => self.to_js_value(); -export const poolParams_fromJson = json => errorableToPurs(CSL.PoolParams.from_json, json); -export const poolParams_operator = self => self.operator(); -export const poolParams_vrfKeyhash = self => self.vrf_keyhash(); -export const poolParams_pledge = self => self.pledge(); -export const poolParams_cost = self => self.cost(); -export const poolParams_margin = self => self.margin(); -export const poolParams_rewardAccount = self => self.reward_account(); -export const poolParams_poolOwners = self => self.pool_owners(); -export const poolParams_relays = self => self.relays(); -export const poolParams_poolMetadata = self => self.pool_metadata(); -export const poolParams_new = operator => vrf_keyhash => pledge => cost => margin => reward_account => pool_owners => relays => pool_metadata => CSL.PoolParams.new(operator, vrf_keyhash, pledge, cost, margin, reward_account, pool_owners, relays, pool_metadata); - -// PoolRegistration -export const poolRegistration_free = self => () => self.free(); -export const poolRegistration_toBytes = self => self.to_bytes(); -export const poolRegistration_fromBytes = bytes => errorableToPurs(CSL.PoolRegistration.from_bytes, bytes); -export const poolRegistration_toHex = self => self.to_hex(); -export const poolRegistration_fromHex = hex_str => errorableToPurs(CSL.PoolRegistration.from_hex, hex_str); -export const poolRegistration_toJson = self => self.to_json(); -export const poolRegistration_toJsValue = self => self.to_js_value(); -export const poolRegistration_fromJson = json => errorableToPurs(CSL.PoolRegistration.from_json, json); -export const poolRegistration_poolParams = self => self.pool_params(); -export const poolRegistration_new = pool_params => CSL.PoolRegistration.new(pool_params); - -// PoolRetirement -export const poolRetirement_free = self => () => self.free(); -export const poolRetirement_toBytes = self => self.to_bytes(); -export const poolRetirement_fromBytes = bytes => errorableToPurs(CSL.PoolRetirement.from_bytes, bytes); -export const poolRetirement_toHex = self => self.to_hex(); -export const poolRetirement_fromHex = hex_str => errorableToPurs(CSL.PoolRetirement.from_hex, hex_str); -export const poolRetirement_toJson = self => self.to_json(); -export const poolRetirement_toJsValue = self => self.to_js_value(); -export const poolRetirement_fromJson = json => errorableToPurs(CSL.PoolRetirement.from_json, json); -export const poolRetirement_poolKeyhash = self => self.pool_keyhash(); -export const poolRetirement_epoch = self => self.epoch(); -export const poolRetirement_new = pool_keyhash => epoch => CSL.PoolRetirement.new(pool_keyhash, epoch); - -// PrivateKey -export const privateKey_free = self => () => self.free(); -export const privateKey_toPublic = self => self.to_public(); -export const privateKey_generateEd25519 = CSL.PrivateKey.generate_ed25519(); -export const privateKey_generateEd25519extended = CSL.PrivateKey.generate_ed25519extended(); -export const privateKey_fromBech32 = bech32_str => errorableToPurs(CSL.PrivateKey.from_bech32, bech32_str); -export const privateKey_toBech32 = self => self.to_bech32(); -export const privateKey_asBytes = self => self.as_bytes(); -export const privateKey_fromExtendedBytes = bytes => CSL.PrivateKey.from_extended_bytes(bytes); -export const privateKey_fromNormalBytes = bytes => CSL.PrivateKey.from_normal_bytes(bytes); -export const privateKey_sign = self => message => self.sign(message); -export const privateKey_toHex = self => self.to_hex(); -export const privateKey_fromHex = hex_str => errorableToPurs(CSL.PrivateKey.from_hex, hex_str); - -// ProposedProtocolParameterUpdates -export const proposedProtocolParameterUpdates_free = self => () => self.free(); -export const proposedProtocolParameterUpdates_toBytes = self => self.to_bytes(); -export const proposedProtocolParameterUpdates_fromBytes = bytes => errorableToPurs(CSL.ProposedProtocolParameterUpdates.from_bytes, bytes); -export const proposedProtocolParameterUpdates_toHex = self => self.to_hex(); -export const proposedProtocolParameterUpdates_fromHex = hex_str => errorableToPurs(CSL.ProposedProtocolParameterUpdates.from_hex, hex_str); -export const proposedProtocolParameterUpdates_toJson = self => self.to_json(); -export const proposedProtocolParameterUpdates_toJsValue = self => self.to_js_value(); -export const proposedProtocolParameterUpdates_fromJson = json => errorableToPurs(CSL.ProposedProtocolParameterUpdates.from_json, json); -export const proposedProtocolParameterUpdates_new = () => CSL.ProposedProtocolParameterUpdates.new(); -export const proposedProtocolParameterUpdates_len = self => () => self.len(); -export const proposedProtocolParameterUpdates_insert = self => key => value => () => self.insert(key, value); -export const proposedProtocolParameterUpdates_get = self => key => () => self.get(key); -export const proposedProtocolParameterUpdates_keys = self => () => self.keys(); - -// ProtocolParamUpdate -export const protocolParamUpdate_free = self => () => self.free(); -export const protocolParamUpdate_toBytes = self => self.to_bytes(); -export const protocolParamUpdate_fromBytes = bytes => errorableToPurs(CSL.ProtocolParamUpdate.from_bytes, bytes); -export const protocolParamUpdate_toHex = self => self.to_hex(); -export const protocolParamUpdate_fromHex = hex_str => errorableToPurs(CSL.ProtocolParamUpdate.from_hex, hex_str); -export const protocolParamUpdate_toJson = self => self.to_json(); -export const protocolParamUpdate_toJsValue = self => self.to_js_value(); -export const protocolParamUpdate_fromJson = json => errorableToPurs(CSL.ProtocolParamUpdate.from_json, json); -export const protocolParamUpdate_setMinfeeA = self => minfee_a => () => self.set_minfee_a(minfee_a); -export const protocolParamUpdate_minfeeA = self => self.minfee_a(); -export const protocolParamUpdate_setMinfeeB = self => minfee_b => () => self.set_minfee_b(minfee_b); -export const protocolParamUpdate_minfeeB = self => self.minfee_b(); -export const protocolParamUpdate_setMaxBlockBodySize = self => max_block_body_size => () => self.set_max_block_body_size(max_block_body_size); -export const protocolParamUpdate_maxBlockBodySize = self => self.max_block_body_size(); -export const protocolParamUpdate_setMaxTxSize = self => max_tx_size => () => self.set_max_tx_size(max_tx_size); -export const protocolParamUpdate_maxTxSize = self => self.max_tx_size(); -export const protocolParamUpdate_setMaxBlockHeaderSize = self => max_block_header_size => () => self.set_max_block_header_size(max_block_header_size); -export const protocolParamUpdate_maxBlockHeaderSize = self => self.max_block_header_size(); -export const protocolParamUpdate_setKeyDeposit = self => key_deposit => () => self.set_key_deposit(key_deposit); -export const protocolParamUpdate_keyDeposit = self => self.key_deposit(); -export const protocolParamUpdate_setPoolDeposit = self => pool_deposit => () => self.set_pool_deposit(pool_deposit); -export const protocolParamUpdate_poolDeposit = self => self.pool_deposit(); -export const protocolParamUpdate_setMaxEpoch = self => max_epoch => () => self.set_max_epoch(max_epoch); -export const protocolParamUpdate_maxEpoch = self => self.max_epoch(); -export const protocolParamUpdate_setNOpt = self => n_opt => () => self.set_n_opt(n_opt); -export const protocolParamUpdate_nOpt = self => self.n_opt(); -export const protocolParamUpdate_setPoolPledgeInfluence = self => pool_pledge_influence => () => self.set_pool_pledge_influence(pool_pledge_influence); -export const protocolParamUpdate_poolPledgeInfluence = self => self.pool_pledge_influence(); -export const protocolParamUpdate_setExpansionRate = self => expansion_rate => () => self.set_expansion_rate(expansion_rate); -export const protocolParamUpdate_expansionRate = self => self.expansion_rate(); -export const protocolParamUpdate_setTreasuryGrowthRate = self => treasury_growth_rate => () => self.set_treasury_growth_rate(treasury_growth_rate); -export const protocolParamUpdate_treasuryGrowthRate = self => self.treasury_growth_rate(); -export const protocolParamUpdate_d = self => self.d(); -export const protocolParamUpdate_extraEntropy = self => self.extra_entropy(); -export const protocolParamUpdate_setProtocolVersion = self => protocol_version => () => self.set_protocol_version(protocol_version); -export const protocolParamUpdate_protocolVersion = self => self.protocol_version(); -export const protocolParamUpdate_setMinPoolCost = self => min_pool_cost => () => self.set_min_pool_cost(min_pool_cost); -export const protocolParamUpdate_minPoolCost = self => self.min_pool_cost(); -export const protocolParamUpdate_setAdaPerUtxoByte = self => ada_per_utxo_byte => () => self.set_ada_per_utxo_byte(ada_per_utxo_byte); -export const protocolParamUpdate_adaPerUtxoByte = self => self.ada_per_utxo_byte(); -export const protocolParamUpdate_setCostModels = self => cost_models => () => self.set_cost_models(cost_models); -export const protocolParamUpdate_costModels = self => self.cost_models(); -export const protocolParamUpdate_setExecutionCosts = self => execution_costs => () => self.set_execution_costs(execution_costs); -export const protocolParamUpdate_executionCosts = self => self.execution_costs(); -export const protocolParamUpdate_setMaxTxExUnits = self => max_tx_ex_units => () => self.set_max_tx_ex_units(max_tx_ex_units); -export const protocolParamUpdate_maxTxExUnits = self => self.max_tx_ex_units(); -export const protocolParamUpdate_setMaxBlockExUnits = self => max_block_ex_units => () => self.set_max_block_ex_units(max_block_ex_units); -export const protocolParamUpdate_maxBlockExUnits = self => self.max_block_ex_units(); -export const protocolParamUpdate_setMaxValueSize = self => max_value_size => () => self.set_max_value_size(max_value_size); -export const protocolParamUpdate_maxValueSize = self => self.max_value_size(); -export const protocolParamUpdate_setCollateralPercentage = self => collateral_percentage => () => self.set_collateral_percentage(collateral_percentage); -export const protocolParamUpdate_collateralPercentage = self => self.collateral_percentage(); -export const protocolParamUpdate_setMaxCollateralIns = self => max_collateral_inputs => () => self.set_max_collateral_inputs(max_collateral_inputs); -export const protocolParamUpdate_maxCollateralIns = self => self.max_collateral_inputs(); -export const protocolParamUpdate_new = CSL.ProtocolParamUpdate.new(); - -// ProtocolVersion -export const protocolVersion_free = self => () => self.free(); -export const protocolVersion_toBytes = self => self.to_bytes(); -export const protocolVersion_fromBytes = bytes => errorableToPurs(CSL.ProtocolVersion.from_bytes, bytes); -export const protocolVersion_toHex = self => self.to_hex(); -export const protocolVersion_fromHex = hex_str => errorableToPurs(CSL.ProtocolVersion.from_hex, hex_str); -export const protocolVersion_toJson = self => self.to_json(); -export const protocolVersion_toJsValue = self => self.to_js_value(); -export const protocolVersion_fromJson = json => errorableToPurs(CSL.ProtocolVersion.from_json, json); -export const protocolVersion_major = self => self.major(); -export const protocolVersion_minor = self => self.minor(); -export const protocolVersion_new = major => minor => CSL.ProtocolVersion.new(major, minor); - -// PublicKey -export const publicKey_free = self => () => self.free(); -export const publicKey_fromBech32 = bech32_str => errorableToPurs(CSL.PublicKey.from_bech32, bech32_str); -export const publicKey_toBech32 = self => self.to_bech32(); -export const publicKey_asBytes = self => self.as_bytes(); -export const publicKey_fromBytes = bytes => errorableToPurs(CSL.PublicKey.from_bytes, bytes); -export const publicKey_verify = self => data => signature => self.verify(data, signature); -export const publicKey_hash = self => self.hash(); -export const publicKey_toHex = self => self.to_hex(); -export const publicKey_fromHex = hex_str => errorableToPurs(CSL.PublicKey.from_hex, hex_str); - -// PublicKeys -export const publicKeys_free = self => () => self.free(); -export const publicKeys_constructor = self => self.constructor(); -export const publicKeys_size = self => self.size(); -export const publicKeys_get = self => index => self.get(index); -export const publicKeys_add = self => key => () => self.add(key); - -// Redeemer -export const redeemer_free = self => () => self.free(); -export const redeemer_toBytes = self => self.to_bytes(); -export const redeemer_fromBytes = bytes => errorableToPurs(CSL.Redeemer.from_bytes, bytes); -export const redeemer_toHex = self => self.to_hex(); -export const redeemer_fromHex = hex_str => errorableToPurs(CSL.Redeemer.from_hex, hex_str); -export const redeemer_toJson = self => self.to_json(); -export const redeemer_toJsValue = self => self.to_js_value(); -export const redeemer_fromJson = json => errorableToPurs(CSL.Redeemer.from_json, json); -export const redeemer_tag = self => self.tag(); -export const redeemer_index = self => self.index(); -export const redeemer_data = self => self.data(); -export const redeemer_exUnits = self => self.ex_units(); -export const redeemer_new = tag => index => data => ex_units => CSL.Redeemer.new(tag, index, data, ex_units); - -// RedeemerTag -export const redeemerTag_free = self => () => self.free(); -export const redeemerTag_toBytes = self => self.to_bytes(); -export const redeemerTag_fromBytes = bytes => errorableToPurs(CSL.RedeemerTag.from_bytes, bytes); -export const redeemerTag_toHex = self => self.to_hex(); -export const redeemerTag_fromHex = hex_str => errorableToPurs(CSL.RedeemerTag.from_hex, hex_str); -export const redeemerTag_toJson = self => self.to_json(); -export const redeemerTag_toJsValue = self => self.to_js_value(); -export const redeemerTag_fromJson = json => errorableToPurs(CSL.RedeemerTag.from_json, json); -export const redeemerTag_newSpend = CSL.RedeemerTag.new_spend(); -export const redeemerTag_newMint = CSL.RedeemerTag.new_mint(); -export const redeemerTag_newCert = CSL.RedeemerTag.new_cert(); -export const redeemerTag_newReward = CSL.RedeemerTag.new_reward(); -export const redeemerTag_kind = self => self.kind(); - -// Redeemers -export const redeemers_free = self => () => self.free(); -export const redeemers_toBytes = self => self.to_bytes(); -export const redeemers_fromBytes = bytes => errorableToPurs(CSL.Redeemers.from_bytes, bytes); -export const redeemers_toHex = self => self.to_hex(); -export const redeemers_fromHex = hex_str => errorableToPurs(CSL.Redeemers.from_hex, hex_str); -export const redeemers_toJson = self => self.to_json(); -export const redeemers_toJsValue = self => self.to_js_value(); -export const redeemers_fromJson = json => errorableToPurs(CSL.Redeemers.from_json, json); -export const redeemers_new = () => CSL.Redeemers.new(); -export const redeemers_len = self => () => self.len(); -export const redeemers_get = self => index => () => self.get(index); -export const redeemers_add = self => elem => () => self.add(elem); -export const redeemers_totalExUnits = self => self.total_ex_units(); - -// Relay -export const relay_free = self => () => self.free(); -export const relay_toBytes = self => self.to_bytes(); -export const relay_fromBytes = bytes => errorableToPurs(CSL.Relay.from_bytes, bytes); -export const relay_toHex = self => self.to_hex(); -export const relay_fromHex = hex_str => errorableToPurs(CSL.Relay.from_hex, hex_str); -export const relay_toJson = self => self.to_json(); -export const relay_toJsValue = self => self.to_js_value(); -export const relay_fromJson = json => errorableToPurs(CSL.Relay.from_json, json); -export const relay_newSingleHostAddr = single_host_addr => CSL.Relay.new_single_host_addr(single_host_addr); -export const relay_newSingleHostName = single_host_name => CSL.Relay.new_single_host_name(single_host_name); -export const relay_newMultiHostName = multi_host_name => CSL.Relay.new_multi_host_name(multi_host_name); -export const relay_kind = self => self.kind(); -export const relay_asSingleHostAddr = self => self.as_single_host_addr(); -export const relay_asSingleHostName = self => self.as_single_host_name(); -export const relay_asMultiHostName = self => self.as_multi_host_name(); - -// Relays -export const relays_free = self => () => self.free(); -export const relays_toBytes = self => self.to_bytes(); -export const relays_fromBytes = bytes => errorableToPurs(CSL.Relays.from_bytes, bytes); -export const relays_toHex = self => self.to_hex(); -export const relays_fromHex = hex_str => errorableToPurs(CSL.Relays.from_hex, hex_str); -export const relays_toJson = self => self.to_json(); -export const relays_toJsValue = self => self.to_js_value(); -export const relays_fromJson = json => errorableToPurs(CSL.Relays.from_json, json); -export const relays_new = () => CSL.Relays.new(); -export const relays_len = self => () => self.len(); -export const relays_get = self => index => () => self.get(index); -export const relays_add = self => elem => () => self.add(elem); - -// RewardAddress -export const rewardAddress_free = self => () => self.free(); -export const rewardAddress_new = network => payment => CSL.RewardAddress.new(network, payment); -export const rewardAddress_paymentCred = self => self.payment_cred(); -export const rewardAddress_toAddress = self => self.to_address(); -export const rewardAddress_fromAddress = addr => CSL.RewardAddress.from_address(addr); - -// RewardAddresses -export const rewardAddresses_free = self => () => self.free(); -export const rewardAddresses_toBytes = self => self.to_bytes(); -export const rewardAddresses_fromBytes = bytes => errorableToPurs(CSL.RewardAddresses.from_bytes, bytes); -export const rewardAddresses_toHex = self => self.to_hex(); -export const rewardAddresses_fromHex = hex_str => errorableToPurs(CSL.RewardAddresses.from_hex, hex_str); -export const rewardAddresses_toJson = self => self.to_json(); -export const rewardAddresses_toJsValue = self => self.to_js_value(); -export const rewardAddresses_fromJson = json => errorableToPurs(CSL.RewardAddresses.from_json, json); -export const rewardAddresses_new = () => CSL.RewardAddresses.new(); -export const rewardAddresses_len = self => () => self.len(); -export const rewardAddresses_get = self => index => () => self.get(index); -export const rewardAddresses_add = self => elem => () => self.add(elem); - -// ScriptAll -export const scriptAll_free = self => () => self.free(); -export const scriptAll_toBytes = self => self.to_bytes(); -export const scriptAll_fromBytes = bytes => errorableToPurs(CSL.ScriptAll.from_bytes, bytes); -export const scriptAll_toHex = self => self.to_hex(); -export const scriptAll_fromHex = hex_str => errorableToPurs(CSL.ScriptAll.from_hex, hex_str); -export const scriptAll_toJson = self => self.to_json(); -export const scriptAll_toJsValue = self => self.to_js_value(); -export const scriptAll_fromJson = json => errorableToPurs(CSL.ScriptAll.from_json, json); -export const scriptAll_nativeScripts = self => self.native_scripts(); -export const scriptAll_new = native_scripts => CSL.ScriptAll.new(native_scripts); - -// ScriptAny -export const scriptAny_free = self => () => self.free(); -export const scriptAny_toBytes = self => self.to_bytes(); -export const scriptAny_fromBytes = bytes => errorableToPurs(CSL.ScriptAny.from_bytes, bytes); -export const scriptAny_toHex = self => self.to_hex(); -export const scriptAny_fromHex = hex_str => errorableToPurs(CSL.ScriptAny.from_hex, hex_str); -export const scriptAny_toJson = self => self.to_json(); -export const scriptAny_toJsValue = self => self.to_js_value(); -export const scriptAny_fromJson = json => errorableToPurs(CSL.ScriptAny.from_json, json); -export const scriptAny_nativeScripts = self => self.native_scripts(); -export const scriptAny_new = native_scripts => CSL.ScriptAny.new(native_scripts); - -// ScriptDataHash -export const scriptDataHash_free = self => () => self.free(); -export const scriptDataHash_fromBytes = bytes => errorableToPurs(CSL.ScriptDataHash.from_bytes, bytes); -export const scriptDataHash_toBytes = self => self.to_bytes(); -export const scriptDataHash_toBech32 = self => prefix => self.to_bech32(prefix); -export const scriptDataHash_fromBech32 = bech_str => errorableToPurs(CSL.ScriptDataHash.from_bech32, bech_str); -export const scriptDataHash_toHex = self => self.to_hex(); -export const scriptDataHash_fromHex = hex => errorableToPurs(CSL.ScriptDataHash.from_hex, hex); - -// ScriptHash -export const scriptHash_free = self => () => self.free(); -export const scriptHash_fromBytes = bytes => errorableToPurs(CSL.ScriptHash.from_bytes, bytes); -export const scriptHash_toBytes = self => self.to_bytes(); -export const scriptHash_toBech32 = self => prefix => self.to_bech32(prefix); -export const scriptHash_fromBech32 = bech_str => errorableToPurs(CSL.ScriptHash.from_bech32, bech_str); -export const scriptHash_toHex = self => self.to_hex(); -export const scriptHash_fromHex = hex => errorableToPurs(CSL.ScriptHash.from_hex, hex); - -// ScriptHashes -export const scriptHashes_free = self => () => self.free(); -export const scriptHashes_toBytes = self => self.to_bytes(); -export const scriptHashes_fromBytes = bytes => errorableToPurs(CSL.ScriptHashes.from_bytes, bytes); -export const scriptHashes_toHex = self => self.to_hex(); -export const scriptHashes_fromHex = hex_str => errorableToPurs(CSL.ScriptHashes.from_hex, hex_str); -export const scriptHashes_toJson = self => self.to_json(); -export const scriptHashes_toJsValue = self => self.to_js_value(); -export const scriptHashes_fromJson = json => errorableToPurs(CSL.ScriptHashes.from_json, json); -export const scriptHashes_new = () => CSL.ScriptHashes.new(); -export const scriptHashes_len = self => () => self.len(); -export const scriptHashes_get = self => index => () => self.get(index); -export const scriptHashes_add = self => elem => () => self.add(elem); - -// ScriptNOfK -export const scriptNOfK_free = self => () => self.free(); -export const scriptNOfK_toBytes = self => self.to_bytes(); -export const scriptNOfK_fromBytes = bytes => errorableToPurs(CSL.ScriptNOfK.from_bytes, bytes); -export const scriptNOfK_toHex = self => self.to_hex(); -export const scriptNOfK_fromHex = hex_str => errorableToPurs(CSL.ScriptNOfK.from_hex, hex_str); -export const scriptNOfK_toJson = self => self.to_json(); -export const scriptNOfK_toJsValue = self => self.to_js_value(); -export const scriptNOfK_fromJson = json => errorableToPurs(CSL.ScriptNOfK.from_json, json); -export const scriptNOfK_n = self => self.n(); -export const scriptNOfK_nativeScripts = self => self.native_scripts(); -export const scriptNOfK_new = n => native_scripts => CSL.ScriptNOfK.new(n, native_scripts); - -// ScriptPubkey -export const scriptPubkey_free = self => () => self.free(); -export const scriptPubkey_toBytes = self => self.to_bytes(); -export const scriptPubkey_fromBytes = bytes => errorableToPurs(CSL.ScriptPubkey.from_bytes, bytes); -export const scriptPubkey_toHex = self => self.to_hex(); -export const scriptPubkey_fromHex = hex_str => errorableToPurs(CSL.ScriptPubkey.from_hex, hex_str); -export const scriptPubkey_toJson = self => self.to_json(); -export const scriptPubkey_toJsValue = self => self.to_js_value(); -export const scriptPubkey_fromJson = json => errorableToPurs(CSL.ScriptPubkey.from_json, json); -export const scriptPubkey_addrKeyhash = self => self.addr_keyhash(); -export const scriptPubkey_new = addr_keyhash => CSL.ScriptPubkey.new(addr_keyhash); - -// ScriptRef -export const scriptRef_free = self => () => self.free(); -export const scriptRef_toBytes = self => self.to_bytes(); -export const scriptRef_fromBytes = bytes => errorableToPurs(CSL.ScriptRef.from_bytes, bytes); -export const scriptRef_toHex = self => self.to_hex(); -export const scriptRef_fromHex = hex_str => errorableToPurs(CSL.ScriptRef.from_hex, hex_str); -export const scriptRef_toJson = self => self.to_json(); -export const scriptRef_toJsValue = self => self.to_js_value(); -export const scriptRef_fromJson = json => errorableToPurs(CSL.ScriptRef.from_json, json); -export const scriptRef_newNativeScript = native_script => CSL.ScriptRef.new_native_script(native_script); -export const scriptRef_newPlutusScript = plutus_script => CSL.ScriptRef.new_plutus_script(plutus_script); -export const scriptRef_isNativeScript = self => self.is_native_script(); -export const scriptRef_isPlutusScript = self => self.is_plutus_script(); -export const scriptRef_nativeScript = self => self.native_script(); -export const scriptRef_plutusScript = self => self.plutus_script(); - -// SingleHostAddr -export const singleHostAddr_free = self => () => self.free(); -export const singleHostAddr_toBytes = self => self.to_bytes(); -export const singleHostAddr_fromBytes = bytes => errorableToPurs(CSL.SingleHostAddr.from_bytes, bytes); -export const singleHostAddr_toHex = self => self.to_hex(); -export const singleHostAddr_fromHex = hex_str => errorableToPurs(CSL.SingleHostAddr.from_hex, hex_str); -export const singleHostAddr_toJson = self => self.to_json(); -export const singleHostAddr_toJsValue = self => self.to_js_value(); -export const singleHostAddr_fromJson = json => errorableToPurs(CSL.SingleHostAddr.from_json, json); -export const singleHostAddr_port = self => self.port(); -export const singleHostAddr_ipv4 = self => self.ipv4(); -export const singleHostAddr_ipv6 = self => self.ipv6(); -export const singleHostAddr_new = port => ipv4 => ipv6 => CSL.SingleHostAddr.new(port, ipv4, ipv6); - -// SingleHostName -export const singleHostName_free = self => () => self.free(); -export const singleHostName_toBytes = self => self.to_bytes(); -export const singleHostName_fromBytes = bytes => errorableToPurs(CSL.SingleHostName.from_bytes, bytes); -export const singleHostName_toHex = self => self.to_hex(); -export const singleHostName_fromHex = hex_str => errorableToPurs(CSL.SingleHostName.from_hex, hex_str); -export const singleHostName_toJson = self => self.to_json(); -export const singleHostName_toJsValue = self => self.to_js_value(); -export const singleHostName_fromJson = json => errorableToPurs(CSL.SingleHostName.from_json, json); -export const singleHostName_port = self => self.port(); -export const singleHostName_dnsName = self => self.dns_name(); -export const singleHostName_new = port => dns_name => CSL.SingleHostName.new(port, dns_name); - -// StakeCredential -export const stakeCredential_free = self => () => self.free(); -export const stakeCredential_fromKeyhash = hash => CSL.StakeCredential.from_keyhash(hash); -export const stakeCredential_fromScripthash = hash => CSL.StakeCredential.from_scripthash(hash); -export const stakeCredential_toKeyhash = self => self.to_keyhash(); -export const stakeCredential_toScripthash = self => self.to_scripthash(); -export const stakeCredential_kind = self => self.kind(); -export const stakeCredential_toBytes = self => self.to_bytes(); -export const stakeCredential_fromBytes = bytes => errorableToPurs(CSL.StakeCredential.from_bytes, bytes); -export const stakeCredential_toHex = self => self.to_hex(); -export const stakeCredential_fromHex = hex_str => errorableToPurs(CSL.StakeCredential.from_hex, hex_str); -export const stakeCredential_toJson = self => self.to_json(); -export const stakeCredential_toJsValue = self => self.to_js_value(); -export const stakeCredential_fromJson = json => errorableToPurs(CSL.StakeCredential.from_json, json); - -// StakeCredentials -export const stakeCredentials_free = self => () => self.free(); -export const stakeCredentials_toBytes = self => self.to_bytes(); -export const stakeCredentials_fromBytes = bytes => errorableToPurs(CSL.StakeCredentials.from_bytes, bytes); -export const stakeCredentials_toHex = self => self.to_hex(); -export const stakeCredentials_fromHex = hex_str => errorableToPurs(CSL.StakeCredentials.from_hex, hex_str); -export const stakeCredentials_toJson = self => self.to_json(); -export const stakeCredentials_toJsValue = self => self.to_js_value(); -export const stakeCredentials_fromJson = json => errorableToPurs(CSL.StakeCredentials.from_json, json); -export const stakeCredentials_new = () => CSL.StakeCredentials.new(); -export const stakeCredentials_len = self => () => self.len(); -export const stakeCredentials_get = self => index => () => self.get(index); -export const stakeCredentials_add = self => elem => () => self.add(elem); - -// StakeDelegation -export const stakeDelegation_free = self => () => self.free(); -export const stakeDelegation_toBytes = self => self.to_bytes(); -export const stakeDelegation_fromBytes = bytes => errorableToPurs(CSL.StakeDelegation.from_bytes, bytes); -export const stakeDelegation_toHex = self => self.to_hex(); -export const stakeDelegation_fromHex = hex_str => errorableToPurs(CSL.StakeDelegation.from_hex, hex_str); -export const stakeDelegation_toJson = self => self.to_json(); -export const stakeDelegation_toJsValue = self => self.to_js_value(); -export const stakeDelegation_fromJson = json => errorableToPurs(CSL.StakeDelegation.from_json, json); -export const stakeDelegation_stakeCredential = self => self.stake_credential(); -export const stakeDelegation_poolKeyhash = self => self.pool_keyhash(); -export const stakeDelegation_new = stake_credential => pool_keyhash => CSL.StakeDelegation.new(stake_credential, pool_keyhash); - -// StakeDeregistration -export const stakeDeregistration_free = self => () => self.free(); -export const stakeDeregistration_toBytes = self => self.to_bytes(); -export const stakeDeregistration_fromBytes = bytes => errorableToPurs(CSL.StakeDeregistration.from_bytes, bytes); -export const stakeDeregistration_toHex = self => self.to_hex(); -export const stakeDeregistration_fromHex = hex_str => errorableToPurs(CSL.StakeDeregistration.from_hex, hex_str); -export const stakeDeregistration_toJson = self => self.to_json(); -export const stakeDeregistration_toJsValue = self => self.to_js_value(); -export const stakeDeregistration_fromJson = json => errorableToPurs(CSL.StakeDeregistration.from_json, json); -export const stakeDeregistration_stakeCredential = self => self.stake_credential(); -export const stakeDeregistration_new = stake_credential => CSL.StakeDeregistration.new(stake_credential); - -// StakeRegistration -export const stakeRegistration_free = self => () => self.free(); -export const stakeRegistration_toBytes = self => self.to_bytes(); -export const stakeRegistration_fromBytes = bytes => errorableToPurs(CSL.StakeRegistration.from_bytes, bytes); -export const stakeRegistration_toHex = self => self.to_hex(); -export const stakeRegistration_fromHex = hex_str => errorableToPurs(CSL.StakeRegistration.from_hex, hex_str); -export const stakeRegistration_toJson = self => self.to_json(); -export const stakeRegistration_toJsValue = self => self.to_js_value(); -export const stakeRegistration_fromJson = json => errorableToPurs(CSL.StakeRegistration.from_json, json); -export const stakeRegistration_stakeCredential = self => self.stake_credential(); -export const stakeRegistration_new = stake_credential => CSL.StakeRegistration.new(stake_credential); - -// Strings -export const strings_free = self => () => self.free(); -export const strings_new = () => CSL.Strings.new(); -export const strings_len = self => () => self.len(); -export const strings_get = self => index => () => self.get(index); -export const strings_add = self => elem => () => self.add(elem); - -// TimelockExpiry -export const timelockExpiry_free = self => () => self.free(); -export const timelockExpiry_toBytes = self => self.to_bytes(); -export const timelockExpiry_fromBytes = bytes => errorableToPurs(CSL.TimelockExpiry.from_bytes, bytes); -export const timelockExpiry_toHex = self => self.to_hex(); -export const timelockExpiry_fromHex = hex_str => errorableToPurs(CSL.TimelockExpiry.from_hex, hex_str); -export const timelockExpiry_toJson = self => self.to_json(); -export const timelockExpiry_toJsValue = self => self.to_js_value(); -export const timelockExpiry_fromJson = json => errorableToPurs(CSL.TimelockExpiry.from_json, json); -export const timelockExpiry_slot = self => self.slot(); -export const timelockExpiry_slotBignum = self => self.slot_bignum(); -export const timelockExpiry_new = slot => CSL.TimelockExpiry.new(slot); -export const timelockExpiry_newTimelockexpiry = slot => CSL.TimelockExpiry.new_timelockexpiry(slot); - -// TimelockStart -export const timelockStart_free = self => () => self.free(); -export const timelockStart_toBytes = self => self.to_bytes(); -export const timelockStart_fromBytes = bytes => errorableToPurs(CSL.TimelockStart.from_bytes, bytes); -export const timelockStart_toHex = self => self.to_hex(); -export const timelockStart_fromHex = hex_str => errorableToPurs(CSL.TimelockStart.from_hex, hex_str); -export const timelockStart_toJson = self => self.to_json(); -export const timelockStart_toJsValue = self => self.to_js_value(); -export const timelockStart_fromJson = json => errorableToPurs(CSL.TimelockStart.from_json, json); -export const timelockStart_slot = self => self.slot(); -export const timelockStart_slotBignum = self => self.slot_bignum(); -export const timelockStart_new = slot => CSL.TimelockStart.new(slot); -export const timelockStart_newTimelockstart = slot => CSL.TimelockStart.new_timelockstart(slot); - -// Transaction -export const tx_free = self => () => self.free(); -export const tx_toBytes = self => self.to_bytes(); -export const tx_fromBytes = bytes => errorableToPurs(CSL.Transaction.from_bytes, bytes); -export const tx_toHex = self => self.to_hex(); -export const tx_fromHex = hex_str => errorableToPurs(CSL.Transaction.from_hex, hex_str); -export const tx_toJson = self => self.to_json(); -export const tx_toJsValue = self => self.to_js_value(); -export const tx_fromJson = json => errorableToPurs(CSL.Transaction.from_json, json); -export const tx_body = self => self.body(); -export const tx_witnessSet = self => self.witness_set(); -export const tx_isValid = self => self.is_valid(); -export const tx_auxiliaryData = self => self.auxiliary_data(); -export const tx_setIsValid = self => valid => () => self.set_is_valid(valid); -export const tx_new = body => witness_set => auxiliary_data => CSL.Transaction.new(body, witness_set, auxiliary_data); - -// TransactionBodies -export const txBodies_free = self => () => self.free(); -export const txBodies_toBytes = self => self.to_bytes(); -export const txBodies_fromBytes = bytes => errorableToPurs(CSL.TransactionBodies.from_bytes, bytes); -export const txBodies_toHex = self => self.to_hex(); -export const txBodies_fromHex = hex_str => errorableToPurs(CSL.TransactionBodies.from_hex, hex_str); -export const txBodies_toJson = self => self.to_json(); -export const txBodies_toJsValue = self => self.to_js_value(); -export const txBodies_fromJson = json => errorableToPurs(CSL.TransactionBodies.from_json, json); -export const txBodies_new = () => CSL.TransactionBodies.new(); -export const txBodies_len = self => () => self.len(); -export const txBodies_get = self => index => () => self.get(index); -export const txBodies_add = self => elem => () => self.add(elem); - -// TransactionBody -export const txBody_free = self => () => self.free(); -export const txBody_toBytes = self => self.to_bytes(); -export const txBody_fromBytes = bytes => errorableToPurs(CSL.TransactionBody.from_bytes, bytes); -export const txBody_toHex = self => self.to_hex(); -export const txBody_fromHex = hex_str => errorableToPurs(CSL.TransactionBody.from_hex, hex_str); -export const txBody_toJson = self => self.to_json(); -export const txBody_toJsValue = self => self.to_js_value(); -export const txBody_fromJson = json => errorableToPurs(CSL.TransactionBody.from_json, json); -export const txBody_ins = self => self.inputs(); -export const txBody_outs = self => self.outputs(); -export const txBody_fee = self => self.fee(); -export const txBody_ttl = self => self.ttl(); -export const txBody_ttlBignum = self => self.ttl_bignum(); -export const txBody_setTtl = self => ttl => () => self.set_ttl(ttl); -export const txBody_removeTtl = self => () => self.remove_ttl(); -export const txBody_setCerts = self => certs => () => self.set_certs(certs); -export const txBody_certs = self => self.certs(); -export const txBody_setWithdrawals = self => withdrawals => () => self.set_withdrawals(withdrawals); -export const txBody_withdrawals = self => self.withdrawals(); -export const txBody_setUpdate = self => update => () => self.set_update(update); -export const txBody_update = self => self.update(); -export const txBody_setAuxiliaryDataHash = self => auxiliary_data_hash => () => self.set_auxiliary_data_hash(auxiliary_data_hash); -export const txBody_auxiliaryDataHash = self => self.auxiliary_data_hash(); -export const txBody_setValidityStartInterval = self => validity_start_interval => () => self.set_validity_start_interval(validity_start_interval); -export const txBody_setValidityStartIntervalBignum = self => validity_start_interval => () => self.set_validity_start_interval_bignum(validity_start_interval); -export const txBody_validityStartIntervalBignum = self => self.validity_start_interval_bignum(); -export const txBody_validityStartInterval = self => self.validity_start_interval(); -export const txBody_setMint = self => mint => () => self.set_mint(mint); -export const txBody_mint = self => self.mint(); -export const txBody_multiassets = self => self.multiassets(); -export const txBody_setReferenceIns = self => reference_inputs => () => self.set_reference_inputs(reference_inputs); -export const txBody_referenceIns = self => self.reference_inputs(); -export const txBody_setScriptDataHash = self => script_data_hash => () => self.set_script_data_hash(script_data_hash); -export const txBody_scriptDataHash = self => self.script_data_hash(); -export const txBody_setCollateral = self => collateral => () => self.set_collateral(collateral); -export const txBody_collateral = self => self.collateral(); -export const txBody_setRequiredSigners = self => required_signers => () => self.set_required_signers(required_signers); -export const txBody_requiredSigners = self => self.required_signers(); -export const txBody_setNetworkId = self => network_id => () => self.set_network_id(network_id); -export const txBody_networkId = self => self.network_id(); -export const txBody_setCollateralReturn = self => collateral_return => () => self.set_collateral_return(collateral_return); -export const txBody_collateralReturn = self => self.collateral_return(); -export const txBody_setTotalCollateral = self => total_collateral => () => self.set_total_collateral(total_collateral); -export const txBody_totalCollateral = self => self.total_collateral(); -export const txBody_new = inputs => outputs => fee => ttl => CSL.TransactionBody.new(inputs, outputs, fee, ttl); -export const txBody_newTxBody = inputs => outputs => fee => CSL.TransactionBody.new_tx_body(inputs, outputs, fee); - -// TransactionBuilder -export const txBuilder_free = self => () => self.free(); -export const txBuilder_addInsFrom = self => inputs => strategy => () => self.add_inputs_from(inputs, strategy); -export const txBuilder_setIns = self => inputs => () => self.set_inputs(inputs); -export const txBuilder_setCollateral = self => collateral => () => self.set_collateral(collateral); -export const txBuilder_setCollateralReturn = self => collateral_return => () => self.set_collateral_return(collateral_return); -export const txBuilder_setCollateralReturnAndTotal = self => collateral_return => () => self.set_collateral_return_and_total(collateral_return); -export const txBuilder_setTotalCollateral = self => total_collateral => () => self.set_total_collateral(total_collateral); -export const txBuilder_setTotalCollateralAndReturn = self => total_collateral => return_address => () => self.set_total_collateral_and_return(total_collateral, return_address); -export const txBuilder_addReferenceIn = self => reference_input => () => self.add_reference_input(reference_input); -export const txBuilder_addKeyIn = self => hash => input => amount => () => self.add_key_input(hash, input, amount); -export const txBuilder_addScriptIn = self => hash => input => amount => () => self.add_script_input(hash, input, amount); -export const txBuilder_addNativeScriptIn = self => script => input => amount => () => self.add_native_script_input(script, input, amount); -export const txBuilder_addPlutusScriptIn = self => witness => input => amount => () => self.add_plutus_script_input(witness, input, amount); -export const txBuilder_addBootstrapIn = self => hash => input => amount => () => self.add_bootstrap_input(hash, input, amount); -export const txBuilder_addIn = self => address => input => amount => () => self.add_input(address, input, amount); -export const txBuilder_countMissingInScripts = self => () => self.count_missing_input_scripts(); -export const txBuilder_addRequiredNativeInScripts = self => scripts => () => self.add_required_native_input_scripts(scripts); -export const txBuilder_addRequiredPlutusInScripts = self => scripts => () => self.add_required_plutus_input_scripts(scripts); -export const txBuilder_getNativeInScripts = self => () => self.get_native_input_scripts(); -export const txBuilder_getPlutusInScripts = self => () => self.get_plutus_input_scripts(); -export const txBuilder_feeForIn = self => address => input => amount => () => self.fee_for_input(address, input, amount); -export const txBuilder_addOut = self => output => () => self.add_output(output); -export const txBuilder_feeForOut = self => output => () => self.fee_for_output(output); -export const txBuilder_setFee = self => fee => () => self.set_fee(fee); -export const txBuilder_setTtl = self => ttl => () => self.set_ttl(ttl); -export const txBuilder_setTtlBignum = self => ttl => () => self.set_ttl_bignum(ttl); -export const txBuilder_setValidityStartInterval = self => validity_start_interval => () => self.set_validity_start_interval(validity_start_interval); -export const txBuilder_setValidityStartIntervalBignum = self => validity_start_interval => () => self.set_validity_start_interval_bignum(validity_start_interval); -export const txBuilder_setCerts = self => certs => () => self.set_certs(certs); -export const txBuilder_setWithdrawals = self => withdrawals => () => self.set_withdrawals(withdrawals); -export const txBuilder_getAuxiliaryData = self => () => self.get_auxiliary_data(); -export const txBuilder_setAuxiliaryData = self => auxiliary_data => () => self.set_auxiliary_data(auxiliary_data); -export const txBuilder_setMetadata = self => metadata => () => self.set_metadata(metadata); -export const txBuilder_addMetadatum = self => key => val => () => self.add_metadatum(key, val); -export const txBuilder_addJsonMetadatum = self => key => val => () => self.add_json_metadatum(key, val); -export const txBuilder_addJsonMetadatumWithSchema = self => key => val => schema => () => self.add_json_metadatum_with_schema(key, val, schema); -export const txBuilder_setMint = self => mint => mint_scripts => () => self.set_mint(mint, mint_scripts); -export const txBuilder_getMint = self => () => self.get_mint(); -export const txBuilder_getMintScripts = self => () => self.get_mint_scripts(); -export const txBuilder_setMintAsset = self => policy_script => mint_assets => () => self.set_mint_asset(policy_script, mint_assets); -export const txBuilder_addMintAsset = self => policy_script => asset_name => amount => () => self.add_mint_asset(policy_script, asset_name, amount); -export const txBuilder_addMintAssetAndOut = self => policy_script => asset_name => amount => output_builder => output_coin => () => self.add_mint_asset_and_output(policy_script, asset_name, amount, output_builder, output_coin); -export const txBuilder_addMintAssetAndOutMinRequiredCoin = self => policy_script => asset_name => amount => output_builder => () => self.add_mint_asset_and_output_min_required_coin(policy_script, asset_name, amount, output_builder); -export const txBuilder_new = cfg => () => CSL.TransactionBuilder.new(cfg); -export const txBuilder_getReferenceIns = self => () => self.get_reference_inputs(); -export const txBuilder_getExplicitIn = self => () => self.get_explicit_input(); -export const txBuilder_getImplicitIn = self => () => self.get_implicit_input(); -export const txBuilder_getTotalIn = self => () => self.get_total_input(); -export const txBuilder_getTotalOut = self => () => self.get_total_output(); -export const txBuilder_getExplicitOut = self => () => self.get_explicit_output(); -export const txBuilder_getDeposit = self => () => self.get_deposit(); -export const txBuilder_getFeeIfSet = self => () => self.get_fee_if_set(); -export const txBuilder_addChangeIfNeeded = self => address => () => self.add_change_if_needed(address); -export const txBuilder_calcScriptDataHash = self => cost_models => () => self.calc_script_data_hash(cost_models); -export const txBuilder_setScriptDataHash = self => hash => () => self.set_script_data_hash(hash); -export const txBuilder_removeScriptDataHash = self => () => self.remove_script_data_hash(); -export const txBuilder_addRequiredSigner = self => key => () => self.add_required_signer(key); -export const txBuilder_fullSize = self => () => self.full_size(); -export const txBuilder_outSizes = self => () => self.output_sizes(); -export const txBuilder_build = self => () => self.build(); -export const txBuilder_buildTx = self => () => self.build_tx(); -export const txBuilder_buildTxUnsafe = self => () => self.build_tx_unsafe(); -export const txBuilder_minFee = self => () => self.min_fee(); - -// TransactionBuilderConfig -export const txBuilderConfig_free = self => () => self.free(); - -// TransactionBuilderConfigBuilder -export const txBuilderConfigBuilder_free = self => () => self.free(); -export const txBuilderConfigBuilder_new = CSL.TransactionBuilderConfigBuilder.new(); -export const txBuilderConfigBuilder_feeAlgo = self => fee_algo => self.fee_algo(fee_algo); -export const txBuilderConfigBuilder_coinsPerUtxoWord = self => coins_per_utxo_word => self.coins_per_utxo_word(coins_per_utxo_word); -export const txBuilderConfigBuilder_coinsPerUtxoByte = self => coins_per_utxo_byte => self.coins_per_utxo_byte(coins_per_utxo_byte); -export const txBuilderConfigBuilder_exUnitPrices = self => ex_unit_prices => self.ex_unit_prices(ex_unit_prices); -export const txBuilderConfigBuilder_poolDeposit = self => pool_deposit => self.pool_deposit(pool_deposit); -export const txBuilderConfigBuilder_keyDeposit = self => key_deposit => self.key_deposit(key_deposit); -export const txBuilderConfigBuilder_maxValueSize = self => max_value_size => self.max_value_size(max_value_size); -export const txBuilderConfigBuilder_maxTxSize = self => max_tx_size => self.max_tx_size(max_tx_size); -export const txBuilderConfigBuilder_preferPureChange = self => prefer_pure_change => self.prefer_pure_change(prefer_pure_change); -export const txBuilderConfigBuilder_build = self => self.build(); - -// TransactionHash -export const txHash_free = self => () => self.free(); -export const txHash_fromBytes = bytes => errorableToPurs(CSL.TransactionHash.from_bytes, bytes); -export const txHash_toBytes = self => self.to_bytes(); -export const txHash_toBech32 = self => prefix => self.to_bech32(prefix); -export const txHash_fromBech32 = bech_str => errorableToPurs(CSL.TransactionHash.from_bech32, bech_str); -export const txHash_toHex = self => self.to_hex(); -export const txHash_fromHex = hex => errorableToPurs(CSL.TransactionHash.from_hex, hex); - -// TransactionInput -export const txIn_free = self => () => self.free(); -export const txIn_toBytes = self => self.to_bytes(); -export const txIn_fromBytes = bytes => errorableToPurs(CSL.TransactionInput.from_bytes, bytes); -export const txIn_toHex = self => self.to_hex(); -export const txIn_fromHex = hex_str => errorableToPurs(CSL.TransactionInput.from_hex, hex_str); -export const txIn_toJson = self => self.to_json(); -export const txIn_toJsValue = self => self.to_js_value(); -export const txIn_fromJson = json => errorableToPurs(CSL.TransactionInput.from_json, json); -export const txIn_txId = self => self.transaction_id(); -export const txIn_index = self => self.index(); -export const txIn_new = transaction_id => index => CSL.TransactionInput.new(transaction_id, index); - -// TransactionInputs -export const txIns_free = self => () => self.free(); -export const txIns_toBytes = self => self.to_bytes(); -export const txIns_fromBytes = bytes => errorableToPurs(CSL.TransactionInputs.from_bytes, bytes); -export const txIns_toHex = self => self.to_hex(); -export const txIns_fromHex = hex_str => errorableToPurs(CSL.TransactionInputs.from_hex, hex_str); -export const txIns_toJson = self => self.to_json(); -export const txIns_toJsValue = self => self.to_js_value(); -export const txIns_fromJson = json => errorableToPurs(CSL.TransactionInputs.from_json, json); -export const txIns_new = () => CSL.TransactionInputs.new(); -export const txIns_len = self => () => self.len(); -export const txIns_get = self => index => () => self.get(index); -export const txIns_add = self => elem => () => self.add(elem); -export const txIns_toOption = self => self.to_option(); - -// TransactionMetadatum -export const txMetadatum_free = self => () => self.free(); -export const txMetadatum_toBytes = self => self.to_bytes(); -export const txMetadatum_fromBytes = bytes => errorableToPurs(CSL.TransactionMetadatum.from_bytes, bytes); -export const txMetadatum_toHex = self => self.to_hex(); -export const txMetadatum_fromHex = hex_str => errorableToPurs(CSL.TransactionMetadatum.from_hex, hex_str); -export const txMetadatum_newMap = map => CSL.TransactionMetadatum.new_map(map); -export const txMetadatum_newList = list => CSL.TransactionMetadatum.new_list(list); -export const txMetadatum_newInt = int => CSL.TransactionMetadatum.new_int(int); -export const txMetadatum_newBytes = bytes => CSL.TransactionMetadatum.new_bytes(bytes); -export const txMetadatum_newText = text => CSL.TransactionMetadatum.new_text(text); -export const txMetadatum_kind = self => self.kind(); -export const txMetadatum_asMap = self => self.as_map(); -export const txMetadatum_asList = self => self.as_list(); -export const txMetadatum_asInt = self => self.as_int(); -export const txMetadatum_asBytes = self => self.as_bytes(); -export const txMetadatum_asText = self => self.as_text(); - -// TransactionMetadatumLabels -export const txMetadatumLabels_free = self => () => self.free(); -export const txMetadatumLabels_toBytes = self => self.to_bytes(); -export const txMetadatumLabels_fromBytes = bytes => errorableToPurs(CSL.TransactionMetadatumLabels.from_bytes, bytes); -export const txMetadatumLabels_toHex = self => self.to_hex(); -export const txMetadatumLabels_fromHex = hex_str => errorableToPurs(CSL.TransactionMetadatumLabels.from_hex, hex_str); -export const txMetadatumLabels_new = () => CSL.TransactionMetadatumLabels.new(); -export const txMetadatumLabels_len = self => () => self.len(); -export const txMetadatumLabels_get = self => index => () => self.get(index); -export const txMetadatumLabels_add = self => elem => () => self.add(elem); - -// TransactionOutput -export const txOut_free = self => () => self.free(); -export const txOut_toBytes = self => self.to_bytes(); -export const txOut_fromBytes = bytes => errorableToPurs(CSL.TransactionOutput.from_bytes, bytes); -export const txOut_toHex = self => self.to_hex(); -export const txOut_fromHex = hex_str => errorableToPurs(CSL.TransactionOutput.from_hex, hex_str); -export const txOut_toJson = self => self.to_json(); -export const txOut_toJsValue = self => self.to_js_value(); -export const txOut_fromJson = json => errorableToPurs(CSL.TransactionOutput.from_json, json); -export const txOut_address = self => self.address(); -export const txOut_amount = self => self.amount(); -export const txOut_dataHash = self => self.data_hash(); -export const txOut_plutusData = self => self.plutus_data(); -export const txOut_scriptRef = self => self.script_ref(); -export const txOut_setScriptRef = self => script_ref => () => self.set_script_ref(script_ref); -export const txOut_setPlutusData = self => data => () => self.set_plutus_data(data); -export const txOut_setDataHash = self => data_hash => () => self.set_data_hash(data_hash); -export const txOut_hasPlutusData = self => self.has_plutus_data(); -export const txOut_hasDataHash = self => self.has_data_hash(); -export const txOut_hasScriptRef = self => self.has_script_ref(); -export const txOut_new = address => amount => CSL.TransactionOutput.new(address, amount); - -// TransactionOutputAmountBuilder -export const txOutAmountBuilder_free = self => () => self.free(); -export const txOutAmountBuilder_withValue = self => amount => self.with_value(amount); -export const txOutAmountBuilder_withCoin = self => coin => self.with_coin(coin); -export const txOutAmountBuilder_withCoinAndAsset = self => coin => multiasset => self.with_coin_and_asset(coin, multiasset); -export const txOutAmountBuilder_withAssetAndMinRequiredCoin = self => multiasset => coins_per_utxo_word => self.with_asset_and_min_required_coin(multiasset, coins_per_utxo_word); -export const txOutAmountBuilder_withAssetAndMinRequiredCoinByUtxoCost = self => multiasset => data_cost => self.with_asset_and_min_required_coin_by_utxo_cost(multiasset, data_cost); -export const txOutAmountBuilder_build = self => self.build(); - -// TransactionOutputBuilder -export const txOutBuilder_free = self => () => self.free(); -export const txOutBuilder_new = CSL.TransactionOutputBuilder.new(); -export const txOutBuilder_withAddress = self => address => self.with_address(address); -export const txOutBuilder_withDataHash = self => data_hash => self.with_data_hash(data_hash); -export const txOutBuilder_withPlutusData = self => data => self.with_plutus_data(data); -export const txOutBuilder_withScriptRef = self => script_ref => self.with_script_ref(script_ref); -export const txOutBuilder_next = self => self.next(); - -// TransactionOutputs -export const txOuts_free = self => () => self.free(); -export const txOuts_toBytes = self => self.to_bytes(); -export const txOuts_fromBytes = bytes => errorableToPurs(CSL.TransactionOutputs.from_bytes, bytes); -export const txOuts_toHex = self => self.to_hex(); -export const txOuts_fromHex = hex_str => errorableToPurs(CSL.TransactionOutputs.from_hex, hex_str); -export const txOuts_toJson = self => self.to_json(); -export const txOuts_toJsValue = self => self.to_js_value(); -export const txOuts_fromJson = json => errorableToPurs(CSL.TransactionOutputs.from_json, json); -export const txOuts_new = () => CSL.TransactionOutputs.new(); -export const txOuts_len = self => () => self.len(); -export const txOuts_get = self => index => () => self.get(index); -export const txOuts_add = self => elem => () => self.add(elem); - -// TransactionUnspentOutput -export const txUnspentOut_free = self => () => self.free(); -export const txUnspentOut_toBytes = self => self.to_bytes(); -export const txUnspentOut_fromBytes = bytes => errorableToPurs(CSL.TransactionUnspentOutput.from_bytes, bytes); -export const txUnspentOut_toHex = self => self.to_hex(); -export const txUnspentOut_fromHex = hex_str => errorableToPurs(CSL.TransactionUnspentOutput.from_hex, hex_str); -export const txUnspentOut_toJson = self => self.to_json(); -export const txUnspentOut_toJsValue = self => self.to_js_value(); -export const txUnspentOut_fromJson = json => errorableToPurs(CSL.TransactionUnspentOutput.from_json, json); -export const txUnspentOut_new = input => output => CSL.TransactionUnspentOutput.new(input, output); -export const txUnspentOut_in = self => self.input(); -export const txUnspentOut_out = self => self.output(); - -// TransactionUnspentOutputs -export const txUnspentOuts_free = self => () => self.free(); -export const txUnspentOuts_toJson = self => self.to_json(); -export const txUnspentOuts_toJsValue = self => self.to_js_value(); -export const txUnspentOuts_fromJson = json => errorableToPurs(CSL.TransactionUnspentOutputs.from_json, json); -export const txUnspentOuts_new = () => CSL.TransactionUnspentOutputs.new(); -export const txUnspentOuts_len = self => () => self.len(); -export const txUnspentOuts_get = self => index => () => self.get(index); -export const txUnspentOuts_add = self => elem => () => self.add(elem); - -// TransactionWitnessSet -export const txWitnessSet_free = self => () => self.free(); -export const txWitnessSet_toBytes = self => self.to_bytes(); -export const txWitnessSet_fromBytes = bytes => errorableToPurs(CSL.TransactionWitnessSet.from_bytes, bytes); -export const txWitnessSet_toHex = self => self.to_hex(); -export const txWitnessSet_fromHex = hex_str => errorableToPurs(CSL.TransactionWitnessSet.from_hex, hex_str); -export const txWitnessSet_toJson = self => self.to_json(); -export const txWitnessSet_toJsValue = self => self.to_js_value(); -export const txWitnessSet_fromJson = json => errorableToPurs(CSL.TransactionWitnessSet.from_json, json); -export const txWitnessSet_setVkeys = self => vkeys => () => self.set_vkeys(vkeys); -export const txWitnessSet_vkeys = self => () => self.vkeys(); -export const txWitnessSet_setNativeScripts = self => native_scripts => () => self.set_native_scripts(native_scripts); -export const txWitnessSet_nativeScripts = self => () => self.native_scripts(); -export const txWitnessSet_setBootstraps = self => bootstraps => () => self.set_bootstraps(bootstraps); -export const txWitnessSet_bootstraps = self => () => self.bootstraps(); -export const txWitnessSet_setPlutusScripts = self => plutus_scripts => () => self.set_plutus_scripts(plutus_scripts); -export const txWitnessSet_plutusScripts = self => () => self.plutus_scripts(); -export const txWitnessSet_setPlutusData = self => plutus_data => () => self.set_plutus_data(plutus_data); -export const txWitnessSet_plutusData = self => () => self.plutus_data(); -export const txWitnessSet_setRedeemers = self => redeemers => () => self.set_redeemers(redeemers); -export const txWitnessSet_redeemers = self => () => self.redeemers(); -export const txWitnessSet_new = () => CSL.TransactionWitnessSet.new(); - -// TransactionWitnessSets -export const txWitnessSets_free = self => () => self.free(); -export const txWitnessSets_toBytes = self => self.to_bytes(); -export const txWitnessSets_fromBytes = bytes => errorableToPurs(CSL.TransactionWitnessSets.from_bytes, bytes); -export const txWitnessSets_toHex = self => self.to_hex(); -export const txWitnessSets_fromHex = hex_str => errorableToPurs(CSL.TransactionWitnessSets.from_hex, hex_str); -export const txWitnessSets_toJson = self => self.to_json(); -export const txWitnessSets_toJsValue = self => self.to_js_value(); -export const txWitnessSets_fromJson = json => errorableToPurs(CSL.TransactionWitnessSets.from_json, json); -export const txWitnessSets_new = () => CSL.TransactionWitnessSets.new(); -export const txWitnessSets_len = self => () => self.len(); -export const txWitnessSets_get = self => index => () => self.get(index); -export const txWitnessSets_add = self => elem => () => self.add(elem); - -// TxBuilderConstants -export const txBuilderConstants_free = self => () => self.free(); -export const txBuilderConstants_plutusDefaultCostModels = CSL.TxBuilderConstants.plutus_default_cost_models(); -export const txBuilderConstants_plutusAlonzoCostModels = CSL.TxBuilderConstants.plutus_alonzo_cost_models(); -export const txBuilderConstants_plutusVasilCostModels = CSL.TxBuilderConstants.plutus_vasil_cost_models(); - -// TxInputsBuilder -export const txInsBuilder_free = self => () => self.free(); -export const txInsBuilder_new = () => CSL.TxInputsBuilder.new(); -export const txInsBuilder_addKeyIn = self => hash => input => amount => () => self.add_key_input(hash, input, amount); -export const txInsBuilder_addScriptIn = self => hash => input => amount => () => self.add_script_input(hash, input, amount); -export const txInsBuilder_addNativeScriptIn = self => script => input => amount => () => self.add_native_script_input(script, input, amount); -export const txInsBuilder_addPlutusScriptIn = self => witness => input => amount => () => self.add_plutus_script_input(witness, input, amount); -export const txInsBuilder_addBootstrapIn = self => hash => input => amount => () => self.add_bootstrap_input(hash, input, amount); -export const txInsBuilder_addIn = self => address => input => amount => () => self.add_input(address, input, amount); -export const txInsBuilder_countMissingInScripts = self => () => self.count_missing_input_scripts(); -export const txInsBuilder_addRequiredNativeInScripts = self => scripts => () => self.add_required_native_input_scripts(scripts); -export const txInsBuilder_addRequiredPlutusInScripts = self => scripts => () => self.add_required_plutus_input_scripts(scripts); -export const txInsBuilder_getRefIns = self => () => self.get_ref_inputs(); -export const txInsBuilder_getNativeInScripts = self => () => self.get_native_input_scripts(); -export const txInsBuilder_getPlutusInScripts = self => () => self.get_plutus_input_scripts(); -export const txInsBuilder_len = self => () => self.len(); -export const txInsBuilder_addRequiredSigner = self => key => () => self.add_required_signer(key); -export const txInsBuilder_addRequiredSigners = self => keys => () => self.add_required_signers(keys); -export const txInsBuilder_totalValue = self => () => self.total_value(); -export const txInsBuilder_ins = self => () => self.inputs(); -export const txInsBuilder_insOption = self => () => self.inputs_option(); - -// URL -export const url_free = self => () => self.free(); -export const url_toBytes = self => self.to_bytes(); -export const url_fromBytes = bytes => errorableToPurs(CSL.URL.from_bytes, bytes); -export const url_toHex = self => self.to_hex(); -export const url_fromHex = hex_str => errorableToPurs(CSL.URL.from_hex, hex_str); -export const url_toJson = self => self.to_json(); -export const url_toJsValue = self => self.to_js_value(); -export const url_fromJson = json => errorableToPurs(CSL.URL.from_json, json); -export const url_new = url => CSL.URL.new(url); -export const url_url = self => self.url(); - -// UnitInterval -export const unitInterval_free = self => () => self.free(); -export const unitInterval_toBytes = self => self.to_bytes(); -export const unitInterval_fromBytes = bytes => errorableToPurs(CSL.UnitInterval.from_bytes, bytes); -export const unitInterval_toHex = self => self.to_hex(); -export const unitInterval_fromHex = hex_str => errorableToPurs(CSL.UnitInterval.from_hex, hex_str); -export const unitInterval_toJson = self => self.to_json(); -export const unitInterval_toJsValue = self => self.to_js_value(); -export const unitInterval_fromJson = json => errorableToPurs(CSL.UnitInterval.from_json, json); -export const unitInterval_numerator = self => self.numerator(); -export const unitInterval_denominator = self => self.denominator(); -export const unitInterval_new = numerator => denominator => CSL.UnitInterval.new(numerator, denominator); - -// Update -export const update_free = self => () => self.free(); -export const update_toBytes = self => self.to_bytes(); -export const update_fromBytes = bytes => errorableToPurs(CSL.Update.from_bytes, bytes); -export const update_toHex = self => self.to_hex(); -export const update_fromHex = hex_str => errorableToPurs(CSL.Update.from_hex, hex_str); -export const update_toJson = self => self.to_json(); -export const update_toJsValue = self => self.to_js_value(); -export const update_fromJson = json => errorableToPurs(CSL.Update.from_json, json); -export const update_proposedProtocolParameterUpdates = self => self.proposed_protocol_parameter_updates(); -export const update_epoch = self => self.epoch(); -export const update_new = proposed_protocol_parameter_updates => epoch => CSL.Update.new(proposed_protocol_parameter_updates, epoch); - -// VRFCert -export const vrfCert_free = self => () => self.free(); -export const vrfCert_toBytes = self => self.to_bytes(); -export const vrfCert_fromBytes = bytes => errorableToPurs(CSL.VRFCert.from_bytes, bytes); -export const vrfCert_toHex = self => self.to_hex(); -export const vrfCert_fromHex = hex_str => errorableToPurs(CSL.VRFCert.from_hex, hex_str); -export const vrfCert_toJson = self => self.to_json(); -export const vrfCert_toJsValue = self => self.to_js_value(); -export const vrfCert_fromJson = json => errorableToPurs(CSL.VRFCert.from_json, json); -export const vrfCert_out = self => self.output(); -export const vrfCert_proof = self => self.proof(); -export const vrfCert_new = output => proof => CSL.VRFCert.new(output, proof); - -// VRFKeyHash -export const vrfKeyHash_free = self => () => self.free(); -export const vrfKeyHash_fromBytes = bytes => errorableToPurs(CSL.VRFKeyHash.from_bytes, bytes); -export const vrfKeyHash_toBytes = self => self.to_bytes(); -export const vrfKeyHash_toBech32 = self => prefix => self.to_bech32(prefix); -export const vrfKeyHash_fromBech32 = bech_str => errorableToPurs(CSL.VRFKeyHash.from_bech32, bech_str); -export const vrfKeyHash_toHex = self => self.to_hex(); -export const vrfKeyHash_fromHex = hex => errorableToPurs(CSL.VRFKeyHash.from_hex, hex); - -// VRFVKey -export const vrfvKey_free = self => () => self.free(); -export const vrfvKey_fromBytes = bytes => errorableToPurs(CSL.VRFVKey.from_bytes, bytes); -export const vrfvKey_toBytes = self => self.to_bytes(); -export const vrfvKey_toBech32 = self => prefix => self.to_bech32(prefix); -export const vrfvKey_fromBech32 = bech_str => errorableToPurs(CSL.VRFVKey.from_bech32, bech_str); -export const vrfvKey_toHex = self => self.to_hex(); -export const vrfvKey_fromHex = hex => errorableToPurs(CSL.VRFVKey.from_hex, hex); - -// Value -export const value_free = self => () => self.free(); -export const value_toBytes = self => self.to_bytes(); -export const value_fromBytes = bytes => errorableToPurs(CSL.Value.from_bytes, bytes); -export const value_toHex = self => self.to_hex(); -export const value_fromHex = hex_str => errorableToPurs(CSL.Value.from_hex, hex_str); -export const value_toJson = self => self.to_json(); -export const value_toJsValue = self => self.to_js_value(); -export const value_fromJson = json => errorableToPurs(CSL.Value.from_json, json); -export const value_new = coin => CSL.Value.new(coin); -export const value_newFromAssets = multiasset => CSL.Value.new_from_assets(multiasset); -export const value_newWithAssets = coin => multiasset => CSL.Value.new_with_assets(coin, multiasset); -export const value_zero = CSL.Value.zero(); -export const value_isZero = self => self.is_zero(); -export const value_coin = self => self.coin(); -export const value_setCoin = self => coin => () => self.set_coin(coin); -export const value_multiasset = self => self.multiasset(); -export const value_setMultiasset = self => multiasset => () => self.set_multiasset(multiasset); -export const value_checkedAdd = self => rhs => self.checked_add(rhs); -export const value_checkedSub = self => rhs_value => self.checked_sub(rhs_value); -export const value_clampedSub = self => rhs_value => self.clamped_sub(rhs_value); -export const value_compare = self => rhs_value => self.compare(rhs_value); - -// Vkey -export const vkey_free = self => () => self.free(); -export const vkey_toBytes = self => self.to_bytes(); -export const vkey_fromBytes = bytes => errorableToPurs(CSL.Vkey.from_bytes, bytes); -export const vkey_toHex = self => self.to_hex(); -export const vkey_fromHex = hex_str => errorableToPurs(CSL.Vkey.from_hex, hex_str); -export const vkey_toJson = self => self.to_json(); -export const vkey_toJsValue = self => self.to_js_value(); -export const vkey_fromJson = json => errorableToPurs(CSL.Vkey.from_json, json); -export const vkey_new = pk => CSL.Vkey.new(pk); -export const vkey_publicKey = self => self.public_key(); - -// Vkeys -export const vkeys_free = self => () => self.free(); -export const vkeys_new = () => CSL.Vkeys.new(); -export const vkeys_len = self => () => self.len(); -export const vkeys_get = self => index => () => self.get(index); -export const vkeys_add = self => elem => () => self.add(elem); - -// Vkeywitness -export const vkeywitness_free = self => () => self.free(); -export const vkeywitness_toBytes = self => self.to_bytes(); -export const vkeywitness_fromBytes = bytes => errorableToPurs(CSL.Vkeywitness.from_bytes, bytes); -export const vkeywitness_toHex = self => self.to_hex(); -export const vkeywitness_fromHex = hex_str => errorableToPurs(CSL.Vkeywitness.from_hex, hex_str); -export const vkeywitness_toJson = self => self.to_json(); -export const vkeywitness_toJsValue = self => self.to_js_value(); -export const vkeywitness_fromJson = json => errorableToPurs(CSL.Vkeywitness.from_json, json); -export const vkeywitness_new = vkey => signature => CSL.Vkeywitness.new(vkey, signature); -export const vkeywitness_vkey = self => self.vkey(); -export const vkeywitness_signature = self => self.signature(); - -// Vkeywitnesses -export const vkeywitnesses_free = self => () => self.free(); -export const vkeywitnesses_new = () => CSL.Vkeywitnesses.new(); -export const vkeywitnesses_len = self => () => self.len(); -export const vkeywitnesses_get = self => index => () => self.get(index); -export const vkeywitnesses_add = self => elem => () => self.add(elem); - -// Withdrawals -export const withdrawals_free = self => () => self.free(); -export const withdrawals_toBytes = self => self.to_bytes(); -export const withdrawals_fromBytes = bytes => errorableToPurs(CSL.Withdrawals.from_bytes, bytes); -export const withdrawals_toHex = self => self.to_hex(); -export const withdrawals_fromHex = hex_str => errorableToPurs(CSL.Withdrawals.from_hex, hex_str); -export const withdrawals_toJson = self => self.to_json(); -export const withdrawals_toJsValue = self => self.to_js_value(); -export const withdrawals_fromJson = json => errorableToPurs(CSL.Withdrawals.from_json, json); -export const withdrawals_new = () => CSL.Withdrawals.new(); -export const withdrawals_len = self => () => self.len(); -export const withdrawals_insert = self => key => value => () => self.insert(key, value); -export const withdrawals_get = self => key => () => self.get(key); -export const withdrawals_keys = self => () => self.keys(); - diff --git a/src/Csl.purs b/src/Csl.purs deleted file mode 100644 index dfaae06..0000000 --- a/src/Csl.purs +++ /dev/null @@ -1,14209 +0,0 @@ --- | Common CSL types and functions that can be work as if they are pure --- --- Missing parts --- * generate JSON types and convertions --- * Handle Maybes / Nullables --- * explicit export list to hide raw FFI funs -module Csl - ( Bytes - , class IsHex, toHex, fromHex, fromHex' - , class IsBech32, toBech32, fromBech32, fromBech32' - , class IsJson, toJson, fromJson, fromJson' - , class IsStr, toStr, fromStr, fromStr' - , class IsBytes, toBytes, fromBytes, fromBytes' - , class ToJsValue, toJsValue - , class HasFree, free - , class MutableLen, getLen - , class MutableList, getItem, addItem, emptyList - , toMutableList - , minFee - , calculateExUnitsCeilCost - , minScriptFee - , encryptWithPassword - , decryptWithPassword - , makeDaedalusBootstrapWitness - , makeIcarusBootstrapWitness - , makeVkeyWitness - , hashAuxiliaryData - , hashTx - , hashPlutusData - , hashScriptData - , getImplicitIn - , getDeposit - , minAdaForOut - , minAdaRequired - , encodeJsonStrToNativeScript - , encodeJsonStrToPlutusDatum - , decodePlutusDatumToJsonStr - , encodeArbitraryBytesAsMetadatum - , decodeArbitraryBytesFromMetadatum - , encodeJsonStrToMetadatum - , decodeMetadatumToJsonStr - , int - , IntClass - , Address - , AddressClass - , address - , AddressJson - , AssetName - , AssetNameClass - , assetName - , AssetNameJson - , AssetNames - , AssetNamesClass - , assetNames - , AssetNamesJson - , Assets - , AssetsClass - , assets - , AssetsJson - , AuxiliaryData - , AuxiliaryDataClass - , auxiliaryData - , AuxiliaryDataHash - , AuxiliaryDataHashClass - , auxiliaryDataHash - , AuxiliaryDataJson - , AuxiliaryDataSet - , AuxiliaryDataSetClass - , auxiliaryDataSet - , BaseAddress - , BaseAddressClass - , baseAddress - , BigInt - , BigIntClass - , bigInt - , BigIntJson - , BigNum - , BigNumClass - , bigNum - , BigNumJson - , Bip32PrivateKey - , Bip32PrivateKeyClass - , bip32PrivateKey - , Bip32PublicKey - , Bip32PublicKeyClass - , bip32PublicKey - , Block - , BlockClass - , block - , BlockHash - , BlockHashClass - , blockHash - , BlockJson - , BootstrapWitness - , BootstrapWitnessClass - , bootstrapWitness - , BootstrapWitnessJson - , BootstrapWitnesses - , BootstrapWitnessesClass - , bootstrapWitnesses - , ByronAddress - , ByronAddressClass - , byronAddress - , Certificate - , CertificateClass - , certificate - , CertificateJson - , Certificates - , CertificatesClass - , certificates - , CertificatesJson - , ConstrPlutusData - , ConstrPlutusDataClass - , constrPlutusData - , ConstrPlutusDataJson - , CostModel - , CostModelClass - , costModel - , CostModelJson - , Costmdls - , CostmdlsClass - , costmdls - , CostmdlsJson - , DNSRecordAorAAAA - , DNSRecordAorAAAAClass - , dnsRecordAorAAAA - , DNSRecordAorAAAAJson - , DNSRecordSRV - , DNSRecordSRVClass - , dnsRecordSRV - , DNSRecordSRVJson - , DataCost - , DataCostClass - , dataCost - , DataHash - , DataHashClass - , dataHash - , DatumSource - , DatumSourceClass - , datumSource - , Ed25519KeyHash - , Ed25519KeyHashClass - , ed25519KeyHash - , Ed25519KeyHashes - , Ed25519KeyHashesClass - , ed25519KeyHashes - , Ed25519KeyHashesJson - , Ed25519Signature - , Ed25519SignatureClass - , ed25519Signature - , EnterpriseAddress - , EnterpriseAddressClass - , enterpriseAddress - , ExUnitPrices - , ExUnitPricesClass - , exUnitPrices - , ExUnitPricesJson - , ExUnits - , ExUnitsClass - , exUnits - , ExUnitsJson - , GeneralTxMetadata - , GeneralTxMetadataClass - , generalTxMetadata - , GeneralTxMetadataJson - , GenesisDelegateHash - , GenesisDelegateHashClass - , genesisDelegateHash - , GenesisHash - , GenesisHashClass - , genesisHash - , GenesisHashes - , GenesisHashesClass - , genesisHashes - , GenesisHashesJson - , GenesisKeyDelegation - , GenesisKeyDelegationClass - , genesisKeyDelegation - , GenesisKeyDelegationJson - , Header - , HeaderClass - , header - , HeaderBody - , HeaderBodyClass - , headerBody - , HeaderBodyJson - , HeaderJson - , IntJson - , Ipv4 - , Ipv4Class - , ipv4 - , Ipv4Json - , Ipv6 - , Ipv6Class - , ipv6 - , Ipv6Json - , KESSignature - , KESSignatureClass - , kesSignature - , KESVKey - , KESVKeyClass - , kesvKey - , Language - , LanguageClass - , language - , LanguageJson - , Languages - , LanguagesClass - , languages - , LegacyDaedalusPrivateKey - , LegacyDaedalusPrivateKeyClass - , legacyDaedalusPrivateKey - , LinearFee - , LinearFeeClass - , linearFee - , MIRToStakeCredentials - , MIRToStakeCredentialsClass - , mirToStakeCredentials - , MIRToStakeCredentialsJson - , MetadataList - , MetadataListClass - , metadataList - , MetadataMap - , MetadataMapClass - , metadataMap - , Mint - , MintClass - , mint - , MintAssets - , MintAssetsClass - , mintAssets - , MintJson - , MoveInstantaneousReward - , MoveInstantaneousRewardClass - , moveInstantaneousReward - , MoveInstantaneousRewardJson - , MoveInstantaneousRewardsCert - , MoveInstantaneousRewardsCertClass - , moveInstantaneousRewardsCert - , MoveInstantaneousRewardsCertJson - , MultiAsset - , MultiAssetClass - , multiAsset - , MultiAssetJson - , MultiHostName - , MultiHostNameClass - , multiHostName - , MultiHostNameJson - , NativeScript - , NativeScriptClass - , nativeScript - , NativeScriptJson - , NativeScripts - , NativeScriptsClass - , nativeScripts - , NetworkId - , NetworkIdClass - , networkId - , NetworkIdJson - , NetworkInfo - , NetworkInfoClass - , networkInfo - , Nonce - , NonceClass - , nonce - , NonceJson - , OperationalCert - , OperationalCertClass - , operationalCert - , OperationalCertJson - , PlutusData - , PlutusDataClass - , plutusData - , PlutusDataJson - , PlutusList - , PlutusListClass - , plutusList - , PlutusListJson - , PlutusMap - , PlutusMapClass - , plutusMap - , PlutusMapJson - , PlutusScript - , PlutusScriptClass - , plutusScript - , PlutusScriptSource - , PlutusScriptSourceClass - , plutusScriptSource - , PlutusScripts - , PlutusScriptsClass - , plutusScripts - , PlutusScriptsJson - , PlutusWitness - , PlutusWitnessClass - , plutusWitness - , PlutusWitnesses - , PlutusWitnessesClass - , plutusWitnesses - , Pointer - , PointerClass - , pointer - , PointerAddress - , PointerAddressClass - , pointerAddress - , PoolMetadata - , PoolMetadataClass - , poolMetadata - , PoolMetadataHash - , PoolMetadataHashClass - , poolMetadataHash - , PoolMetadataJson - , PoolParams - , PoolParamsClass - , poolParams - , PoolParamsJson - , PoolRegistration - , PoolRegistrationClass - , poolRegistration - , PoolRegistrationJson - , PoolRetirement - , PoolRetirementClass - , poolRetirement - , PoolRetirementJson - , PrivateKey - , PrivateKeyClass - , privateKey - , ProposedProtocolParameterUpdates - , ProposedProtocolParameterUpdatesClass - , proposedProtocolParameterUpdates - , ProposedProtocolParameterUpdatesJson - , ProtocolParamUpdate - , ProtocolParamUpdateClass - , protocolParamUpdate - , ProtocolParamUpdateJson - , ProtocolVersion - , ProtocolVersionClass - , protocolVersion - , ProtocolVersionJson - , PublicKey - , PublicKeyClass - , publicKey - , PublicKeys - , PublicKeysClass - , publicKeys - , Redeemer - , RedeemerClass - , redeemer - , RedeemerJson - , RedeemerTag - , RedeemerTagClass - , redeemerTag - , RedeemerTagJson - , Redeemers - , RedeemersClass - , redeemers - , RedeemersJson - , Relay - , RelayClass - , relay - , RelayJson - , Relays - , RelaysClass - , relays - , RelaysJson - , RewardAddress - , RewardAddressClass - , rewardAddress - , RewardAddresses - , RewardAddressesClass - , rewardAddresses - , RewardAddressesJson - , ScriptAll - , ScriptAllClass - , scriptAll - , ScriptAllJson - , ScriptAny - , ScriptAnyClass - , scriptAny - , ScriptAnyJson - , ScriptDataHash - , ScriptDataHashClass - , scriptDataHash - , ScriptHash - , ScriptHashClass - , scriptHash - , ScriptHashes - , ScriptHashesClass - , scriptHashes - , ScriptHashesJson - , ScriptNOfK - , ScriptNOfKClass - , scriptNOfK - , ScriptNOfKJson - , ScriptPubkey - , ScriptPubkeyClass - , scriptPubkey - , ScriptPubkeyJson - , ScriptRef - , ScriptRefClass - , scriptRef - , ScriptRefJson - , SingleHostAddr - , SingleHostAddrClass - , singleHostAddr - , SingleHostAddrJson - , SingleHostName - , SingleHostNameClass - , singleHostName - , SingleHostNameJson - , StakeCredential - , StakeCredentialClass - , stakeCredential - , StakeCredentialJson - , StakeCredentials - , StakeCredentialsClass - , stakeCredentials - , StakeCredentialsJson - , StakeDelegation - , StakeDelegationClass - , stakeDelegation - , StakeDelegationJson - , StakeDeregistration - , StakeDeregistrationClass - , stakeDeregistration - , StakeDeregistrationJson - , StakeRegistration - , StakeRegistrationClass - , stakeRegistration - , StakeRegistrationJson - , Strings - , StringsClass - , strings - , TimelockExpiry - , TimelockExpiryClass - , timelockExpiry - , TimelockExpiryJson - , TimelockStart - , TimelockStartClass - , timelockStart - , TimelockStartJson - , Tx - , TxClass - , tx - , TxBodies - , TxBodiesClass - , txBodies - , TxBodiesJson - , TxBody - , TxBodyClass - , txBody - , TxBodyJson - , TxBuilder - , TxBuilderClass - , txBuilder - , TxBuilderConfig - , TxBuilderConfigClass - , txBuilderConfig - , TxBuilderConfigBuilder - , TxBuilderConfigBuilderClass - , txBuilderConfigBuilder - , TxHash - , TxHashClass - , txHash - , TxIn - , TxInClass - , txIn - , TxInJson - , TxIns - , TxInsClass - , txIns - , TxInsJson - , TxJson - , TxMetadatum - , TxMetadatumClass - , txMetadatum - , TxMetadatumLabels - , TxMetadatumLabelsClass - , txMetadatumLabels - , TxOut - , TxOutClass - , txOut - , TxOutAmountBuilder - , TxOutAmountBuilderClass - , txOutAmountBuilder - , TxOutBuilder - , TxOutBuilderClass - , txOutBuilder - , TxOutJson - , TxOuts - , TxOutsClass - , txOuts - , TxOutsJson - , TxUnspentOut - , TxUnspentOutClass - , txUnspentOut - , TxUnspentOutJson - , TxUnspentOuts - , TxUnspentOutsClass - , txUnspentOuts - , TxUnspentOutsJson - , TxWitnessSet - , TxWitnessSetClass - , txWitnessSet - , TxWitnessSetJson - , TxWitnessSets - , TxWitnessSetsClass - , txWitnessSets - , TxWitnessSetsJson - , TxBuilderConstants - , TxBuilderConstantsClass - , txBuilderConstants - , TxInsBuilder - , TxInsBuilderClass - , txInsBuilder - , URL - , URLClass - , url - , URLJson - , Uint32Array - , UnitInterval - , UnitIntervalClass - , unitInterval - , UnitIntervalJson - , Update - , UpdateClass - , update - , UpdateJson - , VRFCert - , VRFCertClass - , vrfCert - , VRFCertJson - , VRFKeyHash - , VRFKeyHashClass - , vrfKeyHash - , VRFVKey - , VRFVKeyClass - , vrfvKey - , Value - , ValueClass - , value - , ValueJson - , Vkey - , VkeyClass - , vkey - , VkeyJson - , Vkeys - , VkeysClass - , vkeys - , Vkeywitness - , VkeywitnessClass - , vkeywitness - , VkeywitnessJson - , Vkeywitnesses - , VkeywitnessesClass - , vkeywitnesses - , Withdrawals - , WithdrawalsClass - , withdrawals - , WithdrawalsJson - , This - ) where - -import Prelude -import Data.Either (Either(..), hush) -import Data.Foldable (traverse_) -import Data.ArrayBuffer.Types (Uint8Array) -import Effect (Effect) -import Data.Maybe (Maybe(..), fromJust) -import Data.Argonaut.Core (Json) -import Data.Nullable (Nullable) -import Data.Nullable as Nullable -import Partial.Unsafe (unsafePartial) - ----------------------------------------------------------------------------- --- utils - -type Bytes = Uint8Array - -fromCompare :: Int -> Ordering -fromCompare n - | n < 0 = LT - | n > 0 = GT - | otherwise = EQ - --- Utils for type conversions -type ForeignErrorable a = - (String -> Either String a) -> (a -> Either String a) -> Either String a - -runForeignErrorable :: forall (a :: Type). ForeignErrorable a -> Either String a -runForeignErrorable f = f Left Right - -runForeignMaybe :: forall (a :: Type). ForeignErrorable a -> Maybe a -runForeignMaybe = hush <<< runForeignErrorable - -getJust :: forall (a :: Type). Maybe a -> a -getJust a = unsafePartial (fromJust a) - ----------------------------------------------------------------------------- --- classes - -class IsHex a where - toHex :: a -> String - fromHex :: String -> Maybe a - --- | Unsafe version of @fromHex@ -fromHex' :: forall (a :: Type). IsHex a => String -> a -fromHex' = getJust <<< fromHex - -class IsStr a where - toStr :: a -> String - fromStr :: String -> Maybe a - --- | Unsafe version of @fromStr@ -fromStr' :: forall (a :: Type). IsStr a => String -> a -fromStr' = getJust <<< fromStr - -class IsBech32 a where - toBech32 :: a -> String - fromBech32 :: String -> Maybe a - --- | Unsafe version of @fromBech32@ -fromBech32' :: forall (a :: Type). IsBech32 a => String -> a -fromBech32' = getJust <<< fromBech32 - -class IsJson a where - toJson :: a -> String - fromJson :: String -> Maybe a - --- | Unsafe version of @fromJson@ -fromJson' :: forall (a :: Type). IsJson a => String -> a -fromJson' = getJust <<< fromJson - -class ToJsValue a where - toJsValue :: a -> Json - -class IsBytes a where - toBytes :: a -> Bytes - fromBytes :: Bytes -> Maybe a - --- | Unsafe version of @fromJson@ -fromBytes' :: forall (a :: Type). IsBytes a => Bytes -> a -fromBytes' = getJust <<< fromBytes - -class HasFree a where - free :: a -> Effect Unit - -class MutableLen list where - getLen :: list -> Effect Int - -class MutableList list elem | list -> elem where - emptyList :: Effect list - addItem :: list -> elem -> Effect Unit - getItem :: list -> Int -> Effect elem - -toMutableList - :: forall (list :: Type) (a :: Type) - . MutableList list a - => Array a -> Effect list -toMutableList as = do - res <- emptyList - traverse_ (addItem res) as - pure res - ----------------------------------------------------------------------------- --- custom instances - --- BigNum - -instance Semiring BigNum where - add = bigNum.checkedAdd - mul = bigNum.checkedMul - one = bigNum.one - zero = bigNum.zero - -instance Ring BigNum where - sub = bigNum.checkedSub - -instance CommutativeRing BigNum - -instance Eq BigNum where - eq a b = bigNum.compare a b == 0 - -instance Ord BigNum where - compare a b = fromCompare (bigNum.compare a b) - --- BigInt - -instance Semiring BigInt where - add = bigInt.add - mul = bigInt.mul - one = bigInt.one - zero = fromStr' "zero undefined" - --- Value - -instance Monoid Value where - mempty = value.zero - -instance Semigroup Value where - append = value.checkedAdd - -instance Eq Value where - eq a b = value.compare a b == Just 0 - ----------------------------------------------------------------------------- --- functions - --- | Min fee --- > minFee tx linearFee -foreign import minFee :: Tx -> LinearFee -> BigNum - --- | Calculate ex units ceil cost --- > calculateExUnitsCeilCost exUnits exUnitPrices -foreign import calculateExUnitsCeilCost :: ExUnits -> ExUnitPrices -> BigNum - --- | Min script fee --- > minScriptFee tx exUnitPrices -foreign import minScriptFee :: Tx -> ExUnitPrices -> BigNum - --- | Encrypt with password --- > encryptWithPassword password salt nonce data -foreign import encryptWithPassword :: String -> String -> String -> String -> String - --- | Decrypt with password --- > decryptWithPassword password data -foreign import decryptWithPassword :: String -> String -> String - --- | Make daedalus bootstrap witness --- > makeDaedalusBootstrapWitness txBodyHash addr key -foreign import makeDaedalusBootstrapWitness :: TxHash -> ByronAddress -> LegacyDaedalusPrivateKey -> BootstrapWitness - --- | Make icarus bootstrap witness --- > makeIcarusBootstrapWitness txBodyHash addr key -foreign import makeIcarusBootstrapWitness :: TxHash -> ByronAddress -> Bip32PrivateKey -> BootstrapWitness - --- | Make vkey witness --- > makeVkeyWitness txBodyHash sk -foreign import makeVkeyWitness :: TxHash -> PrivateKey -> Vkeywitness - --- | Hash auxiliary data --- > hashAuxiliaryData auxiliaryData -foreign import hashAuxiliaryData :: AuxiliaryData -> AuxiliaryDataHash - --- | Hash transaction --- > hashTx txBody -foreign import hashTx :: TxBody -> TxHash - --- | Hash plutus data --- > hashPlutusData plutusData -foreign import hashPlutusData :: PlutusData -> DataHash - --- | Hash script data --- > hashScriptData redeemers costModels datums -foreign import hashScriptData :: Redeemers -> Costmdls -> PlutusList -> ScriptDataHash - --- | Get implicit input --- > getImplicitIn txbody poolDeposit keyDeposit -foreign import getImplicitIn :: TxBody -> BigNum -> BigNum -> Value - --- | Get deposit --- > getDeposit txbody poolDeposit keyDeposit -foreign import getDeposit :: TxBody -> BigNum -> BigNum -> BigNum - --- | Min ada for output --- > minAdaForOut out dataCost -foreign import minAdaForOut :: TxOut -> DataCost -> BigNum - --- | Min ada required --- > minAdaRequired assets hasDataHash coinsPerUtxoWord -foreign import minAdaRequired :: Value -> Boolean -> BigNum -> BigNum - --- | Encode json str to native script --- > encodeJsonStrToNativeScript json selfXpub schema -foreign import encodeJsonStrToNativeScript :: String -> String -> Number -> NativeScript - --- | Encode json str to plutus datum --- > encodeJsonStrToPlutusDatum json schema -foreign import encodeJsonStrToPlutusDatum :: String -> Number -> PlutusData - --- | Decode plutus datum to json str --- > decodePlutusDatumToJsonStr datum schema -foreign import decodePlutusDatumToJsonStr :: PlutusData -> Number -> String - --- | Encode arbitrary bytes as metadatum --- > encodeArbitraryBytesAsMetadatum bytes -foreign import encodeArbitraryBytesAsMetadatum :: Bytes -> TxMetadatum - --- | Decode arbitrary bytes from metadatum --- > decodeArbitraryBytesFromMetadatum metadata -foreign import decodeArbitraryBytesFromMetadatum :: TxMetadatum -> Bytes - --- | Encode json str to metadatum --- > encodeJsonStrToMetadatum json schema -foreign import encodeJsonStrToMetadatum :: String -> Number -> TxMetadatum - --- | Decode metadatum to json str --- > decodeMetadatumToJsonStr metadatum schema -foreign import decodeMetadatumToJsonStr :: TxMetadatum -> Number -> String - ----------------------------------------------------------------------------- --- types / classes - --- | Address -foreign import data Address :: Type - --- | Address json -type AddressJson = Json - --- | Asset name -foreign import data AssetName :: Type - --- | Asset name json -type AssetNameJson = Json - --- | Asset names -foreign import data AssetNames :: Type - --- | Asset names json -type AssetNamesJson = Json - --- | Assets -foreign import data Assets :: Type - --- | Assets json -type AssetsJson = Json - --- | Auxiliary data -foreign import data AuxiliaryData :: Type - --- | Auxiliary data hash -foreign import data AuxiliaryDataHash :: Type - --- | Auxiliary data json -type AuxiliaryDataJson = Json - --- | Auxiliary data set -foreign import data AuxiliaryDataSet :: Type - --- | Base address -foreign import data BaseAddress :: Type - --- | Big int -foreign import data BigInt :: Type - --- | Big int json -type BigIntJson = Json - --- | Big num -foreign import data BigNum :: Type - --- | Big num json -type BigNumJson = Json - --- | Bip32 private key -foreign import data Bip32PrivateKey :: Type - --- | Bip32 public key -foreign import data Bip32PublicKey :: Type - --- | Block -foreign import data Block :: Type - --- | Block hash -foreign import data BlockHash :: Type - --- | Block json -type BlockJson = Json - --- | Bootstrap witness -foreign import data BootstrapWitness :: Type - --- | Bootstrap witness json -type BootstrapWitnessJson = Json - --- | Bootstrap witnesses -foreign import data BootstrapWitnesses :: Type - --- | Byron address -foreign import data ByronAddress :: Type - --- | Certificate -foreign import data Certificate :: Type - --- | Certificate json -type CertificateJson = Json - --- | Certificates -foreign import data Certificates :: Type - --- | Certificates json -type CertificatesJson = Json - --- | Constr plutus data -foreign import data ConstrPlutusData :: Type - --- | Constr plutus data json -type ConstrPlutusDataJson = Json - --- | Cost model -foreign import data CostModel :: Type - --- | Cost model json -type CostModelJson = Json - --- | Costmdls -foreign import data Costmdls :: Type - --- | Costmdls json -type CostmdlsJson = Json - --- | DNSRecord aor aaaa -foreign import data DNSRecordAorAAAA :: Type - --- | DNSRecord aor aaaaJson -type DNSRecordAorAAAAJson = Json - --- | DNSRecord srv -foreign import data DNSRecordSRV :: Type - --- | DNSRecord srvJson -type DNSRecordSRVJson = Json - --- | Data cost -foreign import data DataCost :: Type - --- | Data hash -foreign import data DataHash :: Type - --- | Datum source -foreign import data DatumSource :: Type - --- | Ed25519 key hash -foreign import data Ed25519KeyHash :: Type - --- | Ed25519 key hashes -foreign import data Ed25519KeyHashes :: Type - --- | Ed25519 key hashes json -type Ed25519KeyHashesJson = Json - --- | Ed25519 signature -foreign import data Ed25519Signature :: Type - --- | Enterprise address -foreign import data EnterpriseAddress :: Type - --- | Ex unit prices -foreign import data ExUnitPrices :: Type - --- | Ex unit prices json -type ExUnitPricesJson = Json - --- | Ex units -foreign import data ExUnits :: Type - --- | Ex units json -type ExUnitsJson = Json - --- | General tx metadata -foreign import data GeneralTxMetadata :: Type - --- | General tx metadata json -type GeneralTxMetadataJson = Json - --- | Genesis delegate hash -foreign import data GenesisDelegateHash :: Type - --- | Genesis hash -foreign import data GenesisHash :: Type - --- | Genesis hashes -foreign import data GenesisHashes :: Type - --- | Genesis hashes json -type GenesisHashesJson = Json - --- | Genesis key delegation -foreign import data GenesisKeyDelegation :: Type - --- | Genesis key delegation json -type GenesisKeyDelegationJson = Json - --- | Header -foreign import data Header :: Type - --- | Header body -foreign import data HeaderBody :: Type - --- | Header body json -type HeaderBodyJson = Json - --- | Header json -type HeaderJson = Json - --- | Int json -type IntJson = Json - --- | Ipv4 -foreign import data Ipv4 :: Type - --- | Ipv4 json -type Ipv4Json = Json - --- | Ipv6 -foreign import data Ipv6 :: Type - --- | Ipv6 json -type Ipv6Json = Json - --- | KESSignature -foreign import data KESSignature :: Type - --- | KESVKey -foreign import data KESVKey :: Type - --- | Language -foreign import data Language :: Type - --- | Language json -type LanguageJson = Json - --- | Languages -foreign import data Languages :: Type - --- | Legacy daedalus private key -foreign import data LegacyDaedalusPrivateKey :: Type - --- | Linear fee -foreign import data LinearFee :: Type - --- | MIRTo stake credentials -foreign import data MIRToStakeCredentials :: Type - --- | MIRTo stake credentials json -type MIRToStakeCredentialsJson = Json - --- | Metadata list -foreign import data MetadataList :: Type - --- | Metadata map -foreign import data MetadataMap :: Type - --- | Mint -foreign import data Mint :: Type - --- | Mint assets -foreign import data MintAssets :: Type - --- | Mint json -type MintJson = Json - --- | Move instantaneous reward -foreign import data MoveInstantaneousReward :: Type - --- | Move instantaneous reward json -type MoveInstantaneousRewardJson = Json - --- | Move instantaneous rewards cert -foreign import data MoveInstantaneousRewardsCert :: Type - --- | Move instantaneous rewards cert json -type MoveInstantaneousRewardsCertJson = Json - --- | Multi asset -foreign import data MultiAsset :: Type - --- | Multi asset json -type MultiAssetJson = Json - --- | Multi host name -foreign import data MultiHostName :: Type - --- | Multi host name json -type MultiHostNameJson = Json - --- | Native script -foreign import data NativeScript :: Type - --- | Native script json -type NativeScriptJson = Json - --- | Native scripts -foreign import data NativeScripts :: Type - --- | Network id -foreign import data NetworkId :: Type - --- | Network id json -type NetworkIdJson = Json - --- | Network info -foreign import data NetworkInfo :: Type - --- | Nonce -foreign import data Nonce :: Type - --- | Nonce json -type NonceJson = Json - --- | Operational cert -foreign import data OperationalCert :: Type - --- | Operational cert json -type OperationalCertJson = Json - --- | Plutus data -foreign import data PlutusData :: Type - --- | Plutus data json -type PlutusDataJson = Json - --- | Plutus list -foreign import data PlutusList :: Type - --- | Plutus list json -type PlutusListJson = Json - --- | Plutus map -foreign import data PlutusMap :: Type - --- | Plutus map json -type PlutusMapJson = Json - --- | Plutus script -foreign import data PlutusScript :: Type - --- | Plutus script source -foreign import data PlutusScriptSource :: Type - --- | Plutus scripts -foreign import data PlutusScripts :: Type - --- | Plutus scripts json -type PlutusScriptsJson = Json - --- | Plutus witness -foreign import data PlutusWitness :: Type - --- | Plutus witnesses -foreign import data PlutusWitnesses :: Type - --- | Pointer -foreign import data Pointer :: Type - --- | Pointer address -foreign import data PointerAddress :: Type - --- | Pool metadata -foreign import data PoolMetadata :: Type - --- | Pool metadata hash -foreign import data PoolMetadataHash :: Type - --- | Pool metadata json -type PoolMetadataJson = Json - --- | Pool params -foreign import data PoolParams :: Type - --- | Pool params json -type PoolParamsJson = Json - --- | Pool registration -foreign import data PoolRegistration :: Type - --- | Pool registration json -type PoolRegistrationJson = Json - --- | Pool retirement -foreign import data PoolRetirement :: Type - --- | Pool retirement json -type PoolRetirementJson = Json - --- | Private key -foreign import data PrivateKey :: Type - --- | Proposed protocol parameter updates -foreign import data ProposedProtocolParameterUpdates :: Type - --- | Proposed protocol parameter updates json -type ProposedProtocolParameterUpdatesJson = Json - --- | Protocol param update -foreign import data ProtocolParamUpdate :: Type - --- | Protocol param update json -type ProtocolParamUpdateJson = Json - --- | Protocol version -foreign import data ProtocolVersion :: Type - --- | Protocol version json -type ProtocolVersionJson = Json - --- | Public key -foreign import data PublicKey :: Type - --- | Public keys -foreign import data PublicKeys :: Type - --- | Redeemer -foreign import data Redeemer :: Type - --- | Redeemer json -type RedeemerJson = Json - --- | Redeemer tag -foreign import data RedeemerTag :: Type - --- | Redeemer tag json -type RedeemerTagJson = Json - --- | Redeemers -foreign import data Redeemers :: Type - --- | Redeemers json -type RedeemersJson = Json - --- | Relay -foreign import data Relay :: Type - --- | Relay json -type RelayJson = Json - --- | Relays -foreign import data Relays :: Type - --- | Relays json -type RelaysJson = Json - --- | Reward address -foreign import data RewardAddress :: Type - --- | Reward addresses -foreign import data RewardAddresses :: Type - --- | Reward addresses json -type RewardAddressesJson = Json - --- | Script all -foreign import data ScriptAll :: Type - --- | Script all json -type ScriptAllJson = Json - --- | Script any -foreign import data ScriptAny :: Type - --- | Script any json -type ScriptAnyJson = Json - --- | Script data hash -foreign import data ScriptDataHash :: Type - --- | Script hash -foreign import data ScriptHash :: Type - --- | Script hashes -foreign import data ScriptHashes :: Type - --- | Script hashes json -type ScriptHashesJson = Json - --- | Script nOf k -foreign import data ScriptNOfK :: Type - --- | Script nOf kJson -type ScriptNOfKJson = Json - --- | Script pubkey -foreign import data ScriptPubkey :: Type - --- | Script pubkey json -type ScriptPubkeyJson = Json - --- | Script ref -foreign import data ScriptRef :: Type - --- | Script ref json -type ScriptRefJson = Json - --- | Single host addr -foreign import data SingleHostAddr :: Type - --- | Single host addr json -type SingleHostAddrJson = Json - --- | Single host name -foreign import data SingleHostName :: Type - --- | Single host name json -type SingleHostNameJson = Json - --- | Stake credential -foreign import data StakeCredential :: Type - --- | Stake credential json -type StakeCredentialJson = Json - --- | Stake credentials -foreign import data StakeCredentials :: Type - --- | Stake credentials json -type StakeCredentialsJson = Json - --- | Stake delegation -foreign import data StakeDelegation :: Type - --- | Stake delegation json -type StakeDelegationJson = Json - --- | Stake deregistration -foreign import data StakeDeregistration :: Type - --- | Stake deregistration json -type StakeDeregistrationJson = Json - --- | Stake registration -foreign import data StakeRegistration :: Type - --- | Stake registration json -type StakeRegistrationJson = Json - --- | Strings -foreign import data Strings :: Type - --- | Timelock expiry -foreign import data TimelockExpiry :: Type - --- | Timelock expiry json -type TimelockExpiryJson = Json - --- | Timelock start -foreign import data TimelockStart :: Type - --- | Timelock start json -type TimelockStartJson = Json - --- | Tx -foreign import data Tx :: Type - --- | Tx bodies -foreign import data TxBodies :: Type - --- | Tx bodies json -type TxBodiesJson = Json - --- | Tx body -foreign import data TxBody :: Type - --- | Tx body json -type TxBodyJson = Json - --- | Tx builder -foreign import data TxBuilder :: Type - --- | Tx builder config -foreign import data TxBuilderConfig :: Type - --- | Tx builder config builder -foreign import data TxBuilderConfigBuilder :: Type - --- | Tx hash -foreign import data TxHash :: Type - --- | Tx in -foreign import data TxIn :: Type - --- | Tx in json -type TxInJson = Json - --- | Tx ins -foreign import data TxIns :: Type - --- | Tx ins json -type TxInsJson = Json - --- | Tx json -type TxJson = Json - --- | Tx metadatum -foreign import data TxMetadatum :: Type - --- | Tx metadatum labels -foreign import data TxMetadatumLabels :: Type - --- | Tx out -foreign import data TxOut :: Type - --- | Tx out amount builder -foreign import data TxOutAmountBuilder :: Type - --- | Tx out builder -foreign import data TxOutBuilder :: Type - --- | Tx out json -type TxOutJson = Json - --- | Tx outs -foreign import data TxOuts :: Type - --- | Tx outs json -type TxOutsJson = Json - --- | Tx unspent out -foreign import data TxUnspentOut :: Type - --- | Tx unspent out json -type TxUnspentOutJson = Json - --- | Tx unspent outs -foreign import data TxUnspentOuts :: Type - --- | Tx unspent outs json -type TxUnspentOutsJson = Json - --- | Tx witness set -foreign import data TxWitnessSet :: Type - --- | Tx witness set json -type TxWitnessSetJson = Json - --- | Tx witness sets -foreign import data TxWitnessSets :: Type - --- | Tx witness sets json -type TxWitnessSetsJson = Json - --- | Tx builder constants -foreign import data TxBuilderConstants :: Type - --- | Tx ins builder -foreign import data TxInsBuilder :: Type - --- | URL -foreign import data URL :: Type - --- | URLJson -type URLJson = Json - --- | Uint32 array -foreign import data Uint32Array :: Type - --- | Unit interval -foreign import data UnitInterval :: Type - --- | Unit interval json -type UnitIntervalJson = Json - --- | Update -foreign import data Update :: Type - --- | Update json -type UpdateJson = Json - --- | VRFCert -foreign import data VRFCert :: Type - --- | VRFCert json -type VRFCertJson = Json - --- | VRFKey hash -foreign import data VRFKeyHash :: Type - --- | VRFVKey -foreign import data VRFVKey :: Type - --- | Value -foreign import data Value :: Type - --- | Value json -type ValueJson = Json - --- | Vkey -foreign import data Vkey :: Type - --- | Vkey json -type VkeyJson = Json - --- | Vkeys -foreign import data Vkeys :: Type - --- | Vkeywitness -foreign import data Vkeywitness :: Type - --- | Vkeywitness json -type VkeywitnessJson = Json - --- | Vkeywitnesses -foreign import data Vkeywitnesses :: Type - --- | Withdrawals -foreign import data Withdrawals :: Type - --- | Withdrawals json -type WithdrawalsJson = Json - --- | This -foreign import data This :: Type - - -------------------------------------------------------------------------------------- --- Address - -foreign import address_free :: Address -> Effect Unit -foreign import address_fromBytes :: Bytes -> ForeignErrorable Address -foreign import address_toJson :: Address -> String -foreign import address_toJsValue :: Address -> AddressJson -foreign import address_fromJson :: String -> ForeignErrorable Address -foreign import address_toHex :: Address -> String -foreign import address_fromHex :: String -> ForeignErrorable Address -foreign import address_toBytes :: Address -> Bytes -foreign import address_toBech32 :: Address -> Nullable String -> String -foreign import address_fromBech32 :: String -> ForeignErrorable Address -foreign import address_networkId :: Address -> Int - --- | Address class -type AddressClass = - { free :: Address -> Effect Unit - -- ^ Free - -- > free self - , fromBytes :: Bytes -> Maybe Address - -- ^ From bytes - -- > fromBytes data - , toJson :: Address -> String - -- ^ To json - -- > toJson self - , toJsValue :: Address -> AddressJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe Address - -- ^ From json - -- > fromJson json - , toHex :: Address -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe Address - -- ^ From hex - -- > fromHex hexStr - , toBytes :: Address -> Bytes - -- ^ To bytes - -- > toBytes self - , toBech32 :: Address -> Maybe String -> String - -- ^ To bech32 - -- > toBech32 self prefix - , fromBech32 :: String -> Maybe Address - -- ^ From bech32 - -- > fromBech32 bechStr - , networkId :: Address -> Int - -- ^ Network id - -- > networkId self - } - --- | Address class API -address :: AddressClass -address = - { free: address_free - , fromBytes: \a1 -> runForeignMaybe $ address_fromBytes a1 - , toJson: address_toJson - , toJsValue: address_toJsValue - , fromJson: \a1 -> runForeignMaybe $ address_fromJson a1 - , toHex: address_toHex - , fromHex: \a1 -> runForeignMaybe $ address_fromHex a1 - , toBytes: address_toBytes - , toBech32: \self prefix -> address_toBech32 self (Nullable.toNullable prefix) - , fromBech32: \a1 -> runForeignMaybe $ address_fromBech32 a1 - , networkId: address_networkId - } - -instance HasFree Address where - free = address.free - -instance Show Address where - show = address.toHex - -instance ToJsValue Address where - toJsValue = address.toJsValue - -instance IsHex Address where - toHex = address.toHex - fromHex = address.fromHex - -instance IsBytes Address where - toBytes = address.toBytes - fromBytes = address.fromBytes - -instance IsJson Address where - toJson = address.toJson - fromJson = address.fromJson - -------------------------------------------------------------------------------------- --- Asset name - -foreign import assetName_free :: AssetName -> Effect Unit -foreign import assetName_toBytes :: AssetName -> Bytes -foreign import assetName_fromBytes :: Bytes -> ForeignErrorable AssetName -foreign import assetName_toHex :: AssetName -> String -foreign import assetName_fromHex :: String -> ForeignErrorable AssetName -foreign import assetName_toJson :: AssetName -> String -foreign import assetName_toJsValue :: AssetName -> AssetNameJson -foreign import assetName_fromJson :: String -> ForeignErrorable AssetName -foreign import assetName_new :: Bytes -> AssetName -foreign import assetName_name :: AssetName -> Bytes - --- | Asset name class -type AssetNameClass = - { free :: AssetName -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: AssetName -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe AssetName - -- ^ From bytes - -- > fromBytes bytes - , toHex :: AssetName -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe AssetName - -- ^ From hex - -- > fromHex hexStr - , toJson :: AssetName -> String - -- ^ To json - -- > toJson self - , toJsValue :: AssetName -> AssetNameJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe AssetName - -- ^ From json - -- > fromJson json - , new :: Bytes -> AssetName - -- ^ New - -- > new name - , name :: AssetName -> Bytes - -- ^ Name - -- > name self - } - --- | Asset name class API -assetName :: AssetNameClass -assetName = - { free: assetName_free - , toBytes: assetName_toBytes - , fromBytes: \a1 -> runForeignMaybe $ assetName_fromBytes a1 - , toHex: assetName_toHex - , fromHex: \a1 -> runForeignMaybe $ assetName_fromHex a1 - , toJson: assetName_toJson - , toJsValue: assetName_toJsValue - , fromJson: \a1 -> runForeignMaybe $ assetName_fromJson a1 - , new: assetName_new - , name: assetName_name - } - -instance HasFree AssetName where - free = assetName.free - -instance Show AssetName where - show = assetName.toHex - -instance ToJsValue AssetName where - toJsValue = assetName.toJsValue - -instance IsHex AssetName where - toHex = assetName.toHex - fromHex = assetName.fromHex - -instance IsBytes AssetName where - toBytes = assetName.toBytes - fromBytes = assetName.fromBytes - -instance IsJson AssetName where - toJson = assetName.toJson - fromJson = assetName.fromJson - -------------------------------------------------------------------------------------- --- Asset names - -foreign import assetNames_free :: AssetNames -> Effect Unit -foreign import assetNames_toBytes :: AssetNames -> Bytes -foreign import assetNames_fromBytes :: Bytes -> ForeignErrorable AssetNames -foreign import assetNames_toHex :: AssetNames -> String -foreign import assetNames_fromHex :: String -> ForeignErrorable AssetNames -foreign import assetNames_toJson :: AssetNames -> String -foreign import assetNames_toJsValue :: AssetNames -> AssetNamesJson -foreign import assetNames_fromJson :: String -> ForeignErrorable AssetNames -foreign import assetNames_new :: Effect AssetNames -foreign import assetNames_len :: AssetNames -> Effect Int -foreign import assetNames_get :: AssetNames -> Int -> Effect AssetName -foreign import assetNames_add :: AssetNames -> AssetName -> Effect Unit - --- | Asset names class -type AssetNamesClass = - { free :: AssetNames -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: AssetNames -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe AssetNames - -- ^ From bytes - -- > fromBytes bytes - , toHex :: AssetNames -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe AssetNames - -- ^ From hex - -- > fromHex hexStr - , toJson :: AssetNames -> String - -- ^ To json - -- > toJson self - , toJsValue :: AssetNames -> AssetNamesJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe AssetNames - -- ^ From json - -- > fromJson json - , new :: Effect AssetNames - -- ^ New - -- > new - , len :: AssetNames -> Effect Int - -- ^ Len - -- > len self - , get :: AssetNames -> Int -> Effect AssetName - -- ^ Get - -- > get self index - , add :: AssetNames -> AssetName -> Effect Unit - -- ^ Add - -- > add self elem - } - --- | Asset names class API -assetNames :: AssetNamesClass -assetNames = - { free: assetNames_free - , toBytes: assetNames_toBytes - , fromBytes: \a1 -> runForeignMaybe $ assetNames_fromBytes a1 - , toHex: assetNames_toHex - , fromHex: \a1 -> runForeignMaybe $ assetNames_fromHex a1 - , toJson: assetNames_toJson - , toJsValue: assetNames_toJsValue - , fromJson: \a1 -> runForeignMaybe $ assetNames_fromJson a1 - , new: assetNames_new - , len: assetNames_len - , get: assetNames_get - , add: assetNames_add - } - -instance HasFree AssetNames where - free = assetNames.free - -instance Show AssetNames where - show = assetNames.toHex - -instance MutableList AssetNames AssetName where - addItem = assetNames.add - getItem = assetNames.get - emptyList = assetNames.new - -instance MutableLen AssetNames where - getLen = assetNames.len - - -instance ToJsValue AssetNames where - toJsValue = assetNames.toJsValue - -instance IsHex AssetNames where - toHex = assetNames.toHex - fromHex = assetNames.fromHex - -instance IsBytes AssetNames where - toBytes = assetNames.toBytes - fromBytes = assetNames.fromBytes - -instance IsJson AssetNames where - toJson = assetNames.toJson - fromJson = assetNames.fromJson - -------------------------------------------------------------------------------------- --- Assets - -foreign import assets_free :: Assets -> Effect Unit -foreign import assets_toBytes :: Assets -> Bytes -foreign import assets_fromBytes :: Bytes -> ForeignErrorable Assets -foreign import assets_toHex :: Assets -> String -foreign import assets_fromHex :: String -> ForeignErrorable Assets -foreign import assets_toJson :: Assets -> String -foreign import assets_toJsValue :: Assets -> AssetsJson -foreign import assets_fromJson :: String -> ForeignErrorable Assets -foreign import assets_new :: Effect Assets -foreign import assets_len :: Assets -> Effect Int -foreign import assets_insert :: Assets -> AssetName -> BigNum -> Effect ((Nullable BigNum)) -foreign import assets_get :: Assets -> AssetName -> Effect ((Nullable BigNum)) -foreign import assets_keys :: Assets -> Effect AssetNames - --- | Assets class -type AssetsClass = - { free :: Assets -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: Assets -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe Assets - -- ^ From bytes - -- > fromBytes bytes - , toHex :: Assets -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe Assets - -- ^ From hex - -- > fromHex hexStr - , toJson :: Assets -> String - -- ^ To json - -- > toJson self - , toJsValue :: Assets -> AssetsJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe Assets - -- ^ From json - -- > fromJson json - , new :: Effect Assets - -- ^ New - -- > new - , len :: Assets -> Effect Int - -- ^ Len - -- > len self - , insert :: Assets -> AssetName -> BigNum -> Effect ((Maybe BigNum)) - -- ^ Insert - -- > insert self key value - , get :: Assets -> AssetName -> Effect ((Maybe BigNum)) - -- ^ Get - -- > get self key - , keys :: Assets -> Effect AssetNames - -- ^ Keys - -- > keys self - } - --- | Assets class API -assets :: AssetsClass -assets = - { free: assets_free - , toBytes: assets_toBytes - , fromBytes: \a1 -> runForeignMaybe $ assets_fromBytes a1 - , toHex: assets_toHex - , fromHex: \a1 -> runForeignMaybe $ assets_fromHex a1 - , toJson: assets_toJson - , toJsValue: assets_toJsValue - , fromJson: \a1 -> runForeignMaybe $ assets_fromJson a1 - , new: assets_new - , len: assets_len - , insert: \a1 a2 a3 -> Nullable.toMaybe <$> assets_insert a1 a2 a3 - , get: \a1 a2 -> Nullable.toMaybe <$> assets_get a1 a2 - , keys: assets_keys - } - -instance HasFree Assets where - free = assets.free - -instance Show Assets where - show = assets.toHex - -instance ToJsValue Assets where - toJsValue = assets.toJsValue - -instance IsHex Assets where - toHex = assets.toHex - fromHex = assets.fromHex - -instance IsBytes Assets where - toBytes = assets.toBytes - fromBytes = assets.fromBytes - -instance IsJson Assets where - toJson = assets.toJson - fromJson = assets.fromJson - -------------------------------------------------------------------------------------- --- Auxiliary data - -foreign import auxiliaryData_free :: AuxiliaryData -> Effect Unit -foreign import auxiliaryData_toBytes :: AuxiliaryData -> Bytes -foreign import auxiliaryData_fromBytes :: Bytes -> ForeignErrorable AuxiliaryData -foreign import auxiliaryData_toHex :: AuxiliaryData -> String -foreign import auxiliaryData_fromHex :: String -> ForeignErrorable AuxiliaryData -foreign import auxiliaryData_toJson :: AuxiliaryData -> String -foreign import auxiliaryData_toJsValue :: AuxiliaryData -> AuxiliaryDataJson -foreign import auxiliaryData_fromJson :: String -> ForeignErrorable AuxiliaryData -foreign import auxiliaryData_new :: Effect AuxiliaryData -foreign import auxiliaryData_metadata :: AuxiliaryData -> Nullable GeneralTxMetadata -foreign import auxiliaryData_setMetadata :: AuxiliaryData -> GeneralTxMetadata -> Effect Unit -foreign import auxiliaryData_nativeScripts :: AuxiliaryData -> Effect ((Nullable NativeScripts)) -foreign import auxiliaryData_setNativeScripts :: AuxiliaryData -> NativeScripts -> Effect Unit -foreign import auxiliaryData_plutusScripts :: AuxiliaryData -> Effect ((Nullable PlutusScripts)) -foreign import auxiliaryData_setPlutusScripts :: AuxiliaryData -> PlutusScripts -> Effect Unit - --- | Auxiliary data class -type AuxiliaryDataClass = - { free :: AuxiliaryData -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: AuxiliaryData -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe AuxiliaryData - -- ^ From bytes - -- > fromBytes bytes - , toHex :: AuxiliaryData -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe AuxiliaryData - -- ^ From hex - -- > fromHex hexStr - , toJson :: AuxiliaryData -> String - -- ^ To json - -- > toJson self - , toJsValue :: AuxiliaryData -> AuxiliaryDataJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe AuxiliaryData - -- ^ From json - -- > fromJson json - , new :: Effect AuxiliaryData - -- ^ New - -- > new - , metadata :: AuxiliaryData -> Maybe GeneralTxMetadata - -- ^ Metadata - -- > metadata self - , setMetadata :: AuxiliaryData -> GeneralTxMetadata -> Effect Unit - -- ^ Set metadata - -- > setMetadata self metadata - , nativeScripts :: AuxiliaryData -> Effect ((Maybe NativeScripts)) - -- ^ Native scripts - -- > nativeScripts self - , setNativeScripts :: AuxiliaryData -> NativeScripts -> Effect Unit - -- ^ Set native scripts - -- > setNativeScripts self nativeScripts - , plutusScripts :: AuxiliaryData -> Effect ((Maybe PlutusScripts)) - -- ^ Plutus scripts - -- > plutusScripts self - , setPlutusScripts :: AuxiliaryData -> PlutusScripts -> Effect Unit - -- ^ Set plutus scripts - -- > setPlutusScripts self plutusScripts - } - --- | Auxiliary data class API -auxiliaryData :: AuxiliaryDataClass -auxiliaryData = - { free: auxiliaryData_free - , toBytes: auxiliaryData_toBytes - , fromBytes: \a1 -> runForeignMaybe $ auxiliaryData_fromBytes a1 - , toHex: auxiliaryData_toHex - , fromHex: \a1 -> runForeignMaybe $ auxiliaryData_fromHex a1 - , toJson: auxiliaryData_toJson - , toJsValue: auxiliaryData_toJsValue - , fromJson: \a1 -> runForeignMaybe $ auxiliaryData_fromJson a1 - , new: auxiliaryData_new - , metadata: \a1 -> Nullable.toMaybe $ auxiliaryData_metadata a1 - , setMetadata: auxiliaryData_setMetadata - , nativeScripts: \a1 -> Nullable.toMaybe <$> auxiliaryData_nativeScripts a1 - , setNativeScripts: auxiliaryData_setNativeScripts - , plutusScripts: \a1 -> Nullable.toMaybe <$> auxiliaryData_plutusScripts a1 - , setPlutusScripts: auxiliaryData_setPlutusScripts - } - -instance HasFree AuxiliaryData where - free = auxiliaryData.free - -instance Show AuxiliaryData where - show = auxiliaryData.toHex - -instance ToJsValue AuxiliaryData where - toJsValue = auxiliaryData.toJsValue - -instance IsHex AuxiliaryData where - toHex = auxiliaryData.toHex - fromHex = auxiliaryData.fromHex - -instance IsBytes AuxiliaryData where - toBytes = auxiliaryData.toBytes - fromBytes = auxiliaryData.fromBytes - -instance IsJson AuxiliaryData where - toJson = auxiliaryData.toJson - fromJson = auxiliaryData.fromJson - -------------------------------------------------------------------------------------- --- Auxiliary data hash - -foreign import auxiliaryDataHash_free :: AuxiliaryDataHash -> Effect Unit -foreign import auxiliaryDataHash_fromBytes :: Bytes -> ForeignErrorable AuxiliaryDataHash -foreign import auxiliaryDataHash_toBytes :: AuxiliaryDataHash -> Bytes -foreign import auxiliaryDataHash_toBech32 :: AuxiliaryDataHash -> String -> String -foreign import auxiliaryDataHash_fromBech32 :: String -> ForeignErrorable AuxiliaryDataHash -foreign import auxiliaryDataHash_toHex :: AuxiliaryDataHash -> String -foreign import auxiliaryDataHash_fromHex :: String -> ForeignErrorable AuxiliaryDataHash - --- | Auxiliary data hash class -type AuxiliaryDataHashClass = - { free :: AuxiliaryDataHash -> Effect Unit - -- ^ Free - -- > free self - , fromBytes :: Bytes -> Maybe AuxiliaryDataHash - -- ^ From bytes - -- > fromBytes bytes - , toBytes :: AuxiliaryDataHash -> Bytes - -- ^ To bytes - -- > toBytes self - , toBech32 :: AuxiliaryDataHash -> String -> String - -- ^ To bech32 - -- > toBech32 self prefix - , fromBech32 :: String -> Maybe AuxiliaryDataHash - -- ^ From bech32 - -- > fromBech32 bechStr - , toHex :: AuxiliaryDataHash -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe AuxiliaryDataHash - -- ^ From hex - -- > fromHex hex - } - --- | Auxiliary data hash class API -auxiliaryDataHash :: AuxiliaryDataHashClass -auxiliaryDataHash = - { free: auxiliaryDataHash_free - , fromBytes: \a1 -> runForeignMaybe $ auxiliaryDataHash_fromBytes a1 - , toBytes: auxiliaryDataHash_toBytes - , toBech32: auxiliaryDataHash_toBech32 - , fromBech32: \a1 -> runForeignMaybe $ auxiliaryDataHash_fromBech32 a1 - , toHex: auxiliaryDataHash_toHex - , fromHex: \a1 -> runForeignMaybe $ auxiliaryDataHash_fromHex a1 - } - -instance HasFree AuxiliaryDataHash where - free = auxiliaryDataHash.free - -instance Show AuxiliaryDataHash where - show = auxiliaryDataHash.toHex - -instance IsHex AuxiliaryDataHash where - toHex = auxiliaryDataHash.toHex - fromHex = auxiliaryDataHash.fromHex - -instance IsBytes AuxiliaryDataHash where - toBytes = auxiliaryDataHash.toBytes - fromBytes = auxiliaryDataHash.fromBytes - -------------------------------------------------------------------------------------- --- Auxiliary data set - -foreign import auxiliaryDataSet_free :: AuxiliaryDataSet -> Effect Unit -foreign import auxiliaryDataSet_new :: Effect AuxiliaryDataSet -foreign import auxiliaryDataSet_len :: AuxiliaryDataSet -> Int -foreign import auxiliaryDataSet_insert :: AuxiliaryDataSet -> Int -> AuxiliaryData -> Effect ((Nullable AuxiliaryData)) -foreign import auxiliaryDataSet_get :: AuxiliaryDataSet -> Int -> Effect ((Nullable AuxiliaryData)) -foreign import auxiliaryDataSet_indices :: AuxiliaryDataSet -> Effect Uint32Array - --- | Auxiliary data set class -type AuxiliaryDataSetClass = - { free :: AuxiliaryDataSet -> Effect Unit - -- ^ Free - -- > free self - , new :: Effect AuxiliaryDataSet - -- ^ New - -- > new - , len :: AuxiliaryDataSet -> Int - -- ^ Len - -- > len self - , insert :: AuxiliaryDataSet -> Int -> AuxiliaryData -> Effect ((Maybe AuxiliaryData)) - -- ^ Insert - -- > insert self txIndex data - , get :: AuxiliaryDataSet -> Int -> Effect ((Maybe AuxiliaryData)) - -- ^ Get - -- > get self txIndex - , indices :: AuxiliaryDataSet -> Effect Uint32Array - -- ^ Indices - -- > indices self - } - --- | Auxiliary data set class API -auxiliaryDataSet :: AuxiliaryDataSetClass -auxiliaryDataSet = - { free: auxiliaryDataSet_free - , new: auxiliaryDataSet_new - , len: auxiliaryDataSet_len - , insert: \a1 a2 a3 -> Nullable.toMaybe <$> auxiliaryDataSet_insert a1 a2 a3 - , get: \a1 a2 -> Nullable.toMaybe <$> auxiliaryDataSet_get a1 a2 - , indices: auxiliaryDataSet_indices - } - -instance HasFree AuxiliaryDataSet where - free = auxiliaryDataSet.free - -------------------------------------------------------------------------------------- --- Base address - -foreign import baseAddress_free :: BaseAddress -> Effect Unit -foreign import baseAddress_new :: Number -> StakeCredential -> StakeCredential -> BaseAddress -foreign import baseAddress_paymentCred :: BaseAddress -> StakeCredential -foreign import baseAddress_stakeCred :: BaseAddress -> StakeCredential -foreign import baseAddress_toAddress :: BaseAddress -> Address -foreign import baseAddress_fromAddress :: Address -> Nullable BaseAddress - --- | Base address class -type BaseAddressClass = - { free :: BaseAddress -> Effect Unit - -- ^ Free - -- > free self - , new :: Number -> StakeCredential -> StakeCredential -> BaseAddress - -- ^ New - -- > new network payment stake - , paymentCred :: BaseAddress -> StakeCredential - -- ^ Payment cred - -- > paymentCred self - , stakeCred :: BaseAddress -> StakeCredential - -- ^ Stake cred - -- > stakeCred self - , toAddress :: BaseAddress -> Address - -- ^ To address - -- > toAddress self - , fromAddress :: Address -> Maybe BaseAddress - -- ^ From address - -- > fromAddress addr - } - --- | Base address class API -baseAddress :: BaseAddressClass -baseAddress = - { free: baseAddress_free - , new: baseAddress_new - , paymentCred: baseAddress_paymentCred - , stakeCred: baseAddress_stakeCred - , toAddress: baseAddress_toAddress - , fromAddress: \a1 -> Nullable.toMaybe $ baseAddress_fromAddress a1 - } - -instance HasFree BaseAddress where - free = baseAddress.free - -------------------------------------------------------------------------------------- --- Big int - -foreign import bigInt_free :: BigInt -> Effect Unit -foreign import bigInt_toBytes :: BigInt -> Bytes -foreign import bigInt_fromBytes :: Bytes -> ForeignErrorable BigInt -foreign import bigInt_toHex :: BigInt -> String -foreign import bigInt_fromHex :: String -> ForeignErrorable BigInt -foreign import bigInt_toJson :: BigInt -> String -foreign import bigInt_toJsValue :: BigInt -> BigIntJson -foreign import bigInt_fromJson :: String -> ForeignErrorable BigInt -foreign import bigInt_isZero :: BigInt -> Boolean -foreign import bigInt_asU64 :: BigInt -> Nullable BigNum -foreign import bigInt_asInt :: BigInt -> Nullable Int -foreign import bigInt_fromStr :: String -> ForeignErrorable BigInt -foreign import bigInt_toStr :: BigInt -> String -foreign import bigInt_add :: BigInt -> BigInt -> BigInt -foreign import bigInt_mul :: BigInt -> BigInt -> BigInt -foreign import bigInt_one :: BigInt -foreign import bigInt_increment :: BigInt -> BigInt -foreign import bigInt_divCeil :: BigInt -> BigInt -> BigInt - --- | Big int class -type BigIntClass = - { free :: BigInt -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: BigInt -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe BigInt - -- ^ From bytes - -- > fromBytes bytes - , toHex :: BigInt -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe BigInt - -- ^ From hex - -- > fromHex hexStr - , toJson :: BigInt -> String - -- ^ To json - -- > toJson self - , toJsValue :: BigInt -> BigIntJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe BigInt - -- ^ From json - -- > fromJson json - , isZero :: BigInt -> Boolean - -- ^ Is zero - -- > isZero self - , asU64 :: BigInt -> Maybe BigNum - -- ^ As u64 - -- > asU64 self - , asInt :: BigInt -> Maybe Int - -- ^ As int - -- > asInt self - , fromStr :: String -> Maybe BigInt - -- ^ From str - -- > fromStr text - , toStr :: BigInt -> String - -- ^ To str - -- > toStr self - , add :: BigInt -> BigInt -> BigInt - -- ^ Add - -- > add self other - , mul :: BigInt -> BigInt -> BigInt - -- ^ Mul - -- > mul self other - , one :: BigInt - -- ^ One - -- > one - , increment :: BigInt -> BigInt - -- ^ Increment - -- > increment self - , divCeil :: BigInt -> BigInt -> BigInt - -- ^ Div ceil - -- > divCeil self other - } - --- | Big int class API -bigInt :: BigIntClass -bigInt = - { free: bigInt_free - , toBytes: bigInt_toBytes - , fromBytes: \a1 -> runForeignMaybe $ bigInt_fromBytes a1 - , toHex: bigInt_toHex - , fromHex: \a1 -> runForeignMaybe $ bigInt_fromHex a1 - , toJson: bigInt_toJson - , toJsValue: bigInt_toJsValue - , fromJson: \a1 -> runForeignMaybe $ bigInt_fromJson a1 - , isZero: bigInt_isZero - , asU64: \a1 -> Nullable.toMaybe $ bigInt_asU64 a1 - , asInt: \a1 -> Nullable.toMaybe $ bigInt_asInt a1 - , fromStr: \a1 -> runForeignMaybe $ bigInt_fromStr a1 - , toStr: bigInt_toStr - , add: bigInt_add - , mul: bigInt_mul - , one: bigInt_one - , increment: bigInt_increment - , divCeil: bigInt_divCeil - } - -instance HasFree BigInt where - free = bigInt.free - -instance Show BigInt where - show = bigInt.toStr - -instance ToJsValue BigInt where - toJsValue = bigInt.toJsValue - -instance IsHex BigInt where - toHex = bigInt.toHex - fromHex = bigInt.fromHex - -instance IsStr BigInt where - toStr = bigInt.toStr - fromStr = bigInt.fromStr - -instance IsBytes BigInt where - toBytes = bigInt.toBytes - fromBytes = bigInt.fromBytes - -instance IsJson BigInt where - toJson = bigInt.toJson - fromJson = bigInt.fromJson - -------------------------------------------------------------------------------------- --- Big num - -foreign import bigNum_free :: BigNum -> Effect Unit -foreign import bigNum_toBytes :: BigNum -> Bytes -foreign import bigNum_fromBytes :: Bytes -> ForeignErrorable BigNum -foreign import bigNum_toHex :: BigNum -> String -foreign import bigNum_fromHex :: String -> ForeignErrorable BigNum -foreign import bigNum_toJson :: BigNum -> String -foreign import bigNum_toJsValue :: BigNum -> BigNumJson -foreign import bigNum_fromJson :: String -> ForeignErrorable BigNum -foreign import bigNum_fromStr :: String -> ForeignErrorable BigNum -foreign import bigNum_toStr :: BigNum -> String -foreign import bigNum_zero :: BigNum -foreign import bigNum_one :: BigNum -foreign import bigNum_isZero :: BigNum -> Boolean -foreign import bigNum_divFloor :: BigNum -> BigNum -> BigNum -foreign import bigNum_checkedMul :: BigNum -> BigNum -> BigNum -foreign import bigNum_checkedAdd :: BigNum -> BigNum -> BigNum -foreign import bigNum_checkedSub :: BigNum -> BigNum -> BigNum -foreign import bigNum_clampedSub :: BigNum -> BigNum -> BigNum -foreign import bigNum_compare :: BigNum -> BigNum -> Int -foreign import bigNum_lessThan :: BigNum -> BigNum -> Boolean -foreign import bigNum_max :: BigNum -> BigNum -> BigNum - --- | Big num class -type BigNumClass = - { free :: BigNum -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: BigNum -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe BigNum - -- ^ From bytes - -- > fromBytes bytes - , toHex :: BigNum -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe BigNum - -- ^ From hex - -- > fromHex hexStr - , toJson :: BigNum -> String - -- ^ To json - -- > toJson self - , toJsValue :: BigNum -> BigNumJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe BigNum - -- ^ From json - -- > fromJson json - , fromStr :: String -> Maybe BigNum - -- ^ From str - -- > fromStr string - , toStr :: BigNum -> String - -- ^ To str - -- > toStr self - , zero :: BigNum - -- ^ Zero - -- > zero - , one :: BigNum - -- ^ One - -- > one - , isZero :: BigNum -> Boolean - -- ^ Is zero - -- > isZero self - , divFloor :: BigNum -> BigNum -> BigNum - -- ^ Div floor - -- > divFloor self other - , checkedMul :: BigNum -> BigNum -> BigNum - -- ^ Checked mul - -- > checkedMul self other - , checkedAdd :: BigNum -> BigNum -> BigNum - -- ^ Checked add - -- > checkedAdd self other - , checkedSub :: BigNum -> BigNum -> BigNum - -- ^ Checked sub - -- > checkedSub self other - , clampedSub :: BigNum -> BigNum -> BigNum - -- ^ Clamped sub - -- > clampedSub self other - , compare :: BigNum -> BigNum -> Int - -- ^ Compare - -- > compare self rhsValue - , lessThan :: BigNum -> BigNum -> Boolean - -- ^ Less than - -- > lessThan self rhsValue - , max :: BigNum -> BigNum -> BigNum - -- ^ Max - -- > max a b - } - --- | Big num class API -bigNum :: BigNumClass -bigNum = - { free: bigNum_free - , toBytes: bigNum_toBytes - , fromBytes: \a1 -> runForeignMaybe $ bigNum_fromBytes a1 - , toHex: bigNum_toHex - , fromHex: \a1 -> runForeignMaybe $ bigNum_fromHex a1 - , toJson: bigNum_toJson - , toJsValue: bigNum_toJsValue - , fromJson: \a1 -> runForeignMaybe $ bigNum_fromJson a1 - , fromStr: \a1 -> runForeignMaybe $ bigNum_fromStr a1 - , toStr: bigNum_toStr - , zero: bigNum_zero - , one: bigNum_one - , isZero: bigNum_isZero - , divFloor: bigNum_divFloor - , checkedMul: bigNum_checkedMul - , checkedAdd: bigNum_checkedAdd - , checkedSub: bigNum_checkedSub - , clampedSub: bigNum_clampedSub - , compare: bigNum_compare - , lessThan: bigNum_lessThan - , max: bigNum_max - } - -instance HasFree BigNum where - free = bigNum.free - -instance Show BigNum where - show = bigNum.toStr - -instance ToJsValue BigNum where - toJsValue = bigNum.toJsValue - -instance IsHex BigNum where - toHex = bigNum.toHex - fromHex = bigNum.fromHex - -instance IsStr BigNum where - toStr = bigNum.toStr - fromStr = bigNum.fromStr - -instance IsBytes BigNum where - toBytes = bigNum.toBytes - fromBytes = bigNum.fromBytes - -instance IsJson BigNum where - toJson = bigNum.toJson - fromJson = bigNum.fromJson - -------------------------------------------------------------------------------------- --- Bip32 private key - -foreign import bip32PrivateKey_free :: Bip32PrivateKey -> Effect Unit -foreign import bip32PrivateKey_derive :: Bip32PrivateKey -> Number -> Bip32PrivateKey -foreign import bip32PrivateKey_from128Xprv :: Bytes -> Bip32PrivateKey -foreign import bip32PrivateKey_to128Xprv :: Bip32PrivateKey -> Bytes -foreign import bip32PrivateKey_generateEd25519Bip32 :: Bip32PrivateKey -foreign import bip32PrivateKey_toRawKey :: Bip32PrivateKey -> PrivateKey -foreign import bip32PrivateKey_toPublic :: Bip32PrivateKey -> Bip32PublicKey -foreign import bip32PrivateKey_fromBytes :: Bytes -> ForeignErrorable Bip32PrivateKey -foreign import bip32PrivateKey_asBytes :: Bip32PrivateKey -> Bytes -foreign import bip32PrivateKey_fromBech32 :: String -> ForeignErrorable Bip32PrivateKey -foreign import bip32PrivateKey_toBech32 :: Bip32PrivateKey -> String -foreign import bip32PrivateKey_fromBip39Entropy :: Bytes -> Bytes -> Bip32PrivateKey -foreign import bip32PrivateKey_chaincode :: Bip32PrivateKey -> Bytes -foreign import bip32PrivateKey_toHex :: Bip32PrivateKey -> String -foreign import bip32PrivateKey_fromHex :: String -> ForeignErrorable Bip32PrivateKey - --- | Bip32 private key class -type Bip32PrivateKeyClass = - { free :: Bip32PrivateKey -> Effect Unit - -- ^ Free - -- > free self - , derive :: Bip32PrivateKey -> Number -> Bip32PrivateKey - -- ^ Derive - -- > derive self index - , from128Xprv :: Bytes -> Bip32PrivateKey - -- ^ From 128 xprv - -- > from128Xprv bytes - , to128Xprv :: Bip32PrivateKey -> Bytes - -- ^ To 128 xprv - -- > to128Xprv self - , generateEd25519Bip32 :: Bip32PrivateKey - -- ^ Generate ed25519 bip32 - -- > generateEd25519Bip32 - , toRawKey :: Bip32PrivateKey -> PrivateKey - -- ^ To raw key - -- > toRawKey self - , toPublic :: Bip32PrivateKey -> Bip32PublicKey - -- ^ To public - -- > toPublic self - , fromBytes :: Bytes -> Maybe Bip32PrivateKey - -- ^ From bytes - -- > fromBytes bytes - , asBytes :: Bip32PrivateKey -> Bytes - -- ^ As bytes - -- > asBytes self - , fromBech32 :: String -> Maybe Bip32PrivateKey - -- ^ From bech32 - -- > fromBech32 bech32Str - , toBech32 :: Bip32PrivateKey -> String - -- ^ To bech32 - -- > toBech32 self - , fromBip39Entropy :: Bytes -> Bytes -> Bip32PrivateKey - -- ^ From bip39 entropy - -- > fromBip39Entropy entropy password - , chaincode :: Bip32PrivateKey -> Bytes - -- ^ Chaincode - -- > chaincode self - , toHex :: Bip32PrivateKey -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe Bip32PrivateKey - -- ^ From hex - -- > fromHex hexStr - } - --- | Bip32 private key class API -bip32PrivateKey :: Bip32PrivateKeyClass -bip32PrivateKey = - { free: bip32PrivateKey_free - , derive: bip32PrivateKey_derive - , from128Xprv: bip32PrivateKey_from128Xprv - , to128Xprv: bip32PrivateKey_to128Xprv - , generateEd25519Bip32: bip32PrivateKey_generateEd25519Bip32 - , toRawKey: bip32PrivateKey_toRawKey - , toPublic: bip32PrivateKey_toPublic - , fromBytes: \a1 -> runForeignMaybe $ bip32PrivateKey_fromBytes a1 - , asBytes: bip32PrivateKey_asBytes - , fromBech32: \a1 -> runForeignMaybe $ bip32PrivateKey_fromBech32 a1 - , toBech32: bip32PrivateKey_toBech32 - , fromBip39Entropy: bip32PrivateKey_fromBip39Entropy - , chaincode: bip32PrivateKey_chaincode - , toHex: bip32PrivateKey_toHex - , fromHex: \a1 -> runForeignMaybe $ bip32PrivateKey_fromHex a1 - } - -instance HasFree Bip32PrivateKey where - free = bip32PrivateKey.free - -instance Show Bip32PrivateKey where - show = bip32PrivateKey.toHex - -instance IsHex Bip32PrivateKey where - toHex = bip32PrivateKey.toHex - fromHex = bip32PrivateKey.fromHex - -instance IsBech32 Bip32PrivateKey where - toBech32 = bip32PrivateKey.toBech32 - fromBech32 = bip32PrivateKey.fromBech32 - -------------------------------------------------------------------------------------- --- Bip32 public key - -foreign import bip32PublicKey_free :: Bip32PublicKey -> Effect Unit -foreign import bip32PublicKey_derive :: Bip32PublicKey -> Number -> Bip32PublicKey -foreign import bip32PublicKey_toRawKey :: Bip32PublicKey -> PublicKey -foreign import bip32PublicKey_fromBytes :: Bytes -> ForeignErrorable Bip32PublicKey -foreign import bip32PublicKey_asBytes :: Bip32PublicKey -> Bytes -foreign import bip32PublicKey_fromBech32 :: String -> ForeignErrorable Bip32PublicKey -foreign import bip32PublicKey_toBech32 :: Bip32PublicKey -> String -foreign import bip32PublicKey_chaincode :: Bip32PublicKey -> Bytes -foreign import bip32PublicKey_toHex :: Bip32PublicKey -> String -foreign import bip32PublicKey_fromHex :: String -> ForeignErrorable Bip32PublicKey - --- | Bip32 public key class -type Bip32PublicKeyClass = - { free :: Bip32PublicKey -> Effect Unit - -- ^ Free - -- > free self - , derive :: Bip32PublicKey -> Number -> Bip32PublicKey - -- ^ Derive - -- > derive self index - , toRawKey :: Bip32PublicKey -> PublicKey - -- ^ To raw key - -- > toRawKey self - , fromBytes :: Bytes -> Maybe Bip32PublicKey - -- ^ From bytes - -- > fromBytes bytes - , asBytes :: Bip32PublicKey -> Bytes - -- ^ As bytes - -- > asBytes self - , fromBech32 :: String -> Maybe Bip32PublicKey - -- ^ From bech32 - -- > fromBech32 bech32Str - , toBech32 :: Bip32PublicKey -> String - -- ^ To bech32 - -- > toBech32 self - , chaincode :: Bip32PublicKey -> Bytes - -- ^ Chaincode - -- > chaincode self - , toHex :: Bip32PublicKey -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe Bip32PublicKey - -- ^ From hex - -- > fromHex hexStr - } - --- | Bip32 public key class API -bip32PublicKey :: Bip32PublicKeyClass -bip32PublicKey = - { free: bip32PublicKey_free - , derive: bip32PublicKey_derive - , toRawKey: bip32PublicKey_toRawKey - , fromBytes: \a1 -> runForeignMaybe $ bip32PublicKey_fromBytes a1 - , asBytes: bip32PublicKey_asBytes - , fromBech32: \a1 -> runForeignMaybe $ bip32PublicKey_fromBech32 a1 - , toBech32: bip32PublicKey_toBech32 - , chaincode: bip32PublicKey_chaincode - , toHex: bip32PublicKey_toHex - , fromHex: \a1 -> runForeignMaybe $ bip32PublicKey_fromHex a1 - } - -instance HasFree Bip32PublicKey where - free = bip32PublicKey.free - -instance Show Bip32PublicKey where - show = bip32PublicKey.toHex - -instance IsHex Bip32PublicKey where - toHex = bip32PublicKey.toHex - fromHex = bip32PublicKey.fromHex - -instance IsBech32 Bip32PublicKey where - toBech32 = bip32PublicKey.toBech32 - fromBech32 = bip32PublicKey.fromBech32 - -------------------------------------------------------------------------------------- --- Block - -foreign import block_free :: Block -> Effect Unit -foreign import block_toBytes :: Block -> Bytes -foreign import block_fromBytes :: Bytes -> ForeignErrorable Block -foreign import block_toHex :: Block -> String -foreign import block_fromHex :: String -> ForeignErrorable Block -foreign import block_toJson :: Block -> String -foreign import block_toJsValue :: Block -> BlockJson -foreign import block_fromJson :: String -> ForeignErrorable Block -foreign import block_header :: Block -> Header -foreign import block_txBodies :: Block -> TxBodies -foreign import block_txWitnessSets :: Block -> TxWitnessSets -foreign import block_auxiliaryDataSet :: Block -> AuxiliaryDataSet -foreign import block_invalidTxs :: Block -> Uint32Array -foreign import block_new :: Header -> TxBodies -> TxWitnessSets -> AuxiliaryDataSet -> Uint32Array -> Block - --- | Block class -type BlockClass = - { free :: Block -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: Block -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe Block - -- ^ From bytes - -- > fromBytes bytes - , toHex :: Block -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe Block - -- ^ From hex - -- > fromHex hexStr - , toJson :: Block -> String - -- ^ To json - -- > toJson self - , toJsValue :: Block -> BlockJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe Block - -- ^ From json - -- > fromJson json - , header :: Block -> Header - -- ^ Header - -- > header self - , txBodies :: Block -> TxBodies - -- ^ Transaction bodies - -- > txBodies self - , txWitnessSets :: Block -> TxWitnessSets - -- ^ Transaction witness sets - -- > txWitnessSets self - , auxiliaryDataSet :: Block -> AuxiliaryDataSet - -- ^ Auxiliary data set - -- > auxiliaryDataSet self - , invalidTxs :: Block -> Uint32Array - -- ^ Invalid transactions - -- > invalidTxs self - , new :: Header -> TxBodies -> TxWitnessSets -> AuxiliaryDataSet -> Uint32Array -> Block - -- ^ New - -- > new header txBodies txWitnessSets auxiliaryDataSet invalidTxs - } - --- | Block class API -block :: BlockClass -block = - { free: block_free - , toBytes: block_toBytes - , fromBytes: \a1 -> runForeignMaybe $ block_fromBytes a1 - , toHex: block_toHex - , fromHex: \a1 -> runForeignMaybe $ block_fromHex a1 - , toJson: block_toJson - , toJsValue: block_toJsValue - , fromJson: \a1 -> runForeignMaybe $ block_fromJson a1 - , header: block_header - , txBodies: block_txBodies - , txWitnessSets: block_txWitnessSets - , auxiliaryDataSet: block_auxiliaryDataSet - , invalidTxs: block_invalidTxs - , new: block_new - } - -instance HasFree Block where - free = block.free - -instance Show Block where - show = block.toHex - -instance ToJsValue Block where - toJsValue = block.toJsValue - -instance IsHex Block where - toHex = block.toHex - fromHex = block.fromHex - -instance IsBytes Block where - toBytes = block.toBytes - fromBytes = block.fromBytes - -instance IsJson Block where - toJson = block.toJson - fromJson = block.fromJson - -------------------------------------------------------------------------------------- --- Block hash - -foreign import blockHash_free :: BlockHash -> Effect Unit -foreign import blockHash_fromBytes :: Bytes -> ForeignErrorable BlockHash -foreign import blockHash_toBytes :: BlockHash -> Bytes -foreign import blockHash_toBech32 :: BlockHash -> String -> String -foreign import blockHash_fromBech32 :: String -> ForeignErrorable BlockHash -foreign import blockHash_toHex :: BlockHash -> String -foreign import blockHash_fromHex :: String -> ForeignErrorable BlockHash - --- | Block hash class -type BlockHashClass = - { free :: BlockHash -> Effect Unit - -- ^ Free - -- > free self - , fromBytes :: Bytes -> Maybe BlockHash - -- ^ From bytes - -- > fromBytes bytes - , toBytes :: BlockHash -> Bytes - -- ^ To bytes - -- > toBytes self - , toBech32 :: BlockHash -> String -> String - -- ^ To bech32 - -- > toBech32 self prefix - , fromBech32 :: String -> Maybe BlockHash - -- ^ From bech32 - -- > fromBech32 bechStr - , toHex :: BlockHash -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe BlockHash - -- ^ From hex - -- > fromHex hex - } - --- | Block hash class API -blockHash :: BlockHashClass -blockHash = - { free: blockHash_free - , fromBytes: \a1 -> runForeignMaybe $ blockHash_fromBytes a1 - , toBytes: blockHash_toBytes - , toBech32: blockHash_toBech32 - , fromBech32: \a1 -> runForeignMaybe $ blockHash_fromBech32 a1 - , toHex: blockHash_toHex - , fromHex: \a1 -> runForeignMaybe $ blockHash_fromHex a1 - } - -instance HasFree BlockHash where - free = blockHash.free - -instance Show BlockHash where - show = blockHash.toHex - -instance IsHex BlockHash where - toHex = blockHash.toHex - fromHex = blockHash.fromHex - -instance IsBytes BlockHash where - toBytes = blockHash.toBytes - fromBytes = blockHash.fromBytes - -------------------------------------------------------------------------------------- --- Bootstrap witness - -foreign import bootstrapWitness_free :: BootstrapWitness -> Effect Unit -foreign import bootstrapWitness_toBytes :: BootstrapWitness -> Bytes -foreign import bootstrapWitness_fromBytes :: Bytes -> ForeignErrorable BootstrapWitness -foreign import bootstrapWitness_toHex :: BootstrapWitness -> String -foreign import bootstrapWitness_fromHex :: String -> ForeignErrorable BootstrapWitness -foreign import bootstrapWitness_toJson :: BootstrapWitness -> String -foreign import bootstrapWitness_toJsValue :: BootstrapWitness -> BootstrapWitnessJson -foreign import bootstrapWitness_fromJson :: String -> ForeignErrorable BootstrapWitness -foreign import bootstrapWitness_vkey :: BootstrapWitness -> Vkey -foreign import bootstrapWitness_signature :: BootstrapWitness -> Ed25519Signature -foreign import bootstrapWitness_chainCode :: BootstrapWitness -> Bytes -foreign import bootstrapWitness_attributes :: BootstrapWitness -> Bytes -foreign import bootstrapWitness_new :: Vkey -> Ed25519Signature -> Bytes -> Bytes -> BootstrapWitness - --- | Bootstrap witness class -type BootstrapWitnessClass = - { free :: BootstrapWitness -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: BootstrapWitness -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe BootstrapWitness - -- ^ From bytes - -- > fromBytes bytes - , toHex :: BootstrapWitness -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe BootstrapWitness - -- ^ From hex - -- > fromHex hexStr - , toJson :: BootstrapWitness -> String - -- ^ To json - -- > toJson self - , toJsValue :: BootstrapWitness -> BootstrapWitnessJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe BootstrapWitness - -- ^ From json - -- > fromJson json - , vkey :: BootstrapWitness -> Vkey - -- ^ Vkey - -- > vkey self - , signature :: BootstrapWitness -> Ed25519Signature - -- ^ Signature - -- > signature self - , chainCode :: BootstrapWitness -> Bytes - -- ^ Chain code - -- > chainCode self - , attributes :: BootstrapWitness -> Bytes - -- ^ Attributes - -- > attributes self - , new :: Vkey -> Ed25519Signature -> Bytes -> Bytes -> BootstrapWitness - -- ^ New - -- > new vkey signature chainCode attributes - } - --- | Bootstrap witness class API -bootstrapWitness :: BootstrapWitnessClass -bootstrapWitness = - { free: bootstrapWitness_free - , toBytes: bootstrapWitness_toBytes - , fromBytes: \a1 -> runForeignMaybe $ bootstrapWitness_fromBytes a1 - , toHex: bootstrapWitness_toHex - , fromHex: \a1 -> runForeignMaybe $ bootstrapWitness_fromHex a1 - , toJson: bootstrapWitness_toJson - , toJsValue: bootstrapWitness_toJsValue - , fromJson: \a1 -> runForeignMaybe $ bootstrapWitness_fromJson a1 - , vkey: bootstrapWitness_vkey - , signature: bootstrapWitness_signature - , chainCode: bootstrapWitness_chainCode - , attributes: bootstrapWitness_attributes - , new: bootstrapWitness_new - } - -instance HasFree BootstrapWitness where - free = bootstrapWitness.free - -instance Show BootstrapWitness where - show = bootstrapWitness.toHex - -instance ToJsValue BootstrapWitness where - toJsValue = bootstrapWitness.toJsValue - -instance IsHex BootstrapWitness where - toHex = bootstrapWitness.toHex - fromHex = bootstrapWitness.fromHex - -instance IsBytes BootstrapWitness where - toBytes = bootstrapWitness.toBytes - fromBytes = bootstrapWitness.fromBytes - -instance IsJson BootstrapWitness where - toJson = bootstrapWitness.toJson - fromJson = bootstrapWitness.fromJson - -------------------------------------------------------------------------------------- --- Bootstrap witnesses - -foreign import bootstrapWitnesses_free :: BootstrapWitnesses -> Effect Unit -foreign import bootstrapWitnesses_new :: Effect BootstrapWitnesses -foreign import bootstrapWitnesses_len :: BootstrapWitnesses -> Effect Int -foreign import bootstrapWitnesses_get :: BootstrapWitnesses -> Int -> Effect BootstrapWitness -foreign import bootstrapWitnesses_add :: BootstrapWitnesses -> BootstrapWitness -> Effect Unit - --- | Bootstrap witnesses class -type BootstrapWitnessesClass = - { free :: BootstrapWitnesses -> Effect Unit - -- ^ Free - -- > free self - , new :: Effect BootstrapWitnesses - -- ^ New - -- > new - , len :: BootstrapWitnesses -> Effect Int - -- ^ Len - -- > len self - , get :: BootstrapWitnesses -> Int -> Effect BootstrapWitness - -- ^ Get - -- > get self index - , add :: BootstrapWitnesses -> BootstrapWitness -> Effect Unit - -- ^ Add - -- > add self elem - } - --- | Bootstrap witnesses class API -bootstrapWitnesses :: BootstrapWitnessesClass -bootstrapWitnesses = - { free: bootstrapWitnesses_free - , new: bootstrapWitnesses_new - , len: bootstrapWitnesses_len - , get: bootstrapWitnesses_get - , add: bootstrapWitnesses_add - } - -instance HasFree BootstrapWitnesses where - free = bootstrapWitnesses.free - -instance MutableList BootstrapWitnesses BootstrapWitness where - addItem = bootstrapWitnesses.add - getItem = bootstrapWitnesses.get - emptyList = bootstrapWitnesses.new - -instance MutableLen BootstrapWitnesses where - getLen = bootstrapWitnesses.len - -------------------------------------------------------------------------------------- --- Byron address - -foreign import byronAddress_free :: ByronAddress -> Effect Unit -foreign import byronAddress_toBase58 :: ByronAddress -> String -foreign import byronAddress_toBytes :: ByronAddress -> Bytes -foreign import byronAddress_fromBytes :: Bytes -> ForeignErrorable ByronAddress -foreign import byronAddress_byronProtocolMagic :: ByronAddress -> Number -foreign import byronAddress_attributes :: ByronAddress -> Bytes -foreign import byronAddress_networkId :: ByronAddress -> Int -foreign import byronAddress_fromBase58 :: String -> ByronAddress -foreign import byronAddress_icarusFromKey :: Bip32PublicKey -> Number -> ByronAddress -foreign import byronAddress_isValid :: String -> Boolean -foreign import byronAddress_toAddress :: ByronAddress -> Address -foreign import byronAddress_fromAddress :: Address -> Nullable ByronAddress - --- | Byron address class -type ByronAddressClass = - { free :: ByronAddress -> Effect Unit - -- ^ Free - -- > free self - , toBase58 :: ByronAddress -> String - -- ^ To base58 - -- > toBase58 self - , toBytes :: ByronAddress -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe ByronAddress - -- ^ From bytes - -- > fromBytes bytes - , byronProtocolMagic :: ByronAddress -> Number - -- ^ Byron protocol magic - -- > byronProtocolMagic self - , attributes :: ByronAddress -> Bytes - -- ^ Attributes - -- > attributes self - , networkId :: ByronAddress -> Int - -- ^ Network id - -- > networkId self - , fromBase58 :: String -> ByronAddress - -- ^ From base58 - -- > fromBase58 s - , icarusFromKey :: Bip32PublicKey -> Number -> ByronAddress - -- ^ Icarus from key - -- > icarusFromKey key protocolMagic - , isValid :: String -> Boolean - -- ^ Is valid - -- > isValid s - , toAddress :: ByronAddress -> Address - -- ^ To address - -- > toAddress self - , fromAddress :: Address -> Maybe ByronAddress - -- ^ From address - -- > fromAddress addr - } - --- | Byron address class API -byronAddress :: ByronAddressClass -byronAddress = - { free: byronAddress_free - , toBase58: byronAddress_toBase58 - , toBytes: byronAddress_toBytes - , fromBytes: \a1 -> runForeignMaybe $ byronAddress_fromBytes a1 - , byronProtocolMagic: byronAddress_byronProtocolMagic - , attributes: byronAddress_attributes - , networkId: byronAddress_networkId - , fromBase58: byronAddress_fromBase58 - , icarusFromKey: byronAddress_icarusFromKey - , isValid: byronAddress_isValid - , toAddress: byronAddress_toAddress - , fromAddress: \a1 -> Nullable.toMaybe $ byronAddress_fromAddress a1 - } - -instance HasFree ByronAddress where - free = byronAddress.free - -instance IsBytes ByronAddress where - toBytes = byronAddress.toBytes - fromBytes = byronAddress.fromBytes - -------------------------------------------------------------------------------------- --- Certificate - -foreign import certificate_free :: Certificate -> Effect Unit -foreign import certificate_toBytes :: Certificate -> Bytes -foreign import certificate_fromBytes :: Bytes -> ForeignErrorable Certificate -foreign import certificate_toHex :: Certificate -> String -foreign import certificate_fromHex :: String -> ForeignErrorable Certificate -foreign import certificate_toJson :: Certificate -> String -foreign import certificate_toJsValue :: Certificate -> CertificateJson -foreign import certificate_fromJson :: String -> ForeignErrorable Certificate -foreign import certificate_newStakeRegistration :: StakeRegistration -> Certificate -foreign import certificate_newStakeDeregistration :: StakeDeregistration -> Certificate -foreign import certificate_newStakeDelegation :: StakeDelegation -> Certificate -foreign import certificate_newPoolRegistration :: PoolRegistration -> Certificate -foreign import certificate_newPoolRetirement :: PoolRetirement -> Certificate -foreign import certificate_newGenesisKeyDelegation :: GenesisKeyDelegation -> Certificate -foreign import certificate_newMoveInstantaneousRewardsCert :: MoveInstantaneousRewardsCert -> Certificate -foreign import certificate_kind :: Certificate -> Number -foreign import certificate_asStakeRegistration :: Certificate -> Nullable StakeRegistration -foreign import certificate_asStakeDeregistration :: Certificate -> Nullable StakeDeregistration -foreign import certificate_asStakeDelegation :: Certificate -> Nullable StakeDelegation -foreign import certificate_asPoolRegistration :: Certificate -> Nullable PoolRegistration -foreign import certificate_asPoolRetirement :: Certificate -> Nullable PoolRetirement -foreign import certificate_asGenesisKeyDelegation :: Certificate -> Nullable GenesisKeyDelegation -foreign import certificate_asMoveInstantaneousRewardsCert :: Certificate -> Nullable MoveInstantaneousRewardsCert - --- | Certificate class -type CertificateClass = - { free :: Certificate -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: Certificate -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe Certificate - -- ^ From bytes - -- > fromBytes bytes - , toHex :: Certificate -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe Certificate - -- ^ From hex - -- > fromHex hexStr - , toJson :: Certificate -> String - -- ^ To json - -- > toJson self - , toJsValue :: Certificate -> CertificateJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe Certificate - -- ^ From json - -- > fromJson json - , newStakeRegistration :: StakeRegistration -> Certificate - -- ^ New stake registration - -- > newStakeRegistration stakeRegistration - , newStakeDeregistration :: StakeDeregistration -> Certificate - -- ^ New stake deregistration - -- > newStakeDeregistration stakeDeregistration - , newStakeDelegation :: StakeDelegation -> Certificate - -- ^ New stake delegation - -- > newStakeDelegation stakeDelegation - , newPoolRegistration :: PoolRegistration -> Certificate - -- ^ New pool registration - -- > newPoolRegistration poolRegistration - , newPoolRetirement :: PoolRetirement -> Certificate - -- ^ New pool retirement - -- > newPoolRetirement poolRetirement - , newGenesisKeyDelegation :: GenesisKeyDelegation -> Certificate - -- ^ New genesis key delegation - -- > newGenesisKeyDelegation genesisKeyDelegation - , newMoveInstantaneousRewardsCert :: MoveInstantaneousRewardsCert -> Certificate - -- ^ New move instantaneous rewards cert - -- > newMoveInstantaneousRewardsCert moveInstantaneousRewardsCert - , kind :: Certificate -> Number - -- ^ Kind - -- > kind self - , asStakeRegistration :: Certificate -> Maybe StakeRegistration - -- ^ As stake registration - -- > asStakeRegistration self - , asStakeDeregistration :: Certificate -> Maybe StakeDeregistration - -- ^ As stake deregistration - -- > asStakeDeregistration self - , asStakeDelegation :: Certificate -> Maybe StakeDelegation - -- ^ As stake delegation - -- > asStakeDelegation self - , asPoolRegistration :: Certificate -> Maybe PoolRegistration - -- ^ As pool registration - -- > asPoolRegistration self - , asPoolRetirement :: Certificate -> Maybe PoolRetirement - -- ^ As pool retirement - -- > asPoolRetirement self - , asGenesisKeyDelegation :: Certificate -> Maybe GenesisKeyDelegation - -- ^ As genesis key delegation - -- > asGenesisKeyDelegation self - , asMoveInstantaneousRewardsCert :: Certificate -> Maybe MoveInstantaneousRewardsCert - -- ^ As move instantaneous rewards cert - -- > asMoveInstantaneousRewardsCert self - } - --- | Certificate class API -certificate :: CertificateClass -certificate = - { free: certificate_free - , toBytes: certificate_toBytes - , fromBytes: \a1 -> runForeignMaybe $ certificate_fromBytes a1 - , toHex: certificate_toHex - , fromHex: \a1 -> runForeignMaybe $ certificate_fromHex a1 - , toJson: certificate_toJson - , toJsValue: certificate_toJsValue - , fromJson: \a1 -> runForeignMaybe $ certificate_fromJson a1 - , newStakeRegistration: certificate_newStakeRegistration - , newStakeDeregistration: certificate_newStakeDeregistration - , newStakeDelegation: certificate_newStakeDelegation - , newPoolRegistration: certificate_newPoolRegistration - , newPoolRetirement: certificate_newPoolRetirement - , newGenesisKeyDelegation: certificate_newGenesisKeyDelegation - , newMoveInstantaneousRewardsCert: certificate_newMoveInstantaneousRewardsCert - , kind: certificate_kind - , asStakeRegistration: \a1 -> Nullable.toMaybe $ certificate_asStakeRegistration a1 - , asStakeDeregistration: \a1 -> Nullable.toMaybe $ certificate_asStakeDeregistration a1 - , asStakeDelegation: \a1 -> Nullable.toMaybe $ certificate_asStakeDelegation a1 - , asPoolRegistration: \a1 -> Nullable.toMaybe $ certificate_asPoolRegistration a1 - , asPoolRetirement: \a1 -> Nullable.toMaybe $ certificate_asPoolRetirement a1 - , asGenesisKeyDelegation: \a1 -> Nullable.toMaybe $ certificate_asGenesisKeyDelegation a1 - , asMoveInstantaneousRewardsCert: \a1 -> Nullable.toMaybe $ certificate_asMoveInstantaneousRewardsCert a1 - } - -instance HasFree Certificate where - free = certificate.free - -instance Show Certificate where - show = certificate.toHex - -instance ToJsValue Certificate where - toJsValue = certificate.toJsValue - -instance IsHex Certificate where - toHex = certificate.toHex - fromHex = certificate.fromHex - -instance IsBytes Certificate where - toBytes = certificate.toBytes - fromBytes = certificate.fromBytes - -instance IsJson Certificate where - toJson = certificate.toJson - fromJson = certificate.fromJson - -------------------------------------------------------------------------------------- --- Certificates - -foreign import certificates_free :: Certificates -> Effect Unit -foreign import certificates_toBytes :: Certificates -> Bytes -foreign import certificates_fromBytes :: Bytes -> ForeignErrorable Certificates -foreign import certificates_toHex :: Certificates -> String -foreign import certificates_fromHex :: String -> ForeignErrorable Certificates -foreign import certificates_toJson :: Certificates -> String -foreign import certificates_toJsValue :: Certificates -> CertificatesJson -foreign import certificates_fromJson :: String -> ForeignErrorable Certificates -foreign import certificates_new :: Effect Certificates -foreign import certificates_len :: Certificates -> Effect Int -foreign import certificates_get :: Certificates -> Int -> Effect Certificate -foreign import certificates_add :: Certificates -> Certificate -> Effect Unit - --- | Certificates class -type CertificatesClass = - { free :: Certificates -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: Certificates -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe Certificates - -- ^ From bytes - -- > fromBytes bytes - , toHex :: Certificates -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe Certificates - -- ^ From hex - -- > fromHex hexStr - , toJson :: Certificates -> String - -- ^ To json - -- > toJson self - , toJsValue :: Certificates -> CertificatesJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe Certificates - -- ^ From json - -- > fromJson json - , new :: Effect Certificates - -- ^ New - -- > new - , len :: Certificates -> Effect Int - -- ^ Len - -- > len self - , get :: Certificates -> Int -> Effect Certificate - -- ^ Get - -- > get self index - , add :: Certificates -> Certificate -> Effect Unit - -- ^ Add - -- > add self elem - } - --- | Certificates class API -certificates :: CertificatesClass -certificates = - { free: certificates_free - , toBytes: certificates_toBytes - , fromBytes: \a1 -> runForeignMaybe $ certificates_fromBytes a1 - , toHex: certificates_toHex - , fromHex: \a1 -> runForeignMaybe $ certificates_fromHex a1 - , toJson: certificates_toJson - , toJsValue: certificates_toJsValue - , fromJson: \a1 -> runForeignMaybe $ certificates_fromJson a1 - , new: certificates_new - , len: certificates_len - , get: certificates_get - , add: certificates_add - } - -instance HasFree Certificates where - free = certificates.free - -instance Show Certificates where - show = certificates.toHex - -instance MutableList Certificates Certificate where - addItem = certificates.add - getItem = certificates.get - emptyList = certificates.new - -instance MutableLen Certificates where - getLen = certificates.len - - -instance ToJsValue Certificates where - toJsValue = certificates.toJsValue - -instance IsHex Certificates where - toHex = certificates.toHex - fromHex = certificates.fromHex - -instance IsBytes Certificates where - toBytes = certificates.toBytes - fromBytes = certificates.fromBytes - -instance IsJson Certificates where - toJson = certificates.toJson - fromJson = certificates.fromJson - -------------------------------------------------------------------------------------- --- Constr plutus data - -foreign import constrPlutusData_free :: ConstrPlutusData -> Effect Unit -foreign import constrPlutusData_toBytes :: ConstrPlutusData -> Bytes -foreign import constrPlutusData_fromBytes :: Bytes -> ForeignErrorable ConstrPlutusData -foreign import constrPlutusData_toHex :: ConstrPlutusData -> String -foreign import constrPlutusData_fromHex :: String -> ForeignErrorable ConstrPlutusData -foreign import constrPlutusData_toJson :: ConstrPlutusData -> String -foreign import constrPlutusData_toJsValue :: ConstrPlutusData -> ConstrPlutusDataJson -foreign import constrPlutusData_fromJson :: String -> ForeignErrorable ConstrPlutusData -foreign import constrPlutusData_alternative :: ConstrPlutusData -> BigNum -foreign import constrPlutusData_data :: ConstrPlutusData -> PlutusList -foreign import constrPlutusData_new :: BigNum -> PlutusList -> ConstrPlutusData - --- | Constr plutus data class -type ConstrPlutusDataClass = - { free :: ConstrPlutusData -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: ConstrPlutusData -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe ConstrPlutusData - -- ^ From bytes - -- > fromBytes bytes - , toHex :: ConstrPlutusData -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe ConstrPlutusData - -- ^ From hex - -- > fromHex hexStr - , toJson :: ConstrPlutusData -> String - -- ^ To json - -- > toJson self - , toJsValue :: ConstrPlutusData -> ConstrPlutusDataJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe ConstrPlutusData - -- ^ From json - -- > fromJson json - , alternative :: ConstrPlutusData -> BigNum - -- ^ Alternative - -- > alternative self - , data :: ConstrPlutusData -> PlutusList - -- ^ Data - -- > data self - , new :: BigNum -> PlutusList -> ConstrPlutusData - -- ^ New - -- > new alternative data - } - --- | Constr plutus data class API -constrPlutusData :: ConstrPlutusDataClass -constrPlutusData = - { free: constrPlutusData_free - , toBytes: constrPlutusData_toBytes - , fromBytes: \a1 -> runForeignMaybe $ constrPlutusData_fromBytes a1 - , toHex: constrPlutusData_toHex - , fromHex: \a1 -> runForeignMaybe $ constrPlutusData_fromHex a1 - , toJson: constrPlutusData_toJson - , toJsValue: constrPlutusData_toJsValue - , fromJson: \a1 -> runForeignMaybe $ constrPlutusData_fromJson a1 - , alternative: constrPlutusData_alternative - , data: constrPlutusData_data - , new: constrPlutusData_new - } - -instance HasFree ConstrPlutusData where - free = constrPlutusData.free - -instance Show ConstrPlutusData where - show = constrPlutusData.toHex - -instance ToJsValue ConstrPlutusData where - toJsValue = constrPlutusData.toJsValue - -instance IsHex ConstrPlutusData where - toHex = constrPlutusData.toHex - fromHex = constrPlutusData.fromHex - -instance IsBytes ConstrPlutusData where - toBytes = constrPlutusData.toBytes - fromBytes = constrPlutusData.fromBytes - -instance IsJson ConstrPlutusData where - toJson = constrPlutusData.toJson - fromJson = constrPlutusData.fromJson - -------------------------------------------------------------------------------------- --- Cost model - -foreign import costModel_free :: CostModel -> Effect Unit -foreign import costModel_toBytes :: CostModel -> Bytes -foreign import costModel_fromBytes :: Bytes -> ForeignErrorable CostModel -foreign import costModel_toHex :: CostModel -> String -foreign import costModel_fromHex :: String -> ForeignErrorable CostModel -foreign import costModel_toJson :: CostModel -> String -foreign import costModel_toJsValue :: CostModel -> CostModelJson -foreign import costModel_fromJson :: String -> ForeignErrorable CostModel -foreign import costModel_new :: Effect CostModel -foreign import costModel_set :: CostModel -> Int -> Int -> Effect Int -foreign import costModel_get :: CostModel -> Int -> Effect Int -foreign import costModel_len :: CostModel -> Effect Int - --- | Cost model class -type CostModelClass = - { free :: CostModel -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: CostModel -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe CostModel - -- ^ From bytes - -- > fromBytes bytes - , toHex :: CostModel -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe CostModel - -- ^ From hex - -- > fromHex hexStr - , toJson :: CostModel -> String - -- ^ To json - -- > toJson self - , toJsValue :: CostModel -> CostModelJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe CostModel - -- ^ From json - -- > fromJson json - , new :: Effect CostModel - -- ^ New - -- > new - , set :: CostModel -> Int -> Int -> Effect Int - -- ^ Set - -- > set self operation cost - , get :: CostModel -> Int -> Effect Int - -- ^ Get - -- > get self operation - , len :: CostModel -> Effect Int - -- ^ Len - -- > len self - } - --- | Cost model class API -costModel :: CostModelClass -costModel = - { free: costModel_free - , toBytes: costModel_toBytes - , fromBytes: \a1 -> runForeignMaybe $ costModel_fromBytes a1 - , toHex: costModel_toHex - , fromHex: \a1 -> runForeignMaybe $ costModel_fromHex a1 - , toJson: costModel_toJson - , toJsValue: costModel_toJsValue - , fromJson: \a1 -> runForeignMaybe $ costModel_fromJson a1 - , new: costModel_new - , set: costModel_set - , get: costModel_get - , len: costModel_len - } - -instance HasFree CostModel where - free = costModel.free - -instance Show CostModel where - show = costModel.toHex - -instance ToJsValue CostModel where - toJsValue = costModel.toJsValue - -instance IsHex CostModel where - toHex = costModel.toHex - fromHex = costModel.fromHex - -instance IsBytes CostModel where - toBytes = costModel.toBytes - fromBytes = costModel.fromBytes - -instance IsJson CostModel where - toJson = costModel.toJson - fromJson = costModel.fromJson - -------------------------------------------------------------------------------------- --- Costmdls - -foreign import costmdls_free :: Costmdls -> Effect Unit -foreign import costmdls_toBytes :: Costmdls -> Bytes -foreign import costmdls_fromBytes :: Bytes -> ForeignErrorable Costmdls -foreign import costmdls_toHex :: Costmdls -> String -foreign import costmdls_fromHex :: String -> ForeignErrorable Costmdls -foreign import costmdls_toJson :: Costmdls -> String -foreign import costmdls_toJsValue :: Costmdls -> CostmdlsJson -foreign import costmdls_fromJson :: String -> ForeignErrorable Costmdls -foreign import costmdls_new :: Effect Costmdls -foreign import costmdls_len :: Costmdls -> Effect Int -foreign import costmdls_insert :: Costmdls -> Language -> CostModel -> Effect ((Nullable CostModel)) -foreign import costmdls_get :: Costmdls -> Language -> Effect ((Nullable CostModel)) -foreign import costmdls_keys :: Costmdls -> Effect Languages -foreign import costmdls_retainLanguageVersions :: Costmdls -> Languages -> Costmdls - --- | Costmdls class -type CostmdlsClass = - { free :: Costmdls -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: Costmdls -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe Costmdls - -- ^ From bytes - -- > fromBytes bytes - , toHex :: Costmdls -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe Costmdls - -- ^ From hex - -- > fromHex hexStr - , toJson :: Costmdls -> String - -- ^ To json - -- > toJson self - , toJsValue :: Costmdls -> CostmdlsJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe Costmdls - -- ^ From json - -- > fromJson json - , new :: Effect Costmdls - -- ^ New - -- > new - , len :: Costmdls -> Effect Int - -- ^ Len - -- > len self - , insert :: Costmdls -> Language -> CostModel -> Effect ((Maybe CostModel)) - -- ^ Insert - -- > insert self key value - , get :: Costmdls -> Language -> Effect ((Maybe CostModel)) - -- ^ Get - -- > get self key - , keys :: Costmdls -> Effect Languages - -- ^ Keys - -- > keys self - , retainLanguageVersions :: Costmdls -> Languages -> Costmdls - -- ^ Retain language versions - -- > retainLanguageVersions self languages - } - --- | Costmdls class API -costmdls :: CostmdlsClass -costmdls = - { free: costmdls_free - , toBytes: costmdls_toBytes - , fromBytes: \a1 -> runForeignMaybe $ costmdls_fromBytes a1 - , toHex: costmdls_toHex - , fromHex: \a1 -> runForeignMaybe $ costmdls_fromHex a1 - , toJson: costmdls_toJson - , toJsValue: costmdls_toJsValue - , fromJson: \a1 -> runForeignMaybe $ costmdls_fromJson a1 - , new: costmdls_new - , len: costmdls_len - , insert: \a1 a2 a3 -> Nullable.toMaybe <$> costmdls_insert a1 a2 a3 - , get: \a1 a2 -> Nullable.toMaybe <$> costmdls_get a1 a2 - , keys: costmdls_keys - , retainLanguageVersions: costmdls_retainLanguageVersions - } - -instance HasFree Costmdls where - free = costmdls.free - -instance Show Costmdls where - show = costmdls.toHex - -instance ToJsValue Costmdls where - toJsValue = costmdls.toJsValue - -instance IsHex Costmdls where - toHex = costmdls.toHex - fromHex = costmdls.fromHex - -instance IsBytes Costmdls where - toBytes = costmdls.toBytes - fromBytes = costmdls.fromBytes - -instance IsJson Costmdls where - toJson = costmdls.toJson - fromJson = costmdls.fromJson - -------------------------------------------------------------------------------------- --- DNSRecord aor aaaa - -foreign import dnsRecordAorAAAA_free :: DNSRecordAorAAAA -> Effect Unit -foreign import dnsRecordAorAAAA_toBytes :: DNSRecordAorAAAA -> Bytes -foreign import dnsRecordAorAAAA_fromBytes :: Bytes -> ForeignErrorable DNSRecordAorAAAA -foreign import dnsRecordAorAAAA_toHex :: DNSRecordAorAAAA -> String -foreign import dnsRecordAorAAAA_fromHex :: String -> ForeignErrorable DNSRecordAorAAAA -foreign import dnsRecordAorAAAA_toJson :: DNSRecordAorAAAA -> String -foreign import dnsRecordAorAAAA_toJsValue :: DNSRecordAorAAAA -> DNSRecordAorAAAAJson -foreign import dnsRecordAorAAAA_fromJson :: String -> ForeignErrorable DNSRecordAorAAAA -foreign import dnsRecordAorAAAA_new :: String -> DNSRecordAorAAAA -foreign import dnsRecordAorAAAA_record :: DNSRecordAorAAAA -> String - --- | DNSRecord aor aaaa class -type DNSRecordAorAAAAClass = - { free :: DNSRecordAorAAAA -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: DNSRecordAorAAAA -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe DNSRecordAorAAAA - -- ^ From bytes - -- > fromBytes bytes - , toHex :: DNSRecordAorAAAA -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe DNSRecordAorAAAA - -- ^ From hex - -- > fromHex hexStr - , toJson :: DNSRecordAorAAAA -> String - -- ^ To json - -- > toJson self - , toJsValue :: DNSRecordAorAAAA -> DNSRecordAorAAAAJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe DNSRecordAorAAAA - -- ^ From json - -- > fromJson json - , new :: String -> DNSRecordAorAAAA - -- ^ New - -- > new dnsName - , record :: DNSRecordAorAAAA -> String - -- ^ Record - -- > record self - } - --- | DNSRecord aor aaaa class API -dnsRecordAorAAAA :: DNSRecordAorAAAAClass -dnsRecordAorAAAA = - { free: dnsRecordAorAAAA_free - , toBytes: dnsRecordAorAAAA_toBytes - , fromBytes: \a1 -> runForeignMaybe $ dnsRecordAorAAAA_fromBytes a1 - , toHex: dnsRecordAorAAAA_toHex - , fromHex: \a1 -> runForeignMaybe $ dnsRecordAorAAAA_fromHex a1 - , toJson: dnsRecordAorAAAA_toJson - , toJsValue: dnsRecordAorAAAA_toJsValue - , fromJson: \a1 -> runForeignMaybe $ dnsRecordAorAAAA_fromJson a1 - , new: dnsRecordAorAAAA_new - , record: dnsRecordAorAAAA_record - } - -instance HasFree DNSRecordAorAAAA where - free = dnsRecordAorAAAA.free - -instance Show DNSRecordAorAAAA where - show = dnsRecordAorAAAA.toHex - -instance ToJsValue DNSRecordAorAAAA where - toJsValue = dnsRecordAorAAAA.toJsValue - -instance IsHex DNSRecordAorAAAA where - toHex = dnsRecordAorAAAA.toHex - fromHex = dnsRecordAorAAAA.fromHex - -instance IsBytes DNSRecordAorAAAA where - toBytes = dnsRecordAorAAAA.toBytes - fromBytes = dnsRecordAorAAAA.fromBytes - -instance IsJson DNSRecordAorAAAA where - toJson = dnsRecordAorAAAA.toJson - fromJson = dnsRecordAorAAAA.fromJson - -------------------------------------------------------------------------------------- --- DNSRecord srv - -foreign import dnsRecordSRV_free :: DNSRecordSRV -> Effect Unit -foreign import dnsRecordSRV_toBytes :: DNSRecordSRV -> Bytes -foreign import dnsRecordSRV_fromBytes :: Bytes -> ForeignErrorable DNSRecordSRV -foreign import dnsRecordSRV_toHex :: DNSRecordSRV -> String -foreign import dnsRecordSRV_fromHex :: String -> ForeignErrorable DNSRecordSRV -foreign import dnsRecordSRV_toJson :: DNSRecordSRV -> String -foreign import dnsRecordSRV_toJsValue :: DNSRecordSRV -> DNSRecordSRVJson -foreign import dnsRecordSRV_fromJson :: String -> ForeignErrorable DNSRecordSRV -foreign import dnsRecordSRV_new :: String -> DNSRecordSRV -foreign import dnsRecordSRV_record :: DNSRecordSRV -> String - --- | DNSRecord srv class -type DNSRecordSRVClass = - { free :: DNSRecordSRV -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: DNSRecordSRV -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe DNSRecordSRV - -- ^ From bytes - -- > fromBytes bytes - , toHex :: DNSRecordSRV -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe DNSRecordSRV - -- ^ From hex - -- > fromHex hexStr - , toJson :: DNSRecordSRV -> String - -- ^ To json - -- > toJson self - , toJsValue :: DNSRecordSRV -> DNSRecordSRVJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe DNSRecordSRV - -- ^ From json - -- > fromJson json - , new :: String -> DNSRecordSRV - -- ^ New - -- > new dnsName - , record :: DNSRecordSRV -> String - -- ^ Record - -- > record self - } - --- | DNSRecord srv class API -dnsRecordSRV :: DNSRecordSRVClass -dnsRecordSRV = - { free: dnsRecordSRV_free - , toBytes: dnsRecordSRV_toBytes - , fromBytes: \a1 -> runForeignMaybe $ dnsRecordSRV_fromBytes a1 - , toHex: dnsRecordSRV_toHex - , fromHex: \a1 -> runForeignMaybe $ dnsRecordSRV_fromHex a1 - , toJson: dnsRecordSRV_toJson - , toJsValue: dnsRecordSRV_toJsValue - , fromJson: \a1 -> runForeignMaybe $ dnsRecordSRV_fromJson a1 - , new: dnsRecordSRV_new - , record: dnsRecordSRV_record - } - -instance HasFree DNSRecordSRV where - free = dnsRecordSRV.free - -instance Show DNSRecordSRV where - show = dnsRecordSRV.toHex - -instance ToJsValue DNSRecordSRV where - toJsValue = dnsRecordSRV.toJsValue - -instance IsHex DNSRecordSRV where - toHex = dnsRecordSRV.toHex - fromHex = dnsRecordSRV.fromHex - -instance IsBytes DNSRecordSRV where - toBytes = dnsRecordSRV.toBytes - fromBytes = dnsRecordSRV.fromBytes - -instance IsJson DNSRecordSRV where - toJson = dnsRecordSRV.toJson - fromJson = dnsRecordSRV.fromJson - -------------------------------------------------------------------------------------- --- Data cost - -foreign import dataCost_free :: DataCost -> Effect Unit -foreign import dataCost_newCoinsPerWord :: BigNum -> DataCost -foreign import dataCost_newCoinsPerByte :: BigNum -> DataCost -foreign import dataCost_coinsPerByte :: DataCost -> BigNum - --- | Data cost class -type DataCostClass = - { free :: DataCost -> Effect Unit - -- ^ Free - -- > free self - , newCoinsPerWord :: BigNum -> DataCost - -- ^ New coins per word - -- > newCoinsPerWord coinsPerWord - , newCoinsPerByte :: BigNum -> DataCost - -- ^ New coins per byte - -- > newCoinsPerByte coinsPerByte - , coinsPerByte :: DataCost -> BigNum - -- ^ Coins per byte - -- > coinsPerByte self - } - --- | Data cost class API -dataCost :: DataCostClass -dataCost = - { free: dataCost_free - , newCoinsPerWord: dataCost_newCoinsPerWord - , newCoinsPerByte: dataCost_newCoinsPerByte - , coinsPerByte: dataCost_coinsPerByte - } - -instance HasFree DataCost where - free = dataCost.free - -------------------------------------------------------------------------------------- --- Data hash - -foreign import dataHash_free :: DataHash -> Effect Unit -foreign import dataHash_fromBytes :: Bytes -> ForeignErrorable DataHash -foreign import dataHash_toBytes :: DataHash -> Bytes -foreign import dataHash_toBech32 :: DataHash -> String -> String -foreign import dataHash_fromBech32 :: String -> ForeignErrorable DataHash -foreign import dataHash_toHex :: DataHash -> String -foreign import dataHash_fromHex :: String -> ForeignErrorable DataHash - --- | Data hash class -type DataHashClass = - { free :: DataHash -> Effect Unit - -- ^ Free - -- > free self - , fromBytes :: Bytes -> Maybe DataHash - -- ^ From bytes - -- > fromBytes bytes - , toBytes :: DataHash -> Bytes - -- ^ To bytes - -- > toBytes self - , toBech32 :: DataHash -> String -> String - -- ^ To bech32 - -- > toBech32 self prefix - , fromBech32 :: String -> Maybe DataHash - -- ^ From bech32 - -- > fromBech32 bechStr - , toHex :: DataHash -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe DataHash - -- ^ From hex - -- > fromHex hex - } - --- | Data hash class API -dataHash :: DataHashClass -dataHash = - { free: dataHash_free - , fromBytes: \a1 -> runForeignMaybe $ dataHash_fromBytes a1 - , toBytes: dataHash_toBytes - , toBech32: dataHash_toBech32 - , fromBech32: \a1 -> runForeignMaybe $ dataHash_fromBech32 a1 - , toHex: dataHash_toHex - , fromHex: \a1 -> runForeignMaybe $ dataHash_fromHex a1 - } - -instance HasFree DataHash where - free = dataHash.free - -instance Show DataHash where - show = dataHash.toHex - -instance IsHex DataHash where - toHex = dataHash.toHex - fromHex = dataHash.fromHex - -instance IsBytes DataHash where - toBytes = dataHash.toBytes - fromBytes = dataHash.fromBytes - -------------------------------------------------------------------------------------- --- Datum source - -foreign import datumSource_free :: DatumSource -> Effect Unit -foreign import datumSource_new :: PlutusData -> DatumSource -foreign import datumSource_newRefIn :: TxIn -> DatumSource - --- | Datum source class -type DatumSourceClass = - { free :: DatumSource -> Effect Unit - -- ^ Free - -- > free self - , new :: PlutusData -> DatumSource - -- ^ New - -- > new datum - , newRefIn :: TxIn -> DatumSource - -- ^ New ref input - -- > newRefIn in - } - --- | Datum source class API -datumSource :: DatumSourceClass -datumSource = - { free: datumSource_free - , new: datumSource_new - , newRefIn: datumSource_newRefIn - } - -instance HasFree DatumSource where - free = datumSource.free - -------------------------------------------------------------------------------------- --- Ed25519 key hash - -foreign import ed25519KeyHash_free :: Ed25519KeyHash -> Effect Unit -foreign import ed25519KeyHash_fromBytes :: Bytes -> ForeignErrorable Ed25519KeyHash -foreign import ed25519KeyHash_toBytes :: Ed25519KeyHash -> Bytes -foreign import ed25519KeyHash_toBech32 :: Ed25519KeyHash -> String -> String -foreign import ed25519KeyHash_fromBech32 :: String -> ForeignErrorable Ed25519KeyHash -foreign import ed25519KeyHash_toHex :: Ed25519KeyHash -> String -foreign import ed25519KeyHash_fromHex :: String -> ForeignErrorable Ed25519KeyHash - --- | Ed25519 key hash class -type Ed25519KeyHashClass = - { free :: Ed25519KeyHash -> Effect Unit - -- ^ Free - -- > free self - , fromBytes :: Bytes -> Maybe Ed25519KeyHash - -- ^ From bytes - -- > fromBytes bytes - , toBytes :: Ed25519KeyHash -> Bytes - -- ^ To bytes - -- > toBytes self - , toBech32 :: Ed25519KeyHash -> String -> String - -- ^ To bech32 - -- > toBech32 self prefix - , fromBech32 :: String -> Maybe Ed25519KeyHash - -- ^ From bech32 - -- > fromBech32 bechStr - , toHex :: Ed25519KeyHash -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe Ed25519KeyHash - -- ^ From hex - -- > fromHex hex - } - --- | Ed25519 key hash class API -ed25519KeyHash :: Ed25519KeyHashClass -ed25519KeyHash = - { free: ed25519KeyHash_free - , fromBytes: \a1 -> runForeignMaybe $ ed25519KeyHash_fromBytes a1 - , toBytes: ed25519KeyHash_toBytes - , toBech32: ed25519KeyHash_toBech32 - , fromBech32: \a1 -> runForeignMaybe $ ed25519KeyHash_fromBech32 a1 - , toHex: ed25519KeyHash_toHex - , fromHex: \a1 -> runForeignMaybe $ ed25519KeyHash_fromHex a1 - } - -instance HasFree Ed25519KeyHash where - free = ed25519KeyHash.free - -instance Show Ed25519KeyHash where - show = ed25519KeyHash.toHex - -instance IsHex Ed25519KeyHash where - toHex = ed25519KeyHash.toHex - fromHex = ed25519KeyHash.fromHex - -instance IsBytes Ed25519KeyHash where - toBytes = ed25519KeyHash.toBytes - fromBytes = ed25519KeyHash.fromBytes - -------------------------------------------------------------------------------------- --- Ed25519 key hashes - -foreign import ed25519KeyHashes_free :: Ed25519KeyHashes -> Effect Unit -foreign import ed25519KeyHashes_toBytes :: Ed25519KeyHashes -> Bytes -foreign import ed25519KeyHashes_fromBytes :: Bytes -> ForeignErrorable Ed25519KeyHashes -foreign import ed25519KeyHashes_toHex :: Ed25519KeyHashes -> String -foreign import ed25519KeyHashes_fromHex :: String -> ForeignErrorable Ed25519KeyHashes -foreign import ed25519KeyHashes_toJson :: Ed25519KeyHashes -> String -foreign import ed25519KeyHashes_toJsValue :: Ed25519KeyHashes -> Ed25519KeyHashesJson -foreign import ed25519KeyHashes_fromJson :: String -> ForeignErrorable Ed25519KeyHashes -foreign import ed25519KeyHashes_new :: Ed25519KeyHashes -foreign import ed25519KeyHashes_len :: Ed25519KeyHashes -> Number -foreign import ed25519KeyHashes_get :: Ed25519KeyHashes -> Number -> Ed25519KeyHash -foreign import ed25519KeyHashes_add :: Ed25519KeyHashes -> Ed25519KeyHash -> Effect Unit -foreign import ed25519KeyHashes_toOption :: Ed25519KeyHashes -> Nullable Ed25519KeyHashes - --- | Ed25519 key hashes class -type Ed25519KeyHashesClass = - { free :: Ed25519KeyHashes -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: Ed25519KeyHashes -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe Ed25519KeyHashes - -- ^ From bytes - -- > fromBytes bytes - , toHex :: Ed25519KeyHashes -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe Ed25519KeyHashes - -- ^ From hex - -- > fromHex hexStr - , toJson :: Ed25519KeyHashes -> String - -- ^ To json - -- > toJson self - , toJsValue :: Ed25519KeyHashes -> Ed25519KeyHashesJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe Ed25519KeyHashes - -- ^ From json - -- > fromJson json - , new :: Ed25519KeyHashes - -- ^ New - -- > new - , len :: Ed25519KeyHashes -> Number - -- ^ Len - -- > len self - , get :: Ed25519KeyHashes -> Number -> Ed25519KeyHash - -- ^ Get - -- > get self index - , add :: Ed25519KeyHashes -> Ed25519KeyHash -> Effect Unit - -- ^ Add - -- > add self elem - , toOption :: Ed25519KeyHashes -> Maybe Ed25519KeyHashes - -- ^ To option - -- > toOption self - } - --- | Ed25519 key hashes class API -ed25519KeyHashes :: Ed25519KeyHashesClass -ed25519KeyHashes = - { free: ed25519KeyHashes_free - , toBytes: ed25519KeyHashes_toBytes - , fromBytes: \a1 -> runForeignMaybe $ ed25519KeyHashes_fromBytes a1 - , toHex: ed25519KeyHashes_toHex - , fromHex: \a1 -> runForeignMaybe $ ed25519KeyHashes_fromHex a1 - , toJson: ed25519KeyHashes_toJson - , toJsValue: ed25519KeyHashes_toJsValue - , fromJson: \a1 -> runForeignMaybe $ ed25519KeyHashes_fromJson a1 - , new: ed25519KeyHashes_new - , len: ed25519KeyHashes_len - , get: ed25519KeyHashes_get - , add: ed25519KeyHashes_add - , toOption: \a1 -> Nullable.toMaybe $ ed25519KeyHashes_toOption a1 - } - -instance HasFree Ed25519KeyHashes where - free = ed25519KeyHashes.free - -instance Show Ed25519KeyHashes where - show = ed25519KeyHashes.toHex - -instance ToJsValue Ed25519KeyHashes where - toJsValue = ed25519KeyHashes.toJsValue - -instance IsHex Ed25519KeyHashes where - toHex = ed25519KeyHashes.toHex - fromHex = ed25519KeyHashes.fromHex - -instance IsBytes Ed25519KeyHashes where - toBytes = ed25519KeyHashes.toBytes - fromBytes = ed25519KeyHashes.fromBytes - -instance IsJson Ed25519KeyHashes where - toJson = ed25519KeyHashes.toJson - fromJson = ed25519KeyHashes.fromJson - -------------------------------------------------------------------------------------- --- Ed25519 signature - -foreign import ed25519Signature_free :: Ed25519Signature -> Effect Unit -foreign import ed25519Signature_toBytes :: Ed25519Signature -> Bytes -foreign import ed25519Signature_toBech32 :: Ed25519Signature -> String -foreign import ed25519Signature_toHex :: Ed25519Signature -> String -foreign import ed25519Signature_fromBech32 :: String -> ForeignErrorable Ed25519Signature -foreign import ed25519Signature_fromHex :: String -> ForeignErrorable Ed25519Signature -foreign import ed25519Signature_fromBytes :: Bytes -> ForeignErrorable Ed25519Signature - --- | Ed25519 signature class -type Ed25519SignatureClass = - { free :: Ed25519Signature -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: Ed25519Signature -> Bytes - -- ^ To bytes - -- > toBytes self - , toBech32 :: Ed25519Signature -> String - -- ^ To bech32 - -- > toBech32 self - , toHex :: Ed25519Signature -> String - -- ^ To hex - -- > toHex self - , fromBech32 :: String -> Maybe Ed25519Signature - -- ^ From bech32 - -- > fromBech32 bech32Str - , fromHex :: String -> Maybe Ed25519Signature - -- ^ From hex - -- > fromHex in - , fromBytes :: Bytes -> Maybe Ed25519Signature - -- ^ From bytes - -- > fromBytes bytes - } - --- | Ed25519 signature class API -ed25519Signature :: Ed25519SignatureClass -ed25519Signature = - { free: ed25519Signature_free - , toBytes: ed25519Signature_toBytes - , toBech32: ed25519Signature_toBech32 - , toHex: ed25519Signature_toHex - , fromBech32: \a1 -> runForeignMaybe $ ed25519Signature_fromBech32 a1 - , fromHex: \a1 -> runForeignMaybe $ ed25519Signature_fromHex a1 - , fromBytes: \a1 -> runForeignMaybe $ ed25519Signature_fromBytes a1 - } - -instance HasFree Ed25519Signature where - free = ed25519Signature.free - -instance Show Ed25519Signature where - show = ed25519Signature.toHex - -instance IsHex Ed25519Signature where - toHex = ed25519Signature.toHex - fromHex = ed25519Signature.fromHex - -instance IsBech32 Ed25519Signature where - toBech32 = ed25519Signature.toBech32 - fromBech32 = ed25519Signature.fromBech32 - -instance IsBytes Ed25519Signature where - toBytes = ed25519Signature.toBytes - fromBytes = ed25519Signature.fromBytes - -------------------------------------------------------------------------------------- --- Enterprise address - -foreign import enterpriseAddress_free :: EnterpriseAddress -> Effect Unit -foreign import enterpriseAddress_new :: Number -> StakeCredential -> EnterpriseAddress -foreign import enterpriseAddress_paymentCred :: EnterpriseAddress -> StakeCredential -foreign import enterpriseAddress_toAddress :: EnterpriseAddress -> Address -foreign import enterpriseAddress_fromAddress :: Address -> Nullable EnterpriseAddress - --- | Enterprise address class -type EnterpriseAddressClass = - { free :: EnterpriseAddress -> Effect Unit - -- ^ Free - -- > free self - , new :: Number -> StakeCredential -> EnterpriseAddress - -- ^ New - -- > new network payment - , paymentCred :: EnterpriseAddress -> StakeCredential - -- ^ Payment cred - -- > paymentCred self - , toAddress :: EnterpriseAddress -> Address - -- ^ To address - -- > toAddress self - , fromAddress :: Address -> Maybe EnterpriseAddress - -- ^ From address - -- > fromAddress addr - } - --- | Enterprise address class API -enterpriseAddress :: EnterpriseAddressClass -enterpriseAddress = - { free: enterpriseAddress_free - , new: enterpriseAddress_new - , paymentCred: enterpriseAddress_paymentCred - , toAddress: enterpriseAddress_toAddress - , fromAddress: \a1 -> Nullable.toMaybe $ enterpriseAddress_fromAddress a1 - } - -instance HasFree EnterpriseAddress where - free = enterpriseAddress.free - -------------------------------------------------------------------------------------- --- Ex unit prices - -foreign import exUnitPrices_free :: ExUnitPrices -> Effect Unit -foreign import exUnitPrices_toBytes :: ExUnitPrices -> Bytes -foreign import exUnitPrices_fromBytes :: Bytes -> ForeignErrorable ExUnitPrices -foreign import exUnitPrices_toHex :: ExUnitPrices -> String -foreign import exUnitPrices_fromHex :: String -> ForeignErrorable ExUnitPrices -foreign import exUnitPrices_toJson :: ExUnitPrices -> String -foreign import exUnitPrices_toJsValue :: ExUnitPrices -> ExUnitPricesJson -foreign import exUnitPrices_fromJson :: String -> ForeignErrorable ExUnitPrices -foreign import exUnitPrices_memPrice :: ExUnitPrices -> UnitInterval -foreign import exUnitPrices_stepPrice :: ExUnitPrices -> UnitInterval -foreign import exUnitPrices_new :: UnitInterval -> UnitInterval -> ExUnitPrices - --- | Ex unit prices class -type ExUnitPricesClass = - { free :: ExUnitPrices -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: ExUnitPrices -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe ExUnitPrices - -- ^ From bytes - -- > fromBytes bytes - , toHex :: ExUnitPrices -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe ExUnitPrices - -- ^ From hex - -- > fromHex hexStr - , toJson :: ExUnitPrices -> String - -- ^ To json - -- > toJson self - , toJsValue :: ExUnitPrices -> ExUnitPricesJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe ExUnitPrices - -- ^ From json - -- > fromJson json - , memPrice :: ExUnitPrices -> UnitInterval - -- ^ Mem price - -- > memPrice self - , stepPrice :: ExUnitPrices -> UnitInterval - -- ^ Step price - -- > stepPrice self - , new :: UnitInterval -> UnitInterval -> ExUnitPrices - -- ^ New - -- > new memPrice stepPrice - } - --- | Ex unit prices class API -exUnitPrices :: ExUnitPricesClass -exUnitPrices = - { free: exUnitPrices_free - , toBytes: exUnitPrices_toBytes - , fromBytes: \a1 -> runForeignMaybe $ exUnitPrices_fromBytes a1 - , toHex: exUnitPrices_toHex - , fromHex: \a1 -> runForeignMaybe $ exUnitPrices_fromHex a1 - , toJson: exUnitPrices_toJson - , toJsValue: exUnitPrices_toJsValue - , fromJson: \a1 -> runForeignMaybe $ exUnitPrices_fromJson a1 - , memPrice: exUnitPrices_memPrice - , stepPrice: exUnitPrices_stepPrice - , new: exUnitPrices_new - } - -instance HasFree ExUnitPrices where - free = exUnitPrices.free - -instance Show ExUnitPrices where - show = exUnitPrices.toHex - -instance ToJsValue ExUnitPrices where - toJsValue = exUnitPrices.toJsValue - -instance IsHex ExUnitPrices where - toHex = exUnitPrices.toHex - fromHex = exUnitPrices.fromHex - -instance IsBytes ExUnitPrices where - toBytes = exUnitPrices.toBytes - fromBytes = exUnitPrices.fromBytes - -instance IsJson ExUnitPrices where - toJson = exUnitPrices.toJson - fromJson = exUnitPrices.fromJson - -------------------------------------------------------------------------------------- --- Ex units - -foreign import exUnits_free :: ExUnits -> Effect Unit -foreign import exUnits_toBytes :: ExUnits -> Bytes -foreign import exUnits_fromBytes :: Bytes -> ForeignErrorable ExUnits -foreign import exUnits_toHex :: ExUnits -> String -foreign import exUnits_fromHex :: String -> ForeignErrorable ExUnits -foreign import exUnits_toJson :: ExUnits -> String -foreign import exUnits_toJsValue :: ExUnits -> ExUnitsJson -foreign import exUnits_fromJson :: String -> ForeignErrorable ExUnits -foreign import exUnits_mem :: ExUnits -> BigNum -foreign import exUnits_steps :: ExUnits -> BigNum -foreign import exUnits_new :: BigNum -> BigNum -> ExUnits - --- | Ex units class -type ExUnitsClass = - { free :: ExUnits -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: ExUnits -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe ExUnits - -- ^ From bytes - -- > fromBytes bytes - , toHex :: ExUnits -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe ExUnits - -- ^ From hex - -- > fromHex hexStr - , toJson :: ExUnits -> String - -- ^ To json - -- > toJson self - , toJsValue :: ExUnits -> ExUnitsJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe ExUnits - -- ^ From json - -- > fromJson json - , mem :: ExUnits -> BigNum - -- ^ Mem - -- > mem self - , steps :: ExUnits -> BigNum - -- ^ Steps - -- > steps self - , new :: BigNum -> BigNum -> ExUnits - -- ^ New - -- > new mem steps - } - --- | Ex units class API -exUnits :: ExUnitsClass -exUnits = - { free: exUnits_free - , toBytes: exUnits_toBytes - , fromBytes: \a1 -> runForeignMaybe $ exUnits_fromBytes a1 - , toHex: exUnits_toHex - , fromHex: \a1 -> runForeignMaybe $ exUnits_fromHex a1 - , toJson: exUnits_toJson - , toJsValue: exUnits_toJsValue - , fromJson: \a1 -> runForeignMaybe $ exUnits_fromJson a1 - , mem: exUnits_mem - , steps: exUnits_steps - , new: exUnits_new - } - -instance HasFree ExUnits where - free = exUnits.free - -instance Show ExUnits where - show = exUnits.toHex - -instance ToJsValue ExUnits where - toJsValue = exUnits.toJsValue - -instance IsHex ExUnits where - toHex = exUnits.toHex - fromHex = exUnits.fromHex - -instance IsBytes ExUnits where - toBytes = exUnits.toBytes - fromBytes = exUnits.fromBytes - -instance IsJson ExUnits where - toJson = exUnits.toJson - fromJson = exUnits.fromJson - -------------------------------------------------------------------------------------- --- General transaction metadata - -foreign import generalTxMetadata_free :: GeneralTxMetadata -> Effect Unit -foreign import generalTxMetadata_toBytes :: GeneralTxMetadata -> Bytes -foreign import generalTxMetadata_fromBytes :: Bytes -> ForeignErrorable GeneralTxMetadata -foreign import generalTxMetadata_toHex :: GeneralTxMetadata -> String -foreign import generalTxMetadata_fromHex :: String -> ForeignErrorable GeneralTxMetadata -foreign import generalTxMetadata_toJson :: GeneralTxMetadata -> String -foreign import generalTxMetadata_toJsValue :: GeneralTxMetadata -> GeneralTxMetadataJson -foreign import generalTxMetadata_fromJson :: String -> ForeignErrorable GeneralTxMetadata -foreign import generalTxMetadata_new :: Effect GeneralTxMetadata -foreign import generalTxMetadata_len :: GeneralTxMetadata -> Effect Int -foreign import generalTxMetadata_insert :: GeneralTxMetadata -> BigNum -> TxMetadatum -> Effect ((Nullable TxMetadatum)) -foreign import generalTxMetadata_get :: GeneralTxMetadata -> BigNum -> Effect ((Nullable TxMetadatum)) -foreign import generalTxMetadata_keys :: GeneralTxMetadata -> Effect TxMetadatumLabels - --- | General transaction metadata class -type GeneralTxMetadataClass = - { free :: GeneralTxMetadata -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: GeneralTxMetadata -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe GeneralTxMetadata - -- ^ From bytes - -- > fromBytes bytes - , toHex :: GeneralTxMetadata -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe GeneralTxMetadata - -- ^ From hex - -- > fromHex hexStr - , toJson :: GeneralTxMetadata -> String - -- ^ To json - -- > toJson self - , toJsValue :: GeneralTxMetadata -> GeneralTxMetadataJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe GeneralTxMetadata - -- ^ From json - -- > fromJson json - , new :: Effect GeneralTxMetadata - -- ^ New - -- > new - , len :: GeneralTxMetadata -> Effect Int - -- ^ Len - -- > len self - , insert :: GeneralTxMetadata -> BigNum -> TxMetadatum -> Effect ((Maybe TxMetadatum)) - -- ^ Insert - -- > insert self key value - , get :: GeneralTxMetadata -> BigNum -> Effect ((Maybe TxMetadatum)) - -- ^ Get - -- > get self key - , keys :: GeneralTxMetadata -> Effect TxMetadatumLabels - -- ^ Keys - -- > keys self - } - --- | General transaction metadata class API -generalTxMetadata :: GeneralTxMetadataClass -generalTxMetadata = - { free: generalTxMetadata_free - , toBytes: generalTxMetadata_toBytes - , fromBytes: \a1 -> runForeignMaybe $ generalTxMetadata_fromBytes a1 - , toHex: generalTxMetadata_toHex - , fromHex: \a1 -> runForeignMaybe $ generalTxMetadata_fromHex a1 - , toJson: generalTxMetadata_toJson - , toJsValue: generalTxMetadata_toJsValue - , fromJson: \a1 -> runForeignMaybe $ generalTxMetadata_fromJson a1 - , new: generalTxMetadata_new - , len: generalTxMetadata_len - , insert: \a1 a2 a3 -> Nullable.toMaybe <$> generalTxMetadata_insert a1 a2 a3 - , get: \a1 a2 -> Nullable.toMaybe <$> generalTxMetadata_get a1 a2 - , keys: generalTxMetadata_keys - } - -instance HasFree GeneralTxMetadata where - free = generalTxMetadata.free - -instance Show GeneralTxMetadata where - show = generalTxMetadata.toHex - -instance ToJsValue GeneralTxMetadata where - toJsValue = generalTxMetadata.toJsValue - -instance IsHex GeneralTxMetadata where - toHex = generalTxMetadata.toHex - fromHex = generalTxMetadata.fromHex - -instance IsBytes GeneralTxMetadata where - toBytes = generalTxMetadata.toBytes - fromBytes = generalTxMetadata.fromBytes - -instance IsJson GeneralTxMetadata where - toJson = generalTxMetadata.toJson - fromJson = generalTxMetadata.fromJson - -------------------------------------------------------------------------------------- --- Genesis delegate hash - -foreign import genesisDelegateHash_free :: GenesisDelegateHash -> Effect Unit -foreign import genesisDelegateHash_fromBytes :: Bytes -> ForeignErrorable GenesisDelegateHash -foreign import genesisDelegateHash_toBytes :: GenesisDelegateHash -> Bytes -foreign import genesisDelegateHash_toBech32 :: GenesisDelegateHash -> String -> String -foreign import genesisDelegateHash_fromBech32 :: String -> ForeignErrorable GenesisDelegateHash -foreign import genesisDelegateHash_toHex :: GenesisDelegateHash -> String -foreign import genesisDelegateHash_fromHex :: String -> ForeignErrorable GenesisDelegateHash - --- | Genesis delegate hash class -type GenesisDelegateHashClass = - { free :: GenesisDelegateHash -> Effect Unit - -- ^ Free - -- > free self - , fromBytes :: Bytes -> Maybe GenesisDelegateHash - -- ^ From bytes - -- > fromBytes bytes - , toBytes :: GenesisDelegateHash -> Bytes - -- ^ To bytes - -- > toBytes self - , toBech32 :: GenesisDelegateHash -> String -> String - -- ^ To bech32 - -- > toBech32 self prefix - , fromBech32 :: String -> Maybe GenesisDelegateHash - -- ^ From bech32 - -- > fromBech32 bechStr - , toHex :: GenesisDelegateHash -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe GenesisDelegateHash - -- ^ From hex - -- > fromHex hex - } - --- | Genesis delegate hash class API -genesisDelegateHash :: GenesisDelegateHashClass -genesisDelegateHash = - { free: genesisDelegateHash_free - , fromBytes: \a1 -> runForeignMaybe $ genesisDelegateHash_fromBytes a1 - , toBytes: genesisDelegateHash_toBytes - , toBech32: genesisDelegateHash_toBech32 - , fromBech32: \a1 -> runForeignMaybe $ genesisDelegateHash_fromBech32 a1 - , toHex: genesisDelegateHash_toHex - , fromHex: \a1 -> runForeignMaybe $ genesisDelegateHash_fromHex a1 - } - -instance HasFree GenesisDelegateHash where - free = genesisDelegateHash.free - -instance Show GenesisDelegateHash where - show = genesisDelegateHash.toHex - -instance IsHex GenesisDelegateHash where - toHex = genesisDelegateHash.toHex - fromHex = genesisDelegateHash.fromHex - -instance IsBytes GenesisDelegateHash where - toBytes = genesisDelegateHash.toBytes - fromBytes = genesisDelegateHash.fromBytes - -------------------------------------------------------------------------------------- --- Genesis hash - -foreign import genesisHash_free :: GenesisHash -> Effect Unit -foreign import genesisHash_fromBytes :: Bytes -> ForeignErrorable GenesisHash -foreign import genesisHash_toBytes :: GenesisHash -> Bytes -foreign import genesisHash_toBech32 :: GenesisHash -> String -> String -foreign import genesisHash_fromBech32 :: String -> ForeignErrorable GenesisHash -foreign import genesisHash_toHex :: GenesisHash -> String -foreign import genesisHash_fromHex :: String -> ForeignErrorable GenesisHash - --- | Genesis hash class -type GenesisHashClass = - { free :: GenesisHash -> Effect Unit - -- ^ Free - -- > free self - , fromBytes :: Bytes -> Maybe GenesisHash - -- ^ From bytes - -- > fromBytes bytes - , toBytes :: GenesisHash -> Bytes - -- ^ To bytes - -- > toBytes self - , toBech32 :: GenesisHash -> String -> String - -- ^ To bech32 - -- > toBech32 self prefix - , fromBech32 :: String -> Maybe GenesisHash - -- ^ From bech32 - -- > fromBech32 bechStr - , toHex :: GenesisHash -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe GenesisHash - -- ^ From hex - -- > fromHex hex - } - --- | Genesis hash class API -genesisHash :: GenesisHashClass -genesisHash = - { free: genesisHash_free - , fromBytes: \a1 -> runForeignMaybe $ genesisHash_fromBytes a1 - , toBytes: genesisHash_toBytes - , toBech32: genesisHash_toBech32 - , fromBech32: \a1 -> runForeignMaybe $ genesisHash_fromBech32 a1 - , toHex: genesisHash_toHex - , fromHex: \a1 -> runForeignMaybe $ genesisHash_fromHex a1 - } - -instance HasFree GenesisHash where - free = genesisHash.free - -instance Show GenesisHash where - show = genesisHash.toHex - -instance IsHex GenesisHash where - toHex = genesisHash.toHex - fromHex = genesisHash.fromHex - -instance IsBytes GenesisHash where - toBytes = genesisHash.toBytes - fromBytes = genesisHash.fromBytes - -------------------------------------------------------------------------------------- --- Genesis hashes - -foreign import genesisHashes_free :: GenesisHashes -> Effect Unit -foreign import genesisHashes_toBytes :: GenesisHashes -> Bytes -foreign import genesisHashes_fromBytes :: Bytes -> ForeignErrorable GenesisHashes -foreign import genesisHashes_toHex :: GenesisHashes -> String -foreign import genesisHashes_fromHex :: String -> ForeignErrorable GenesisHashes -foreign import genesisHashes_toJson :: GenesisHashes -> String -foreign import genesisHashes_toJsValue :: GenesisHashes -> GenesisHashesJson -foreign import genesisHashes_fromJson :: String -> ForeignErrorable GenesisHashes -foreign import genesisHashes_new :: Effect GenesisHashes -foreign import genesisHashes_len :: GenesisHashes -> Effect Int -foreign import genesisHashes_get :: GenesisHashes -> Int -> Effect GenesisHash -foreign import genesisHashes_add :: GenesisHashes -> GenesisHash -> Effect Unit - --- | Genesis hashes class -type GenesisHashesClass = - { free :: GenesisHashes -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: GenesisHashes -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe GenesisHashes - -- ^ From bytes - -- > fromBytes bytes - , toHex :: GenesisHashes -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe GenesisHashes - -- ^ From hex - -- > fromHex hexStr - , toJson :: GenesisHashes -> String - -- ^ To json - -- > toJson self - , toJsValue :: GenesisHashes -> GenesisHashesJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe GenesisHashes - -- ^ From json - -- > fromJson json - , new :: Effect GenesisHashes - -- ^ New - -- > new - , len :: GenesisHashes -> Effect Int - -- ^ Len - -- > len self - , get :: GenesisHashes -> Int -> Effect GenesisHash - -- ^ Get - -- > get self index - , add :: GenesisHashes -> GenesisHash -> Effect Unit - -- ^ Add - -- > add self elem - } - --- | Genesis hashes class API -genesisHashes :: GenesisHashesClass -genesisHashes = - { free: genesisHashes_free - , toBytes: genesisHashes_toBytes - , fromBytes: \a1 -> runForeignMaybe $ genesisHashes_fromBytes a1 - , toHex: genesisHashes_toHex - , fromHex: \a1 -> runForeignMaybe $ genesisHashes_fromHex a1 - , toJson: genesisHashes_toJson - , toJsValue: genesisHashes_toJsValue - , fromJson: \a1 -> runForeignMaybe $ genesisHashes_fromJson a1 - , new: genesisHashes_new - , len: genesisHashes_len - , get: genesisHashes_get - , add: genesisHashes_add - } - -instance HasFree GenesisHashes where - free = genesisHashes.free - -instance Show GenesisHashes where - show = genesisHashes.toHex - -instance MutableList GenesisHashes GenesisHash where - addItem = genesisHashes.add - getItem = genesisHashes.get - emptyList = genesisHashes.new - -instance MutableLen GenesisHashes where - getLen = genesisHashes.len - - -instance ToJsValue GenesisHashes where - toJsValue = genesisHashes.toJsValue - -instance IsHex GenesisHashes where - toHex = genesisHashes.toHex - fromHex = genesisHashes.fromHex - -instance IsBytes GenesisHashes where - toBytes = genesisHashes.toBytes - fromBytes = genesisHashes.fromBytes - -instance IsJson GenesisHashes where - toJson = genesisHashes.toJson - fromJson = genesisHashes.fromJson - -------------------------------------------------------------------------------------- --- Genesis key delegation - -foreign import genesisKeyDelegation_free :: GenesisKeyDelegation -> Effect Unit -foreign import genesisKeyDelegation_toBytes :: GenesisKeyDelegation -> Bytes -foreign import genesisKeyDelegation_fromBytes :: Bytes -> ForeignErrorable GenesisKeyDelegation -foreign import genesisKeyDelegation_toHex :: GenesisKeyDelegation -> String -foreign import genesisKeyDelegation_fromHex :: String -> ForeignErrorable GenesisKeyDelegation -foreign import genesisKeyDelegation_toJson :: GenesisKeyDelegation -> String -foreign import genesisKeyDelegation_toJsValue :: GenesisKeyDelegation -> GenesisKeyDelegationJson -foreign import genesisKeyDelegation_fromJson :: String -> ForeignErrorable GenesisKeyDelegation -foreign import genesisKeyDelegation_genesishash :: GenesisKeyDelegation -> GenesisHash -foreign import genesisKeyDelegation_genesisDelegateHash :: GenesisKeyDelegation -> GenesisDelegateHash -foreign import genesisKeyDelegation_vrfKeyhash :: GenesisKeyDelegation -> VRFKeyHash -foreign import genesisKeyDelegation_new :: GenesisHash -> GenesisDelegateHash -> VRFKeyHash -> GenesisKeyDelegation - --- | Genesis key delegation class -type GenesisKeyDelegationClass = - { free :: GenesisKeyDelegation -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: GenesisKeyDelegation -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe GenesisKeyDelegation - -- ^ From bytes - -- > fromBytes bytes - , toHex :: GenesisKeyDelegation -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe GenesisKeyDelegation - -- ^ From hex - -- > fromHex hexStr - , toJson :: GenesisKeyDelegation -> String - -- ^ To json - -- > toJson self - , toJsValue :: GenesisKeyDelegation -> GenesisKeyDelegationJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe GenesisKeyDelegation - -- ^ From json - -- > fromJson json - , genesishash :: GenesisKeyDelegation -> GenesisHash - -- ^ Genesishash - -- > genesishash self - , genesisDelegateHash :: GenesisKeyDelegation -> GenesisDelegateHash - -- ^ Genesis delegate hash - -- > genesisDelegateHash self - , vrfKeyhash :: GenesisKeyDelegation -> VRFKeyHash - -- ^ Vrf keyhash - -- > vrfKeyhash self - , new :: GenesisHash -> GenesisDelegateHash -> VRFKeyHash -> GenesisKeyDelegation - -- ^ New - -- > new genesishash genesisDelegateHash vrfKeyhash - } - --- | Genesis key delegation class API -genesisKeyDelegation :: GenesisKeyDelegationClass -genesisKeyDelegation = - { free: genesisKeyDelegation_free - , toBytes: genesisKeyDelegation_toBytes - , fromBytes: \a1 -> runForeignMaybe $ genesisKeyDelegation_fromBytes a1 - , toHex: genesisKeyDelegation_toHex - , fromHex: \a1 -> runForeignMaybe $ genesisKeyDelegation_fromHex a1 - , toJson: genesisKeyDelegation_toJson - , toJsValue: genesisKeyDelegation_toJsValue - , fromJson: \a1 -> runForeignMaybe $ genesisKeyDelegation_fromJson a1 - , genesishash: genesisKeyDelegation_genesishash - , genesisDelegateHash: genesisKeyDelegation_genesisDelegateHash - , vrfKeyhash: genesisKeyDelegation_vrfKeyhash - , new: genesisKeyDelegation_new - } - -instance HasFree GenesisKeyDelegation where - free = genesisKeyDelegation.free - -instance Show GenesisKeyDelegation where - show = genesisKeyDelegation.toHex - -instance ToJsValue GenesisKeyDelegation where - toJsValue = genesisKeyDelegation.toJsValue - -instance IsHex GenesisKeyDelegation where - toHex = genesisKeyDelegation.toHex - fromHex = genesisKeyDelegation.fromHex - -instance IsBytes GenesisKeyDelegation where - toBytes = genesisKeyDelegation.toBytes - fromBytes = genesisKeyDelegation.fromBytes - -instance IsJson GenesisKeyDelegation where - toJson = genesisKeyDelegation.toJson - fromJson = genesisKeyDelegation.fromJson - -------------------------------------------------------------------------------------- --- Header - -foreign import header_free :: Header -> Effect Unit -foreign import header_toBytes :: Header -> Bytes -foreign import header_fromBytes :: Bytes -> ForeignErrorable Header -foreign import header_toHex :: Header -> String -foreign import header_fromHex :: String -> ForeignErrorable Header -foreign import header_toJson :: Header -> String -foreign import header_toJsValue :: Header -> HeaderJson -foreign import header_fromJson :: String -> ForeignErrorable Header -foreign import header_headerBody :: Header -> HeaderBody -foreign import header_bodySignature :: Header -> KESSignature -foreign import header_new :: HeaderBody -> KESSignature -> Header - --- | Header class -type HeaderClass = - { free :: Header -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: Header -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe Header - -- ^ From bytes - -- > fromBytes bytes - , toHex :: Header -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe Header - -- ^ From hex - -- > fromHex hexStr - , toJson :: Header -> String - -- ^ To json - -- > toJson self - , toJsValue :: Header -> HeaderJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe Header - -- ^ From json - -- > fromJson json - , headerBody :: Header -> HeaderBody - -- ^ Header body - -- > headerBody self - , bodySignature :: Header -> KESSignature - -- ^ Body signature - -- > bodySignature self - , new :: HeaderBody -> KESSignature -> Header - -- ^ New - -- > new headerBody bodySignature - } - --- | Header class API -header :: HeaderClass -header = - { free: header_free - , toBytes: header_toBytes - , fromBytes: \a1 -> runForeignMaybe $ header_fromBytes a1 - , toHex: header_toHex - , fromHex: \a1 -> runForeignMaybe $ header_fromHex a1 - , toJson: header_toJson - , toJsValue: header_toJsValue - , fromJson: \a1 -> runForeignMaybe $ header_fromJson a1 - , headerBody: header_headerBody - , bodySignature: header_bodySignature - , new: header_new - } - -instance HasFree Header where - free = header.free - -instance Show Header where - show = header.toHex - -instance ToJsValue Header where - toJsValue = header.toJsValue - -instance IsHex Header where - toHex = header.toHex - fromHex = header.fromHex - -instance IsBytes Header where - toBytes = header.toBytes - fromBytes = header.fromBytes - -instance IsJson Header where - toJson = header.toJson - fromJson = header.fromJson - -------------------------------------------------------------------------------------- --- Header body - -foreign import headerBody_free :: HeaderBody -> Effect Unit -foreign import headerBody_toBytes :: HeaderBody -> Bytes -foreign import headerBody_fromBytes :: Bytes -> ForeignErrorable HeaderBody -foreign import headerBody_toHex :: HeaderBody -> String -foreign import headerBody_fromHex :: String -> ForeignErrorable HeaderBody -foreign import headerBody_toJson :: HeaderBody -> String -foreign import headerBody_toJsValue :: HeaderBody -> HeaderBodyJson -foreign import headerBody_fromJson :: String -> ForeignErrorable HeaderBody -foreign import headerBody_blockNumber :: HeaderBody -> Int -foreign import headerBody_slot :: HeaderBody -> Int -foreign import headerBody_slotBignum :: HeaderBody -> BigNum -foreign import headerBody_prevHash :: HeaderBody -> Nullable BlockHash -foreign import headerBody_issuerVkey :: HeaderBody -> Vkey -foreign import headerBody_vrfVkey :: HeaderBody -> VRFVKey -foreign import headerBody_hasNonceAndLeaderVrf :: HeaderBody -> Boolean -foreign import headerBody_nonceVrfOrNothing :: HeaderBody -> Nullable VRFCert -foreign import headerBody_leaderVrfOrNothing :: HeaderBody -> Nullable VRFCert -foreign import headerBody_hasVrfResult :: HeaderBody -> Boolean -foreign import headerBody_vrfResultOrNothing :: HeaderBody -> Nullable VRFCert -foreign import headerBody_blockBodySize :: HeaderBody -> Int -foreign import headerBody_blockBodyHash :: HeaderBody -> BlockHash -foreign import headerBody_operationalCert :: HeaderBody -> OperationalCert -foreign import headerBody_protocolVersion :: HeaderBody -> ProtocolVersion -foreign import headerBody_new :: Int -> Int -> Nullable BlockHash -> Vkey -> VRFVKey -> VRFCert -> Int -> BlockHash -> OperationalCert -> ProtocolVersion -> HeaderBody -foreign import headerBody_newHeaderbody :: Number -> BigNum -> Nullable BlockHash -> Vkey -> VRFVKey -> VRFCert -> Number -> BlockHash -> OperationalCert -> ProtocolVersion -> HeaderBody - --- | Header body class -type HeaderBodyClass = - { free :: HeaderBody -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: HeaderBody -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe HeaderBody - -- ^ From bytes - -- > fromBytes bytes - , toHex :: HeaderBody -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe HeaderBody - -- ^ From hex - -- > fromHex hexStr - , toJson :: HeaderBody -> String - -- ^ To json - -- > toJson self - , toJsValue :: HeaderBody -> HeaderBodyJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe HeaderBody - -- ^ From json - -- > fromJson json - , blockNumber :: HeaderBody -> Int - -- ^ Block number - -- > blockNumber self - , slot :: HeaderBody -> Int - -- ^ Slot - -- > slot self - , slotBignum :: HeaderBody -> BigNum - -- ^ Slot bignum - -- > slotBignum self - , prevHash :: HeaderBody -> Maybe BlockHash - -- ^ Prev hash - -- > prevHash self - , issuerVkey :: HeaderBody -> Vkey - -- ^ Issuer vkey - -- > issuerVkey self - , vrfVkey :: HeaderBody -> VRFVKey - -- ^ Vrf vkey - -- > vrfVkey self - , hasNonceAndLeaderVrf :: HeaderBody -> Boolean - -- ^ Has nonce and leader vrf - -- > hasNonceAndLeaderVrf self - , nonceVrfOrNothing :: HeaderBody -> Maybe VRFCert - -- ^ Nonce vrf or nothing - -- > nonceVrfOrNothing self - , leaderVrfOrNothing :: HeaderBody -> Maybe VRFCert - -- ^ Leader vrf or nothing - -- > leaderVrfOrNothing self - , hasVrfResult :: HeaderBody -> Boolean - -- ^ Has vrf result - -- > hasVrfResult self - , vrfResultOrNothing :: HeaderBody -> Maybe VRFCert - -- ^ Vrf result or nothing - -- > vrfResultOrNothing self - , blockBodySize :: HeaderBody -> Int - -- ^ Block body size - -- > blockBodySize self - , blockBodyHash :: HeaderBody -> BlockHash - -- ^ Block body hash - -- > blockBodyHash self - , operationalCert :: HeaderBody -> OperationalCert - -- ^ Operational cert - -- > operationalCert self - , protocolVersion :: HeaderBody -> ProtocolVersion - -- ^ Protocol version - -- > protocolVersion self - , new :: Int -> Int -> Maybe BlockHash -> Vkey -> VRFVKey -> VRFCert -> Int -> BlockHash -> OperationalCert -> ProtocolVersion -> HeaderBody - -- ^ New - -- > new blockNumber slot prevHash issuerVkey vrfVkey vrfResult blockBodySize blockBodyHash operationalCert protocolVersion - , newHeaderbody :: Number -> BigNum -> Maybe BlockHash -> Vkey -> VRFVKey -> VRFCert -> Number -> BlockHash -> OperationalCert -> ProtocolVersion -> HeaderBody - -- ^ New headerbody - -- > newHeaderbody blockNumber slot prevHash issuerVkey vrfVkey vrfResult blockBodySize blockBodyHash operationalCert protocolVersion - } - --- | Header body class API -headerBody :: HeaderBodyClass -headerBody = - { free: headerBody_free - , toBytes: headerBody_toBytes - , fromBytes: \a1 -> runForeignMaybe $ headerBody_fromBytes a1 - , toHex: headerBody_toHex - , fromHex: \a1 -> runForeignMaybe $ headerBody_fromHex a1 - , toJson: headerBody_toJson - , toJsValue: headerBody_toJsValue - , fromJson: \a1 -> runForeignMaybe $ headerBody_fromJson a1 - , blockNumber: headerBody_blockNumber - , slot: headerBody_slot - , slotBignum: headerBody_slotBignum - , prevHash: \a1 -> Nullable.toMaybe $ headerBody_prevHash a1 - , issuerVkey: headerBody_issuerVkey - , vrfVkey: headerBody_vrfVkey - , hasNonceAndLeaderVrf: headerBody_hasNonceAndLeaderVrf - , nonceVrfOrNothing: \a1 -> Nullable.toMaybe $ headerBody_nonceVrfOrNothing a1 - , leaderVrfOrNothing: \a1 -> Nullable.toMaybe $ headerBody_leaderVrfOrNothing a1 - , hasVrfResult: headerBody_hasVrfResult - , vrfResultOrNothing: \a1 -> Nullable.toMaybe $ headerBody_vrfResultOrNothing a1 - , blockBodySize: headerBody_blockBodySize - , blockBodyHash: headerBody_blockBodyHash - , operationalCert: headerBody_operationalCert - , protocolVersion: headerBody_protocolVersion - , new: \a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 -> headerBody_new a1 a2 (Nullable.toNullable a3) a4 a5 a6 a7 a8 a9 a10 - , newHeaderbody: \a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 -> headerBody_newHeaderbody a1 a2 (Nullable.toNullable a3) a4 a5 a6 a7 a8 a9 a10 - } - -instance HasFree HeaderBody where - free = headerBody.free - -instance Show HeaderBody where - show = headerBody.toHex - -instance ToJsValue HeaderBody where - toJsValue = headerBody.toJsValue - -instance IsHex HeaderBody where - toHex = headerBody.toHex - fromHex = headerBody.fromHex - -instance IsBytes HeaderBody where - toBytes = headerBody.toBytes - fromBytes = headerBody.fromBytes - -instance IsJson HeaderBody where - toJson = headerBody.toJson - fromJson = headerBody.fromJson - -------------------------------------------------------------------------------------- --- Int - -foreign import int_free :: Int -> Effect Unit -foreign import int_toBytes :: Int -> Bytes -foreign import int_fromBytes :: Bytes -> ForeignErrorable Int -foreign import int_toHex :: Int -> String -foreign import int_fromHex :: String -> ForeignErrorable Int -foreign import int_toJson :: Int -> String -foreign import int_toJsValue :: Int -> IntJson -foreign import int_fromJson :: String -> ForeignErrorable Int -foreign import int_new :: BigNum -> Int -foreign import int_newNegative :: BigNum -> Int -foreign import int_newI32 :: Number -> Int -foreign import int_isPositive :: Int -> Boolean -foreign import int_asPositive :: Int -> Nullable BigNum -foreign import int_asNegative :: Int -> Nullable BigNum -foreign import int_asI32 :: Int -> Nullable Number -foreign import int_asI32OrNothing :: Int -> Nullable Number -foreign import int_asI32OrFail :: Int -> Number -foreign import int_toStr :: Int -> String -foreign import int_fromStr :: String -> ForeignErrorable Int - --- | Int class -type IntClass = - { free :: Int -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: Int -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe Int - -- ^ From bytes - -- > fromBytes bytes - , toHex :: Int -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe Int - -- ^ From hex - -- > fromHex hexStr - , toJson :: Int -> String - -- ^ To json - -- > toJson self - , toJsValue :: Int -> IntJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe Int - -- ^ From json - -- > fromJson json - , new :: BigNum -> Int - -- ^ New - -- > new x - , newNegative :: BigNum -> Int - -- ^ New negative - -- > newNegative x - , newI32 :: Number -> Int - -- ^ New i32 - -- > newI32 x - , isPositive :: Int -> Boolean - -- ^ Is positive - -- > isPositive self - , asPositive :: Int -> Maybe BigNum - -- ^ As positive - -- > asPositive self - , asNegative :: Int -> Maybe BigNum - -- ^ As negative - -- > asNegative self - , asI32 :: Int -> Maybe Number - -- ^ As i32 - -- > asI32 self - , asI32OrNothing :: Int -> Maybe Number - -- ^ As i32 or nothing - -- > asI32OrNothing self - , asI32OrFail :: Int -> Number - -- ^ As i32 or fail - -- > asI32OrFail self - , toStr :: Int -> String - -- ^ To str - -- > toStr self - , fromStr :: String -> Maybe Int - -- ^ From str - -- > fromStr string - } - --- | Int class API -int :: IntClass -int = - { free: int_free - , toBytes: int_toBytes - , fromBytes: \a1 -> runForeignMaybe $ int_fromBytes a1 - , toHex: int_toHex - , fromHex: \a1 -> runForeignMaybe $ int_fromHex a1 - , toJson: int_toJson - , toJsValue: int_toJsValue - , fromJson: \a1 -> runForeignMaybe $ int_fromJson a1 - , new: int_new - , newNegative: int_newNegative - , newI32: int_newI32 - , isPositive: int_isPositive - , asPositive: \a1 -> Nullable.toMaybe $ int_asPositive a1 - , asNegative: \a1 -> Nullable.toMaybe $ int_asNegative a1 - , asI32: \a1 -> Nullable.toMaybe $ int_asI32 a1 - , asI32OrNothing: \a1 -> Nullable.toMaybe $ int_asI32OrNothing a1 - , asI32OrFail: int_asI32OrFail - , toStr: int_toStr - , fromStr: \a1 -> runForeignMaybe $ int_fromStr a1 - } - - - -------------------------------------------------------------------------------------- --- Ipv4 - -foreign import ipv4_free :: Ipv4 -> Effect Unit -foreign import ipv4_toBytes :: Ipv4 -> Bytes -foreign import ipv4_fromBytes :: Bytes -> ForeignErrorable Ipv4 -foreign import ipv4_toHex :: Ipv4 -> String -foreign import ipv4_fromHex :: String -> ForeignErrorable Ipv4 -foreign import ipv4_toJson :: Ipv4 -> String -foreign import ipv4_toJsValue :: Ipv4 -> Ipv4Json -foreign import ipv4_fromJson :: String -> ForeignErrorable Ipv4 -foreign import ipv4_new :: Bytes -> Ipv4 -foreign import ipv4_ip :: Ipv4 -> Bytes - --- | Ipv4 class -type Ipv4Class = - { free :: Ipv4 -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: Ipv4 -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe Ipv4 - -- ^ From bytes - -- > fromBytes bytes - , toHex :: Ipv4 -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe Ipv4 - -- ^ From hex - -- > fromHex hexStr - , toJson :: Ipv4 -> String - -- ^ To json - -- > toJson self - , toJsValue :: Ipv4 -> Ipv4Json - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe Ipv4 - -- ^ From json - -- > fromJson json - , new :: Bytes -> Ipv4 - -- ^ New - -- > new data - , ip :: Ipv4 -> Bytes - -- ^ Ip - -- > ip self - } - --- | Ipv4 class API -ipv4 :: Ipv4Class -ipv4 = - { free: ipv4_free - , toBytes: ipv4_toBytes - , fromBytes: \a1 -> runForeignMaybe $ ipv4_fromBytes a1 - , toHex: ipv4_toHex - , fromHex: \a1 -> runForeignMaybe $ ipv4_fromHex a1 - , toJson: ipv4_toJson - , toJsValue: ipv4_toJsValue - , fromJson: \a1 -> runForeignMaybe $ ipv4_fromJson a1 - , new: ipv4_new - , ip: ipv4_ip - } - -instance HasFree Ipv4 where - free = ipv4.free - -instance Show Ipv4 where - show = ipv4.toHex - -instance ToJsValue Ipv4 where - toJsValue = ipv4.toJsValue - -instance IsHex Ipv4 where - toHex = ipv4.toHex - fromHex = ipv4.fromHex - -instance IsBytes Ipv4 where - toBytes = ipv4.toBytes - fromBytes = ipv4.fromBytes - -instance IsJson Ipv4 where - toJson = ipv4.toJson - fromJson = ipv4.fromJson - -------------------------------------------------------------------------------------- --- Ipv6 - -foreign import ipv6_free :: Ipv6 -> Effect Unit -foreign import ipv6_toBytes :: Ipv6 -> Bytes -foreign import ipv6_fromBytes :: Bytes -> ForeignErrorable Ipv6 -foreign import ipv6_toHex :: Ipv6 -> String -foreign import ipv6_fromHex :: String -> ForeignErrorable Ipv6 -foreign import ipv6_toJson :: Ipv6 -> String -foreign import ipv6_toJsValue :: Ipv6 -> Ipv6Json -foreign import ipv6_fromJson :: String -> ForeignErrorable Ipv6 -foreign import ipv6_new :: Bytes -> Ipv6 -foreign import ipv6_ip :: Ipv6 -> Bytes - --- | Ipv6 class -type Ipv6Class = - { free :: Ipv6 -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: Ipv6 -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe Ipv6 - -- ^ From bytes - -- > fromBytes bytes - , toHex :: Ipv6 -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe Ipv6 - -- ^ From hex - -- > fromHex hexStr - , toJson :: Ipv6 -> String - -- ^ To json - -- > toJson self - , toJsValue :: Ipv6 -> Ipv6Json - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe Ipv6 - -- ^ From json - -- > fromJson json - , new :: Bytes -> Ipv6 - -- ^ New - -- > new data - , ip :: Ipv6 -> Bytes - -- ^ Ip - -- > ip self - } - --- | Ipv6 class API -ipv6 :: Ipv6Class -ipv6 = - { free: ipv6_free - , toBytes: ipv6_toBytes - , fromBytes: \a1 -> runForeignMaybe $ ipv6_fromBytes a1 - , toHex: ipv6_toHex - , fromHex: \a1 -> runForeignMaybe $ ipv6_fromHex a1 - , toJson: ipv6_toJson - , toJsValue: ipv6_toJsValue - , fromJson: \a1 -> runForeignMaybe $ ipv6_fromJson a1 - , new: ipv6_new - , ip: ipv6_ip - } - -instance HasFree Ipv6 where - free = ipv6.free - -instance Show Ipv6 where - show = ipv6.toHex - -instance ToJsValue Ipv6 where - toJsValue = ipv6.toJsValue - -instance IsHex Ipv6 where - toHex = ipv6.toHex - fromHex = ipv6.fromHex - -instance IsBytes Ipv6 where - toBytes = ipv6.toBytes - fromBytes = ipv6.fromBytes - -instance IsJson Ipv6 where - toJson = ipv6.toJson - fromJson = ipv6.fromJson - -------------------------------------------------------------------------------------- --- KESSignature - -foreign import kesSignature_free :: KESSignature -> Effect Unit -foreign import kesSignature_toBytes :: KESSignature -> Bytes -foreign import kesSignature_fromBytes :: Bytes -> ForeignErrorable KESSignature - --- | KESSignature class -type KESSignatureClass = - { free :: KESSignature -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: KESSignature -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe KESSignature - -- ^ From bytes - -- > fromBytes bytes - } - --- | KESSignature class API -kesSignature :: KESSignatureClass -kesSignature = - { free: kesSignature_free - , toBytes: kesSignature_toBytes - , fromBytes: \a1 -> runForeignMaybe $ kesSignature_fromBytes a1 - } - -instance HasFree KESSignature where - free = kesSignature.free - -instance IsBytes KESSignature where - toBytes = kesSignature.toBytes - fromBytes = kesSignature.fromBytes - -------------------------------------------------------------------------------------- --- KESVKey - -foreign import kesvKey_free :: KESVKey -> Effect Unit -foreign import kesvKey_fromBytes :: Bytes -> ForeignErrorable KESVKey -foreign import kesvKey_toBytes :: KESVKey -> Bytes -foreign import kesvKey_toBech32 :: KESVKey -> String -> String -foreign import kesvKey_fromBech32 :: String -> ForeignErrorable KESVKey -foreign import kesvKey_toHex :: KESVKey -> String -foreign import kesvKey_fromHex :: String -> ForeignErrorable KESVKey - --- | KESVKey class -type KESVKeyClass = - { free :: KESVKey -> Effect Unit - -- ^ Free - -- > free self - , fromBytes :: Bytes -> Maybe KESVKey - -- ^ From bytes - -- > fromBytes bytes - , toBytes :: KESVKey -> Bytes - -- ^ To bytes - -- > toBytes self - , toBech32 :: KESVKey -> String -> String - -- ^ To bech32 - -- > toBech32 self prefix - , fromBech32 :: String -> Maybe KESVKey - -- ^ From bech32 - -- > fromBech32 bechStr - , toHex :: KESVKey -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe KESVKey - -- ^ From hex - -- > fromHex hex - } - --- | KESVKey class API -kesvKey :: KESVKeyClass -kesvKey = - { free: kesvKey_free - , fromBytes: \a1 -> runForeignMaybe $ kesvKey_fromBytes a1 - , toBytes: kesvKey_toBytes - , toBech32: kesvKey_toBech32 - , fromBech32: \a1 -> runForeignMaybe $ kesvKey_fromBech32 a1 - , toHex: kesvKey_toHex - , fromHex: \a1 -> runForeignMaybe $ kesvKey_fromHex a1 - } - -instance HasFree KESVKey where - free = kesvKey.free - -instance Show KESVKey where - show = kesvKey.toHex - -instance IsHex KESVKey where - toHex = kesvKey.toHex - fromHex = kesvKey.fromHex - -instance IsBytes KESVKey where - toBytes = kesvKey.toBytes - fromBytes = kesvKey.fromBytes - -------------------------------------------------------------------------------------- --- Language - -foreign import language_free :: Language -> Effect Unit -foreign import language_toBytes :: Language -> Bytes -foreign import language_fromBytes :: Bytes -> ForeignErrorable Language -foreign import language_toHex :: Language -> String -foreign import language_fromHex :: String -> ForeignErrorable Language -foreign import language_toJson :: Language -> String -foreign import language_toJsValue :: Language -> LanguageJson -foreign import language_fromJson :: String -> ForeignErrorable Language -foreign import language_newPlutusV1 :: Language -foreign import language_newPlutusV2 :: Language -foreign import language_kind :: Language -> Number - --- | Language class -type LanguageClass = - { free :: Language -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: Language -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe Language - -- ^ From bytes - -- > fromBytes bytes - , toHex :: Language -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe Language - -- ^ From hex - -- > fromHex hexStr - , toJson :: Language -> String - -- ^ To json - -- > toJson self - , toJsValue :: Language -> LanguageJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe Language - -- ^ From json - -- > fromJson json - , newPlutusV1 :: Language - -- ^ New plutus v1 - -- > newPlutusV1 - , newPlutusV2 :: Language - -- ^ New plutus v2 - -- > newPlutusV2 - , kind :: Language -> Number - -- ^ Kind - -- > kind self - } - --- | Language class API -language :: LanguageClass -language = - { free: language_free - , toBytes: language_toBytes - , fromBytes: \a1 -> runForeignMaybe $ language_fromBytes a1 - , toHex: language_toHex - , fromHex: \a1 -> runForeignMaybe $ language_fromHex a1 - , toJson: language_toJson - , toJsValue: language_toJsValue - , fromJson: \a1 -> runForeignMaybe $ language_fromJson a1 - , newPlutusV1: language_newPlutusV1 - , newPlutusV2: language_newPlutusV2 - , kind: language_kind - } - -instance HasFree Language where - free = language.free - -instance Show Language where - show = language.toHex - -instance ToJsValue Language where - toJsValue = language.toJsValue - -instance IsHex Language where - toHex = language.toHex - fromHex = language.fromHex - -instance IsBytes Language where - toBytes = language.toBytes - fromBytes = language.fromBytes - -instance IsJson Language where - toJson = language.toJson - fromJson = language.fromJson - -------------------------------------------------------------------------------------- --- Languages - -foreign import languages_free :: Languages -> Effect Unit -foreign import languages_new :: Effect Languages -foreign import languages_len :: Languages -> Effect Int -foreign import languages_get :: Languages -> Int -> Effect Language -foreign import languages_add :: Languages -> Language -> Effect Unit - --- | Languages class -type LanguagesClass = - { free :: Languages -> Effect Unit - -- ^ Free - -- > free self - , new :: Effect Languages - -- ^ New - -- > new - , len :: Languages -> Effect Int - -- ^ Len - -- > len self - , get :: Languages -> Int -> Effect Language - -- ^ Get - -- > get self index - , add :: Languages -> Language -> Effect Unit - -- ^ Add - -- > add self elem - } - --- | Languages class API -languages :: LanguagesClass -languages = - { free: languages_free - , new: languages_new - , len: languages_len - , get: languages_get - , add: languages_add - } - -instance HasFree Languages where - free = languages.free - -instance MutableList Languages Language where - addItem = languages.add - getItem = languages.get - emptyList = languages.new - -instance MutableLen Languages where - getLen = languages.len - -------------------------------------------------------------------------------------- --- Legacy daedalus private key - -foreign import legacyDaedalusPrivateKey_free :: LegacyDaedalusPrivateKey -> Effect Unit -foreign import legacyDaedalusPrivateKey_fromBytes :: Bytes -> ForeignErrorable LegacyDaedalusPrivateKey -foreign import legacyDaedalusPrivateKey_asBytes :: LegacyDaedalusPrivateKey -> Bytes -foreign import legacyDaedalusPrivateKey_chaincode :: LegacyDaedalusPrivateKey -> Bytes - --- | Legacy daedalus private key class -type LegacyDaedalusPrivateKeyClass = - { free :: LegacyDaedalusPrivateKey -> Effect Unit - -- ^ Free - -- > free self - , fromBytes :: Bytes -> Maybe LegacyDaedalusPrivateKey - -- ^ From bytes - -- > fromBytes bytes - , asBytes :: LegacyDaedalusPrivateKey -> Bytes - -- ^ As bytes - -- > asBytes self - , chaincode :: LegacyDaedalusPrivateKey -> Bytes - -- ^ Chaincode - -- > chaincode self - } - --- | Legacy daedalus private key class API -legacyDaedalusPrivateKey :: LegacyDaedalusPrivateKeyClass -legacyDaedalusPrivateKey = - { free: legacyDaedalusPrivateKey_free - , fromBytes: \a1 -> runForeignMaybe $ legacyDaedalusPrivateKey_fromBytes a1 - , asBytes: legacyDaedalusPrivateKey_asBytes - , chaincode: legacyDaedalusPrivateKey_chaincode - } - -instance HasFree LegacyDaedalusPrivateKey where - free = legacyDaedalusPrivateKey.free - -------------------------------------------------------------------------------------- --- Linear fee - -foreign import linearFee_free :: LinearFee -> Effect Unit -foreign import linearFee_constant :: LinearFee -> BigNum -foreign import linearFee_coefficient :: LinearFee -> BigNum -foreign import linearFee_new :: BigNum -> BigNum -> LinearFee - --- | Linear fee class -type LinearFeeClass = - { free :: LinearFee -> Effect Unit - -- ^ Free - -- > free self - , constant :: LinearFee -> BigNum - -- ^ Constant - -- > constant self - , coefficient :: LinearFee -> BigNum - -- ^ Coefficient - -- > coefficient self - , new :: BigNum -> BigNum -> LinearFee - -- ^ New - -- > new coefficient constant - } - --- | Linear fee class API -linearFee :: LinearFeeClass -linearFee = - { free: linearFee_free - , constant: linearFee_constant - , coefficient: linearFee_coefficient - , new: linearFee_new - } - -instance HasFree LinearFee where - free = linearFee.free - -------------------------------------------------------------------------------------- --- MIRTo stake credentials - -foreign import mirToStakeCredentials_free :: MIRToStakeCredentials -> Effect Unit -foreign import mirToStakeCredentials_toBytes :: MIRToStakeCredentials -> Bytes -foreign import mirToStakeCredentials_fromBytes :: Bytes -> ForeignErrorable MIRToStakeCredentials -foreign import mirToStakeCredentials_toHex :: MIRToStakeCredentials -> String -foreign import mirToStakeCredentials_fromHex :: String -> ForeignErrorable MIRToStakeCredentials -foreign import mirToStakeCredentials_toJson :: MIRToStakeCredentials -> String -foreign import mirToStakeCredentials_toJsValue :: MIRToStakeCredentials -> MIRToStakeCredentialsJson -foreign import mirToStakeCredentials_fromJson :: String -> ForeignErrorable MIRToStakeCredentials -foreign import mirToStakeCredentials_new :: Effect MIRToStakeCredentials -foreign import mirToStakeCredentials_len :: MIRToStakeCredentials -> Effect Number -foreign import mirToStakeCredentials_insert :: MIRToStakeCredentials -> StakeCredential -> Int -> Effect ((Nullable Int)) -foreign import mirToStakeCredentials_get :: MIRToStakeCredentials -> StakeCredential -> Effect ((Nullable Int)) -foreign import mirToStakeCredentials_keys :: MIRToStakeCredentials -> Effect StakeCredentials - --- | MIRTo stake credentials class -type MIRToStakeCredentialsClass = - { free :: MIRToStakeCredentials -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: MIRToStakeCredentials -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe MIRToStakeCredentials - -- ^ From bytes - -- > fromBytes bytes - , toHex :: MIRToStakeCredentials -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe MIRToStakeCredentials - -- ^ From hex - -- > fromHex hexStr - , toJson :: MIRToStakeCredentials -> String - -- ^ To json - -- > toJson self - , toJsValue :: MIRToStakeCredentials -> MIRToStakeCredentialsJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe MIRToStakeCredentials - -- ^ From json - -- > fromJson json - , new :: Effect MIRToStakeCredentials - -- ^ New - -- > new - , len :: MIRToStakeCredentials -> Effect Number - -- ^ Len - -- > len self - , insert :: MIRToStakeCredentials -> StakeCredential -> Int -> Effect ((Maybe Int)) - -- ^ Insert - -- > insert self cred delta - , get :: MIRToStakeCredentials -> StakeCredential -> Effect ((Maybe Int)) - -- ^ Get - -- > get self cred - , keys :: MIRToStakeCredentials -> Effect StakeCredentials - -- ^ Keys - -- > keys self - } - --- | MIRTo stake credentials class API -mirToStakeCredentials :: MIRToStakeCredentialsClass -mirToStakeCredentials = - { free: mirToStakeCredentials_free - , toBytes: mirToStakeCredentials_toBytes - , fromBytes: \a1 -> runForeignMaybe $ mirToStakeCredentials_fromBytes a1 - , toHex: mirToStakeCredentials_toHex - , fromHex: \a1 -> runForeignMaybe $ mirToStakeCredentials_fromHex a1 - , toJson: mirToStakeCredentials_toJson - , toJsValue: mirToStakeCredentials_toJsValue - , fromJson: \a1 -> runForeignMaybe $ mirToStakeCredentials_fromJson a1 - , new: mirToStakeCredentials_new - , len: mirToStakeCredentials_len - , insert: \a1 a2 a3 -> Nullable.toMaybe <$> mirToStakeCredentials_insert a1 a2 a3 - , get: \a1 a2 -> Nullable.toMaybe <$> mirToStakeCredentials_get a1 a2 - , keys: mirToStakeCredentials_keys - } - -instance HasFree MIRToStakeCredentials where - free = mirToStakeCredentials.free - -instance Show MIRToStakeCredentials where - show = mirToStakeCredentials.toHex - -instance ToJsValue MIRToStakeCredentials where - toJsValue = mirToStakeCredentials.toJsValue - -instance IsHex MIRToStakeCredentials where - toHex = mirToStakeCredentials.toHex - fromHex = mirToStakeCredentials.fromHex - -instance IsBytes MIRToStakeCredentials where - toBytes = mirToStakeCredentials.toBytes - fromBytes = mirToStakeCredentials.fromBytes - -instance IsJson MIRToStakeCredentials where - toJson = mirToStakeCredentials.toJson - fromJson = mirToStakeCredentials.fromJson - -------------------------------------------------------------------------------------- --- Metadata list - -foreign import metadataList_free :: MetadataList -> Effect Unit -foreign import metadataList_toBytes :: MetadataList -> Bytes -foreign import metadataList_fromBytes :: Bytes -> ForeignErrorable MetadataList -foreign import metadataList_toHex :: MetadataList -> String -foreign import metadataList_fromHex :: String -> ForeignErrorable MetadataList -foreign import metadataList_new :: Effect MetadataList -foreign import metadataList_len :: MetadataList -> Effect Int -foreign import metadataList_get :: MetadataList -> Int -> Effect TxMetadatum -foreign import metadataList_add :: MetadataList -> TxMetadatum -> Effect Unit - --- | Metadata list class -type MetadataListClass = - { free :: MetadataList -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: MetadataList -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe MetadataList - -- ^ From bytes - -- > fromBytes bytes - , toHex :: MetadataList -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe MetadataList - -- ^ From hex - -- > fromHex hexStr - , new :: Effect MetadataList - -- ^ New - -- > new - , len :: MetadataList -> Effect Int - -- ^ Len - -- > len self - , get :: MetadataList -> Int -> Effect TxMetadatum - -- ^ Get - -- > get self index - , add :: MetadataList -> TxMetadatum -> Effect Unit - -- ^ Add - -- > add self elem - } - --- | Metadata list class API -metadataList :: MetadataListClass -metadataList = - { free: metadataList_free - , toBytes: metadataList_toBytes - , fromBytes: \a1 -> runForeignMaybe $ metadataList_fromBytes a1 - , toHex: metadataList_toHex - , fromHex: \a1 -> runForeignMaybe $ metadataList_fromHex a1 - , new: metadataList_new - , len: metadataList_len - , get: metadataList_get - , add: metadataList_add - } - -instance HasFree MetadataList where - free = metadataList.free - -instance Show MetadataList where - show = metadataList.toHex - -instance MutableList MetadataList TxMetadatum where - addItem = metadataList.add - getItem = metadataList.get - emptyList = metadataList.new - -instance MutableLen MetadataList where - getLen = metadataList.len - - -instance IsHex MetadataList where - toHex = metadataList.toHex - fromHex = metadataList.fromHex - -instance IsBytes MetadataList where - toBytes = metadataList.toBytes - fromBytes = metadataList.fromBytes - -------------------------------------------------------------------------------------- --- Metadata map - -foreign import metadataMap_free :: MetadataMap -> Effect Unit -foreign import metadataMap_toBytes :: MetadataMap -> Bytes -foreign import metadataMap_fromBytes :: Bytes -> ForeignErrorable MetadataMap -foreign import metadataMap_toHex :: MetadataMap -> String -foreign import metadataMap_fromHex :: String -> ForeignErrorable MetadataMap -foreign import metadataMap_new :: Effect MetadataMap -foreign import metadataMap_len :: MetadataMap -> Int -foreign import metadataMap_insert :: MetadataMap -> TxMetadatum -> TxMetadatum -> Effect ((Nullable TxMetadatum)) -foreign import metadataMap_insertStr :: MetadataMap -> String -> TxMetadatum -> Effect ((Nullable TxMetadatum)) -foreign import metadataMap_insertI32 :: MetadataMap -> Number -> TxMetadatum -> Effect ((Nullable TxMetadatum)) -foreign import metadataMap_get :: MetadataMap -> TxMetadatum -> Effect TxMetadatum -foreign import metadataMap_getStr :: MetadataMap -> String -> Effect TxMetadatum -foreign import metadataMap_getI32 :: MetadataMap -> Number -> Effect TxMetadatum -foreign import metadataMap_has :: MetadataMap -> TxMetadatum -> Effect Boolean -foreign import metadataMap_keys :: MetadataMap -> Effect MetadataList - --- | Metadata map class -type MetadataMapClass = - { free :: MetadataMap -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: MetadataMap -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe MetadataMap - -- ^ From bytes - -- > fromBytes bytes - , toHex :: MetadataMap -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe MetadataMap - -- ^ From hex - -- > fromHex hexStr - , new :: Effect MetadataMap - -- ^ New - -- > new - , len :: MetadataMap -> Int - -- ^ Len - -- > len self - , insert :: MetadataMap -> TxMetadatum -> TxMetadatum -> Effect ((Maybe TxMetadatum)) - -- ^ Insert - -- > insert self key value - , insertStr :: MetadataMap -> String -> TxMetadatum -> Effect ((Maybe TxMetadatum)) - -- ^ Insert str - -- > insertStr self key value - , insertI32 :: MetadataMap -> Number -> TxMetadatum -> Effect ((Maybe TxMetadatum)) - -- ^ Insert i32 - -- > insertI32 self key value - , get :: MetadataMap -> TxMetadatum -> Effect TxMetadatum - -- ^ Get - -- > get self key - , getStr :: MetadataMap -> String -> Effect TxMetadatum - -- ^ Get str - -- > getStr self key - , getI32 :: MetadataMap -> Number -> Effect TxMetadatum - -- ^ Get i32 - -- > getI32 self key - , has :: MetadataMap -> TxMetadatum -> Effect Boolean - -- ^ Has - -- > has self key - , keys :: MetadataMap -> Effect MetadataList - -- ^ Keys - -- > keys self - } - --- | Metadata map class API -metadataMap :: MetadataMapClass -metadataMap = - { free: metadataMap_free - , toBytes: metadataMap_toBytes - , fromBytes: \a1 -> runForeignMaybe $ metadataMap_fromBytes a1 - , toHex: metadataMap_toHex - , fromHex: \a1 -> runForeignMaybe $ metadataMap_fromHex a1 - , new: metadataMap_new - , len: metadataMap_len - , insert: \a1 a2 a3 -> Nullable.toMaybe <$> metadataMap_insert a1 a2 a3 - , insertStr: \a1 a2 a3 -> Nullable.toMaybe <$> metadataMap_insertStr a1 a2 a3 - , insertI32: \a1 a2 a3 -> Nullable.toMaybe <$> metadataMap_insertI32 a1 a2 a3 - , get: metadataMap_get - , getStr: metadataMap_getStr - , getI32: metadataMap_getI32 - , has: metadataMap_has - , keys: metadataMap_keys - } - -instance HasFree MetadataMap where - free = metadataMap.free - -instance Show MetadataMap where - show = metadataMap.toHex - -instance IsHex MetadataMap where - toHex = metadataMap.toHex - fromHex = metadataMap.fromHex - -instance IsBytes MetadataMap where - toBytes = metadataMap.toBytes - fromBytes = metadataMap.fromBytes - -------------------------------------------------------------------------------------- --- Mint - -foreign import mint_free :: Mint -> Effect Unit -foreign import mint_toBytes :: Mint -> Bytes -foreign import mint_fromBytes :: Bytes -> ForeignErrorable Mint -foreign import mint_toHex :: Mint -> String -foreign import mint_fromHex :: String -> ForeignErrorable Mint -foreign import mint_toJson :: Mint -> String -foreign import mint_toJsValue :: Mint -> MintJson -foreign import mint_fromJson :: String -> ForeignErrorable Mint -foreign import mint_new :: Effect Mint -foreign import mint_newFromEntry :: ScriptHash -> MintAssets -> Effect Mint -foreign import mint_len :: Mint -> Effect Int -foreign import mint_insert :: Mint -> ScriptHash -> MintAssets -> Effect ((Nullable MintAssets)) -foreign import mint_get :: Mint -> ScriptHash -> Effect ((Nullable MintAssets)) -foreign import mint_keys :: Mint -> Effect ScriptHashes -foreign import mint_asPositiveMultiasset :: Mint -> Effect MultiAsset -foreign import mint_asNegativeMultiasset :: Mint -> Effect MultiAsset - --- | Mint class -type MintClass = - { free :: Mint -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: Mint -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe Mint - -- ^ From bytes - -- > fromBytes bytes - , toHex :: Mint -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe Mint - -- ^ From hex - -- > fromHex hexStr - , toJson :: Mint -> String - -- ^ To json - -- > toJson self - , toJsValue :: Mint -> MintJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe Mint - -- ^ From json - -- > fromJson json - , new :: Effect Mint - -- ^ New - -- > new - , newFromEntry :: ScriptHash -> MintAssets -> Effect Mint - -- ^ New from entry - -- > newFromEntry key value - , len :: Mint -> Effect Int - -- ^ Len - -- > len self - , insert :: Mint -> ScriptHash -> MintAssets -> Effect ((Maybe MintAssets)) - -- ^ Insert - -- > insert self key value - , get :: Mint -> ScriptHash -> Effect ((Maybe MintAssets)) - -- ^ Get - -- > get self key - , keys :: Mint -> Effect ScriptHashes - -- ^ Keys - -- > keys self - , asPositiveMultiasset :: Mint -> Effect MultiAsset - -- ^ As positive multiasset - -- > asPositiveMultiasset self - , asNegativeMultiasset :: Mint -> Effect MultiAsset - -- ^ As negative multiasset - -- > asNegativeMultiasset self - } - --- | Mint class API -mint :: MintClass -mint = - { free: mint_free - , toBytes: mint_toBytes - , fromBytes: \a1 -> runForeignMaybe $ mint_fromBytes a1 - , toHex: mint_toHex - , fromHex: \a1 -> runForeignMaybe $ mint_fromHex a1 - , toJson: mint_toJson - , toJsValue: mint_toJsValue - , fromJson: \a1 -> runForeignMaybe $ mint_fromJson a1 - , new: mint_new - , newFromEntry: mint_newFromEntry - , len: mint_len - , insert: \a1 a2 a3 -> Nullable.toMaybe <$> mint_insert a1 a2 a3 - , get: \a1 a2 -> Nullable.toMaybe <$> mint_get a1 a2 - , keys: mint_keys - , asPositiveMultiasset: mint_asPositiveMultiasset - , asNegativeMultiasset: mint_asNegativeMultiasset - } - -instance HasFree Mint where - free = mint.free - -instance Show Mint where - show = mint.toHex - -instance ToJsValue Mint where - toJsValue = mint.toJsValue - -instance IsHex Mint where - toHex = mint.toHex - fromHex = mint.fromHex - -instance IsBytes Mint where - toBytes = mint.toBytes - fromBytes = mint.fromBytes - -instance IsJson Mint where - toJson = mint.toJson - fromJson = mint.fromJson - -------------------------------------------------------------------------------------- --- Mint assets - -foreign import mintAssets_free :: MintAssets -> Effect Unit -foreign import mintAssets_new :: Effect MintAssets -foreign import mintAssets_newFromEntry :: AssetName -> Int -> MintAssets -foreign import mintAssets_len :: MintAssets -> Effect Int -foreign import mintAssets_insert :: MintAssets -> AssetName -> Int -> Effect ((Nullable Int)) -foreign import mintAssets_get :: MintAssets -> AssetName -> Effect ((Nullable Int)) -foreign import mintAssets_keys :: MintAssets -> Effect AssetNames - --- | Mint assets class -type MintAssetsClass = - { free :: MintAssets -> Effect Unit - -- ^ Free - -- > free self - , new :: Effect MintAssets - -- ^ New - -- > new - , newFromEntry :: AssetName -> Int -> MintAssets - -- ^ New from entry - -- > newFromEntry key value - , len :: MintAssets -> Effect Int - -- ^ Len - -- > len self - , insert :: MintAssets -> AssetName -> Int -> Effect ((Maybe Int)) - -- ^ Insert - -- > insert self key value - , get :: MintAssets -> AssetName -> Effect ((Maybe Int)) - -- ^ Get - -- > get self key - , keys :: MintAssets -> Effect AssetNames - -- ^ Keys - -- > keys self - } - --- | Mint assets class API -mintAssets :: MintAssetsClass -mintAssets = - { free: mintAssets_free - , new: mintAssets_new - , newFromEntry: mintAssets_newFromEntry - , len: mintAssets_len - , insert: \a1 a2 a3 -> Nullable.toMaybe <$> mintAssets_insert a1 a2 a3 - , get: \a1 a2 -> Nullable.toMaybe <$> mintAssets_get a1 a2 - , keys: mintAssets_keys - } - -instance HasFree MintAssets where - free = mintAssets.free - -------------------------------------------------------------------------------------- --- Move instantaneous reward - -foreign import moveInstantaneousReward_free :: MoveInstantaneousReward -> Effect Unit -foreign import moveInstantaneousReward_toBytes :: MoveInstantaneousReward -> Bytes -foreign import moveInstantaneousReward_fromBytes :: Bytes -> ForeignErrorable MoveInstantaneousReward -foreign import moveInstantaneousReward_toHex :: MoveInstantaneousReward -> String -foreign import moveInstantaneousReward_fromHex :: String -> ForeignErrorable MoveInstantaneousReward -foreign import moveInstantaneousReward_toJson :: MoveInstantaneousReward -> String -foreign import moveInstantaneousReward_toJsValue :: MoveInstantaneousReward -> MoveInstantaneousRewardJson -foreign import moveInstantaneousReward_fromJson :: String -> ForeignErrorable MoveInstantaneousReward -foreign import moveInstantaneousReward_newToOtherPot :: Number -> BigNum -> MoveInstantaneousReward -foreign import moveInstantaneousReward_newToStakeCreds :: Number -> MIRToStakeCredentials -> MoveInstantaneousReward -foreign import moveInstantaneousReward_pot :: MoveInstantaneousReward -> Number -foreign import moveInstantaneousReward_kind :: MoveInstantaneousReward -> Number -foreign import moveInstantaneousReward_asToOtherPot :: MoveInstantaneousReward -> Nullable BigNum -foreign import moveInstantaneousReward_asToStakeCreds :: MoveInstantaneousReward -> Nullable MIRToStakeCredentials - --- | Move instantaneous reward class -type MoveInstantaneousRewardClass = - { free :: MoveInstantaneousReward -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: MoveInstantaneousReward -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe MoveInstantaneousReward - -- ^ From bytes - -- > fromBytes bytes - , toHex :: MoveInstantaneousReward -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe MoveInstantaneousReward - -- ^ From hex - -- > fromHex hexStr - , toJson :: MoveInstantaneousReward -> String - -- ^ To json - -- > toJson self - , toJsValue :: MoveInstantaneousReward -> MoveInstantaneousRewardJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe MoveInstantaneousReward - -- ^ From json - -- > fromJson json - , newToOtherPot :: Number -> BigNum -> MoveInstantaneousReward - -- ^ New to other pot - -- > newToOtherPot pot amount - , newToStakeCreds :: Number -> MIRToStakeCredentials -> MoveInstantaneousReward - -- ^ New to stake creds - -- > newToStakeCreds pot amounts - , pot :: MoveInstantaneousReward -> Number - -- ^ Pot - -- > pot self - , kind :: MoveInstantaneousReward -> Number - -- ^ Kind - -- > kind self - , asToOtherPot :: MoveInstantaneousReward -> Maybe BigNum - -- ^ As to other pot - -- > asToOtherPot self - , asToStakeCreds :: MoveInstantaneousReward -> Maybe MIRToStakeCredentials - -- ^ As to stake creds - -- > asToStakeCreds self - } - --- | Move instantaneous reward class API -moveInstantaneousReward :: MoveInstantaneousRewardClass -moveInstantaneousReward = - { free: moveInstantaneousReward_free - , toBytes: moveInstantaneousReward_toBytes - , fromBytes: \a1 -> runForeignMaybe $ moveInstantaneousReward_fromBytes a1 - , toHex: moveInstantaneousReward_toHex - , fromHex: \a1 -> runForeignMaybe $ moveInstantaneousReward_fromHex a1 - , toJson: moveInstantaneousReward_toJson - , toJsValue: moveInstantaneousReward_toJsValue - , fromJson: \a1 -> runForeignMaybe $ moveInstantaneousReward_fromJson a1 - , newToOtherPot: moveInstantaneousReward_newToOtherPot - , newToStakeCreds: moveInstantaneousReward_newToStakeCreds - , pot: moveInstantaneousReward_pot - , kind: moveInstantaneousReward_kind - , asToOtherPot: \a1 -> Nullable.toMaybe $ moveInstantaneousReward_asToOtherPot a1 - , asToStakeCreds: \a1 -> Nullable.toMaybe $ moveInstantaneousReward_asToStakeCreds a1 - } - -instance HasFree MoveInstantaneousReward where - free = moveInstantaneousReward.free - -instance Show MoveInstantaneousReward where - show = moveInstantaneousReward.toHex - -instance ToJsValue MoveInstantaneousReward where - toJsValue = moveInstantaneousReward.toJsValue - -instance IsHex MoveInstantaneousReward where - toHex = moveInstantaneousReward.toHex - fromHex = moveInstantaneousReward.fromHex - -instance IsBytes MoveInstantaneousReward where - toBytes = moveInstantaneousReward.toBytes - fromBytes = moveInstantaneousReward.fromBytes - -instance IsJson MoveInstantaneousReward where - toJson = moveInstantaneousReward.toJson - fromJson = moveInstantaneousReward.fromJson - -------------------------------------------------------------------------------------- --- Move instantaneous rewards cert - -foreign import moveInstantaneousRewardsCert_free :: MoveInstantaneousRewardsCert -> Effect Unit -foreign import moveInstantaneousRewardsCert_toBytes :: MoveInstantaneousRewardsCert -> Bytes -foreign import moveInstantaneousRewardsCert_fromBytes :: Bytes -> ForeignErrorable MoveInstantaneousRewardsCert -foreign import moveInstantaneousRewardsCert_toHex :: MoveInstantaneousRewardsCert -> String -foreign import moveInstantaneousRewardsCert_fromHex :: String -> ForeignErrorable MoveInstantaneousRewardsCert -foreign import moveInstantaneousRewardsCert_toJson :: MoveInstantaneousRewardsCert -> String -foreign import moveInstantaneousRewardsCert_toJsValue :: MoveInstantaneousRewardsCert -> MoveInstantaneousRewardsCertJson -foreign import moveInstantaneousRewardsCert_fromJson :: String -> ForeignErrorable MoveInstantaneousRewardsCert -foreign import moveInstantaneousRewardsCert_moveInstantaneousReward :: MoveInstantaneousRewardsCert -> MoveInstantaneousReward -foreign import moveInstantaneousRewardsCert_new :: MoveInstantaneousReward -> MoveInstantaneousRewardsCert - --- | Move instantaneous rewards cert class -type MoveInstantaneousRewardsCertClass = - { free :: MoveInstantaneousRewardsCert -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: MoveInstantaneousRewardsCert -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe MoveInstantaneousRewardsCert - -- ^ From bytes - -- > fromBytes bytes - , toHex :: MoveInstantaneousRewardsCert -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe MoveInstantaneousRewardsCert - -- ^ From hex - -- > fromHex hexStr - , toJson :: MoveInstantaneousRewardsCert -> String - -- ^ To json - -- > toJson self - , toJsValue :: MoveInstantaneousRewardsCert -> MoveInstantaneousRewardsCertJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe MoveInstantaneousRewardsCert - -- ^ From json - -- > fromJson json - , moveInstantaneousReward :: MoveInstantaneousRewardsCert -> MoveInstantaneousReward - -- ^ Move instantaneous reward - -- > moveInstantaneousReward self - , new :: MoveInstantaneousReward -> MoveInstantaneousRewardsCert - -- ^ New - -- > new moveInstantaneousReward - } - --- | Move instantaneous rewards cert class API -moveInstantaneousRewardsCert :: MoveInstantaneousRewardsCertClass -moveInstantaneousRewardsCert = - { free: moveInstantaneousRewardsCert_free - , toBytes: moveInstantaneousRewardsCert_toBytes - , fromBytes: \a1 -> runForeignMaybe $ moveInstantaneousRewardsCert_fromBytes a1 - , toHex: moveInstantaneousRewardsCert_toHex - , fromHex: \a1 -> runForeignMaybe $ moveInstantaneousRewardsCert_fromHex a1 - , toJson: moveInstantaneousRewardsCert_toJson - , toJsValue: moveInstantaneousRewardsCert_toJsValue - , fromJson: \a1 -> runForeignMaybe $ moveInstantaneousRewardsCert_fromJson a1 - , moveInstantaneousReward: moveInstantaneousRewardsCert_moveInstantaneousReward - , new: moveInstantaneousRewardsCert_new - } - -instance HasFree MoveInstantaneousRewardsCert where - free = moveInstantaneousRewardsCert.free - -instance Show MoveInstantaneousRewardsCert where - show = moveInstantaneousRewardsCert.toHex - -instance ToJsValue MoveInstantaneousRewardsCert where - toJsValue = moveInstantaneousRewardsCert.toJsValue - -instance IsHex MoveInstantaneousRewardsCert where - toHex = moveInstantaneousRewardsCert.toHex - fromHex = moveInstantaneousRewardsCert.fromHex - -instance IsBytes MoveInstantaneousRewardsCert where - toBytes = moveInstantaneousRewardsCert.toBytes - fromBytes = moveInstantaneousRewardsCert.fromBytes - -instance IsJson MoveInstantaneousRewardsCert where - toJson = moveInstantaneousRewardsCert.toJson - fromJson = moveInstantaneousRewardsCert.fromJson - -------------------------------------------------------------------------------------- --- Multi asset - -foreign import multiAsset_free :: MultiAsset -> Effect Unit -foreign import multiAsset_toBytes :: MultiAsset -> Bytes -foreign import multiAsset_fromBytes :: Bytes -> ForeignErrorable MultiAsset -foreign import multiAsset_toHex :: MultiAsset -> String -foreign import multiAsset_fromHex :: String -> ForeignErrorable MultiAsset -foreign import multiAsset_toJson :: MultiAsset -> String -foreign import multiAsset_toJsValue :: MultiAsset -> MultiAssetJson -foreign import multiAsset_fromJson :: String -> ForeignErrorable MultiAsset -foreign import multiAsset_new :: Effect MultiAsset -foreign import multiAsset_len :: MultiAsset -> Effect Int -foreign import multiAsset_insert :: MultiAsset -> ScriptHash -> Assets -> Nullable Assets -foreign import multiAsset_get :: MultiAsset -> ScriptHash -> Effect ((Nullable Assets)) -foreign import multiAsset_setAsset :: MultiAsset -> ScriptHash -> AssetName -> BigNum -> Effect ((Nullable BigNum)) -foreign import multiAsset_getAsset :: MultiAsset -> ScriptHash -> AssetName -> Effect BigNum -foreign import multiAsset_keys :: MultiAsset -> Effect ScriptHashes -foreign import multiAsset_sub :: MultiAsset -> MultiAsset -> Effect MultiAsset - --- | Multi asset class -type MultiAssetClass = - { free :: MultiAsset -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: MultiAsset -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe MultiAsset - -- ^ From bytes - -- > fromBytes bytes - , toHex :: MultiAsset -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe MultiAsset - -- ^ From hex - -- > fromHex hexStr - , toJson :: MultiAsset -> String - -- ^ To json - -- > toJson self - , toJsValue :: MultiAsset -> MultiAssetJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe MultiAsset - -- ^ From json - -- > fromJson json - , new :: Effect MultiAsset - -- ^ New - -- > new - , len :: MultiAsset -> Effect Int - -- ^ Len - -- > len self - , insert :: MultiAsset -> ScriptHash -> Assets -> Maybe Assets - -- ^ Insert - -- > insert self policyId assets - , get :: MultiAsset -> ScriptHash -> Effect ((Maybe Assets)) - -- ^ Get - -- > get self policyId - , setAsset :: MultiAsset -> ScriptHash -> AssetName -> BigNum -> Effect ((Maybe BigNum)) - -- ^ Set asset - -- > setAsset self policyId assetName value - , getAsset :: MultiAsset -> ScriptHash -> AssetName -> Effect BigNum - -- ^ Get asset - -- > getAsset self policyId assetName - , keys :: MultiAsset -> Effect ScriptHashes - -- ^ Keys - -- > keys self - , sub :: MultiAsset -> MultiAsset -> Effect MultiAsset - -- ^ Sub - -- > sub self rhsMa - } - --- | Multi asset class API -multiAsset :: MultiAssetClass -multiAsset = - { free: multiAsset_free - , toBytes: multiAsset_toBytes - , fromBytes: \a1 -> runForeignMaybe $ multiAsset_fromBytes a1 - , toHex: multiAsset_toHex - , fromHex: \a1 -> runForeignMaybe $ multiAsset_fromHex a1 - , toJson: multiAsset_toJson - , toJsValue: multiAsset_toJsValue - , fromJson: \a1 -> runForeignMaybe $ multiAsset_fromJson a1 - , new: multiAsset_new - , len: multiAsset_len - , insert: \a1 a2 a3 -> Nullable.toMaybe $ multiAsset_insert a1 a2 a3 - , get: \a1 a2 -> Nullable.toMaybe <$> multiAsset_get a1 a2 - , setAsset: \a1 a2 a3 a4 -> Nullable.toMaybe <$> multiAsset_setAsset a1 a2 a3 a4 - , getAsset: multiAsset_getAsset - , keys: multiAsset_keys - , sub: multiAsset_sub - } - -instance HasFree MultiAsset where - free = multiAsset.free - -instance Show MultiAsset where - show = multiAsset.toHex - -instance ToJsValue MultiAsset where - toJsValue = multiAsset.toJsValue - -instance IsHex MultiAsset where - toHex = multiAsset.toHex - fromHex = multiAsset.fromHex - -instance IsBytes MultiAsset where - toBytes = multiAsset.toBytes - fromBytes = multiAsset.fromBytes - -instance IsJson MultiAsset where - toJson = multiAsset.toJson - fromJson = multiAsset.fromJson - -------------------------------------------------------------------------------------- --- Multi host name - -foreign import multiHostName_free :: MultiHostName -> Effect Unit -foreign import multiHostName_toBytes :: MultiHostName -> Bytes -foreign import multiHostName_fromBytes :: Bytes -> ForeignErrorable MultiHostName -foreign import multiHostName_toHex :: MultiHostName -> String -foreign import multiHostName_fromHex :: String -> ForeignErrorable MultiHostName -foreign import multiHostName_toJson :: MultiHostName -> String -foreign import multiHostName_toJsValue :: MultiHostName -> MultiHostNameJson -foreign import multiHostName_fromJson :: String -> ForeignErrorable MultiHostName -foreign import multiHostName_dnsName :: MultiHostName -> DNSRecordSRV -foreign import multiHostName_new :: DNSRecordSRV -> MultiHostName - --- | Multi host name class -type MultiHostNameClass = - { free :: MultiHostName -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: MultiHostName -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe MultiHostName - -- ^ From bytes - -- > fromBytes bytes - , toHex :: MultiHostName -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe MultiHostName - -- ^ From hex - -- > fromHex hexStr - , toJson :: MultiHostName -> String - -- ^ To json - -- > toJson self - , toJsValue :: MultiHostName -> MultiHostNameJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe MultiHostName - -- ^ From json - -- > fromJson json - , dnsName :: MultiHostName -> DNSRecordSRV - -- ^ Dns name - -- > dnsName self - , new :: DNSRecordSRV -> MultiHostName - -- ^ New - -- > new dnsName - } - --- | Multi host name class API -multiHostName :: MultiHostNameClass -multiHostName = - { free: multiHostName_free - , toBytes: multiHostName_toBytes - , fromBytes: \a1 -> runForeignMaybe $ multiHostName_fromBytes a1 - , toHex: multiHostName_toHex - , fromHex: \a1 -> runForeignMaybe $ multiHostName_fromHex a1 - , toJson: multiHostName_toJson - , toJsValue: multiHostName_toJsValue - , fromJson: \a1 -> runForeignMaybe $ multiHostName_fromJson a1 - , dnsName: multiHostName_dnsName - , new: multiHostName_new - } - -instance HasFree MultiHostName where - free = multiHostName.free - -instance Show MultiHostName where - show = multiHostName.toHex - -instance ToJsValue MultiHostName where - toJsValue = multiHostName.toJsValue - -instance IsHex MultiHostName where - toHex = multiHostName.toHex - fromHex = multiHostName.fromHex - -instance IsBytes MultiHostName where - toBytes = multiHostName.toBytes - fromBytes = multiHostName.fromBytes - -instance IsJson MultiHostName where - toJson = multiHostName.toJson - fromJson = multiHostName.fromJson - -------------------------------------------------------------------------------------- --- Native script - -foreign import nativeScript_free :: NativeScript -> Effect Unit -foreign import nativeScript_toBytes :: NativeScript -> Bytes -foreign import nativeScript_fromBytes :: Bytes -> ForeignErrorable NativeScript -foreign import nativeScript_toHex :: NativeScript -> String -foreign import nativeScript_fromHex :: String -> ForeignErrorable NativeScript -foreign import nativeScript_toJson :: NativeScript -> String -foreign import nativeScript_toJsValue :: NativeScript -> NativeScriptJson -foreign import nativeScript_fromJson :: String -> ForeignErrorable NativeScript -foreign import nativeScript_hash :: NativeScript -> ScriptHash -foreign import nativeScript_newScriptPubkey :: ScriptPubkey -> NativeScript -foreign import nativeScript_newScriptAll :: ScriptAll -> NativeScript -foreign import nativeScript_newScriptAny :: ScriptAny -> NativeScript -foreign import nativeScript_newScriptNOfK :: ScriptNOfK -> NativeScript -foreign import nativeScript_newTimelockStart :: TimelockStart -> NativeScript -foreign import nativeScript_newTimelockExpiry :: TimelockExpiry -> NativeScript -foreign import nativeScript_kind :: NativeScript -> Number -foreign import nativeScript_asScriptPubkey :: NativeScript -> Nullable ScriptPubkey -foreign import nativeScript_asScriptAll :: NativeScript -> Nullable ScriptAll -foreign import nativeScript_asScriptAny :: NativeScript -> Nullable ScriptAny -foreign import nativeScript_asScriptNOfK :: NativeScript -> Nullable ScriptNOfK -foreign import nativeScript_asTimelockStart :: NativeScript -> Nullable TimelockStart -foreign import nativeScript_asTimelockExpiry :: NativeScript -> Nullable TimelockExpiry -foreign import nativeScript_getRequiredSigners :: NativeScript -> Ed25519KeyHashes - --- | Native script class -type NativeScriptClass = - { free :: NativeScript -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: NativeScript -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe NativeScript - -- ^ From bytes - -- > fromBytes bytes - , toHex :: NativeScript -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe NativeScript - -- ^ From hex - -- > fromHex hexStr - , toJson :: NativeScript -> String - -- ^ To json - -- > toJson self - , toJsValue :: NativeScript -> NativeScriptJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe NativeScript - -- ^ From json - -- > fromJson json - , hash :: NativeScript -> ScriptHash - -- ^ Hash - -- > hash self - , newScriptPubkey :: ScriptPubkey -> NativeScript - -- ^ New script pubkey - -- > newScriptPubkey scriptPubkey - , newScriptAll :: ScriptAll -> NativeScript - -- ^ New script all - -- > newScriptAll scriptAll - , newScriptAny :: ScriptAny -> NativeScript - -- ^ New script any - -- > newScriptAny scriptAny - , newScriptNOfK :: ScriptNOfK -> NativeScript - -- ^ New script n of k - -- > newScriptNOfK scriptNOfK - , newTimelockStart :: TimelockStart -> NativeScript - -- ^ New timelock start - -- > newTimelockStart timelockStart - , newTimelockExpiry :: TimelockExpiry -> NativeScript - -- ^ New timelock expiry - -- > newTimelockExpiry timelockExpiry - , kind :: NativeScript -> Number - -- ^ Kind - -- > kind self - , asScriptPubkey :: NativeScript -> Maybe ScriptPubkey - -- ^ As script pubkey - -- > asScriptPubkey self - , asScriptAll :: NativeScript -> Maybe ScriptAll - -- ^ As script all - -- > asScriptAll self - , asScriptAny :: NativeScript -> Maybe ScriptAny - -- ^ As script any - -- > asScriptAny self - , asScriptNOfK :: NativeScript -> Maybe ScriptNOfK - -- ^ As script n of k - -- > asScriptNOfK self - , asTimelockStart :: NativeScript -> Maybe TimelockStart - -- ^ As timelock start - -- > asTimelockStart self - , asTimelockExpiry :: NativeScript -> Maybe TimelockExpiry - -- ^ As timelock expiry - -- > asTimelockExpiry self - , getRequiredSigners :: NativeScript -> Ed25519KeyHashes - -- ^ Get required signers - -- > getRequiredSigners self - } - --- | Native script class API -nativeScript :: NativeScriptClass -nativeScript = - { free: nativeScript_free - , toBytes: nativeScript_toBytes - , fromBytes: \a1 -> runForeignMaybe $ nativeScript_fromBytes a1 - , toHex: nativeScript_toHex - , fromHex: \a1 -> runForeignMaybe $ nativeScript_fromHex a1 - , toJson: nativeScript_toJson - , toJsValue: nativeScript_toJsValue - , fromJson: \a1 -> runForeignMaybe $ nativeScript_fromJson a1 - , hash: nativeScript_hash - , newScriptPubkey: nativeScript_newScriptPubkey - , newScriptAll: nativeScript_newScriptAll - , newScriptAny: nativeScript_newScriptAny - , newScriptNOfK: nativeScript_newScriptNOfK - , newTimelockStart: nativeScript_newTimelockStart - , newTimelockExpiry: nativeScript_newTimelockExpiry - , kind: nativeScript_kind - , asScriptPubkey: \a1 -> Nullable.toMaybe $ nativeScript_asScriptPubkey a1 - , asScriptAll: \a1 -> Nullable.toMaybe $ nativeScript_asScriptAll a1 - , asScriptAny: \a1 -> Nullable.toMaybe $ nativeScript_asScriptAny a1 - , asScriptNOfK: \a1 -> Nullable.toMaybe $ nativeScript_asScriptNOfK a1 - , asTimelockStart: \a1 -> Nullable.toMaybe $ nativeScript_asTimelockStart a1 - , asTimelockExpiry: \a1 -> Nullable.toMaybe $ nativeScript_asTimelockExpiry a1 - , getRequiredSigners: nativeScript_getRequiredSigners - } - -instance HasFree NativeScript where - free = nativeScript.free - -instance Show NativeScript where - show = nativeScript.toHex - -instance ToJsValue NativeScript where - toJsValue = nativeScript.toJsValue - -instance IsHex NativeScript where - toHex = nativeScript.toHex - fromHex = nativeScript.fromHex - -instance IsBytes NativeScript where - toBytes = nativeScript.toBytes - fromBytes = nativeScript.fromBytes - -instance IsJson NativeScript where - toJson = nativeScript.toJson - fromJson = nativeScript.fromJson - -------------------------------------------------------------------------------------- --- Native scripts - -foreign import nativeScripts_free :: NativeScripts -> Effect Unit -foreign import nativeScripts_new :: Effect NativeScripts -foreign import nativeScripts_len :: NativeScripts -> Effect Int -foreign import nativeScripts_get :: NativeScripts -> Int -> Effect NativeScript -foreign import nativeScripts_add :: NativeScripts -> NativeScript -> Effect Unit - --- | Native scripts class -type NativeScriptsClass = - { free :: NativeScripts -> Effect Unit - -- ^ Free - -- > free self - , new :: Effect NativeScripts - -- ^ New - -- > new - , len :: NativeScripts -> Effect Int - -- ^ Len - -- > len self - , get :: NativeScripts -> Int -> Effect NativeScript - -- ^ Get - -- > get self index - , add :: NativeScripts -> NativeScript -> Effect Unit - -- ^ Add - -- > add self elem - } - --- | Native scripts class API -nativeScripts :: NativeScriptsClass -nativeScripts = - { free: nativeScripts_free - , new: nativeScripts_new - , len: nativeScripts_len - , get: nativeScripts_get - , add: nativeScripts_add - } - -instance HasFree NativeScripts where - free = nativeScripts.free - -instance MutableList NativeScripts NativeScript where - addItem = nativeScripts.add - getItem = nativeScripts.get - emptyList = nativeScripts.new - -instance MutableLen NativeScripts where - getLen = nativeScripts.len - -------------------------------------------------------------------------------------- --- Network id - -foreign import networkId_free :: NetworkId -> Effect Unit -foreign import networkId_toBytes :: NetworkId -> Bytes -foreign import networkId_fromBytes :: Bytes -> ForeignErrorable NetworkId -foreign import networkId_toHex :: NetworkId -> String -foreign import networkId_fromHex :: String -> ForeignErrorable NetworkId -foreign import networkId_toJson :: NetworkId -> String -foreign import networkId_toJsValue :: NetworkId -> NetworkIdJson -foreign import networkId_fromJson :: String -> ForeignErrorable NetworkId -foreign import networkId_testnet :: NetworkId -foreign import networkId_mainnet :: NetworkId -foreign import networkId_kind :: NetworkId -> Number - --- | Network id class -type NetworkIdClass = - { free :: NetworkId -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: NetworkId -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe NetworkId - -- ^ From bytes - -- > fromBytes bytes - , toHex :: NetworkId -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe NetworkId - -- ^ From hex - -- > fromHex hexStr - , toJson :: NetworkId -> String - -- ^ To json - -- > toJson self - , toJsValue :: NetworkId -> NetworkIdJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe NetworkId - -- ^ From json - -- > fromJson json - , testnet :: NetworkId - -- ^ Testnet - -- > testnet - , mainnet :: NetworkId - -- ^ Mainnet - -- > mainnet - , kind :: NetworkId -> Number - -- ^ Kind - -- > kind self - } - --- | Network id class API -networkId :: NetworkIdClass -networkId = - { free: networkId_free - , toBytes: networkId_toBytes - , fromBytes: \a1 -> runForeignMaybe $ networkId_fromBytes a1 - , toHex: networkId_toHex - , fromHex: \a1 -> runForeignMaybe $ networkId_fromHex a1 - , toJson: networkId_toJson - , toJsValue: networkId_toJsValue - , fromJson: \a1 -> runForeignMaybe $ networkId_fromJson a1 - , testnet: networkId_testnet - , mainnet: networkId_mainnet - , kind: networkId_kind - } - -instance HasFree NetworkId where - free = networkId.free - -instance Show NetworkId where - show = networkId.toHex - -instance ToJsValue NetworkId where - toJsValue = networkId.toJsValue - -instance IsHex NetworkId where - toHex = networkId.toHex - fromHex = networkId.fromHex - -instance IsBytes NetworkId where - toBytes = networkId.toBytes - fromBytes = networkId.fromBytes - -instance IsJson NetworkId where - toJson = networkId.toJson - fromJson = networkId.fromJson - -------------------------------------------------------------------------------------- --- Network info - -foreign import networkInfo_free :: NetworkInfo -> Effect Unit -foreign import networkInfo_new :: Number -> Number -> NetworkInfo -foreign import networkInfo_networkId :: NetworkInfo -> Number -foreign import networkInfo_protocolMagic :: NetworkInfo -> Number -foreign import networkInfo_testnet :: NetworkInfo -foreign import networkInfo_mainnet :: NetworkInfo - --- | Network info class -type NetworkInfoClass = - { free :: NetworkInfo -> Effect Unit - -- ^ Free - -- > free self - , new :: Number -> Number -> NetworkInfo - -- ^ New - -- > new networkId protocolMagic - , networkId :: NetworkInfo -> Number - -- ^ Network id - -- > networkId self - , protocolMagic :: NetworkInfo -> Number - -- ^ Protocol magic - -- > protocolMagic self - , testnet :: NetworkInfo - -- ^ Testnet - -- > testnet - , mainnet :: NetworkInfo - -- ^ Mainnet - -- > mainnet - } - --- | Network info class API -networkInfo :: NetworkInfoClass -networkInfo = - { free: networkInfo_free - , new: networkInfo_new - , networkId: networkInfo_networkId - , protocolMagic: networkInfo_protocolMagic - , testnet: networkInfo_testnet - , mainnet: networkInfo_mainnet - } - -instance HasFree NetworkInfo where - free = networkInfo.free - -------------------------------------------------------------------------------------- --- Nonce - -foreign import nonce_free :: Nonce -> Effect Unit -foreign import nonce_toBytes :: Nonce -> Bytes -foreign import nonce_fromBytes :: Bytes -> ForeignErrorable Nonce -foreign import nonce_toHex :: Nonce -> String -foreign import nonce_fromHex :: String -> ForeignErrorable Nonce -foreign import nonce_toJson :: Nonce -> String -foreign import nonce_toJsValue :: Nonce -> NonceJson -foreign import nonce_fromJson :: String -> ForeignErrorable Nonce -foreign import nonce_newIdentity :: Nonce -foreign import nonce_newFromHash :: Bytes -> Nonce -foreign import nonce_getHash :: Nonce -> Nullable Bytes - --- | Nonce class -type NonceClass = - { free :: Nonce -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: Nonce -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe Nonce - -- ^ From bytes - -- > fromBytes bytes - , toHex :: Nonce -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe Nonce - -- ^ From hex - -- > fromHex hexStr - , toJson :: Nonce -> String - -- ^ To json - -- > toJson self - , toJsValue :: Nonce -> NonceJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe Nonce - -- ^ From json - -- > fromJson json - , newIdentity :: Nonce - -- ^ New identity - -- > newIdentity - , newFromHash :: Bytes -> Nonce - -- ^ New from hash - -- > newFromHash hash - , getHash :: Nonce -> Maybe Bytes - -- ^ Get hash - -- > getHash self - } - --- | Nonce class API -nonce :: NonceClass -nonce = - { free: nonce_free - , toBytes: nonce_toBytes - , fromBytes: \a1 -> runForeignMaybe $ nonce_fromBytes a1 - , toHex: nonce_toHex - , fromHex: \a1 -> runForeignMaybe $ nonce_fromHex a1 - , toJson: nonce_toJson - , toJsValue: nonce_toJsValue - , fromJson: \a1 -> runForeignMaybe $ nonce_fromJson a1 - , newIdentity: nonce_newIdentity - , newFromHash: nonce_newFromHash - , getHash: \a1 -> Nullable.toMaybe $ nonce_getHash a1 - } - -instance HasFree Nonce where - free = nonce.free - -instance Show Nonce where - show = nonce.toHex - -instance ToJsValue Nonce where - toJsValue = nonce.toJsValue - -instance IsHex Nonce where - toHex = nonce.toHex - fromHex = nonce.fromHex - -instance IsBytes Nonce where - toBytes = nonce.toBytes - fromBytes = nonce.fromBytes - -instance IsJson Nonce where - toJson = nonce.toJson - fromJson = nonce.fromJson - -------------------------------------------------------------------------------------- --- Operational cert - -foreign import operationalCert_free :: OperationalCert -> Effect Unit -foreign import operationalCert_toBytes :: OperationalCert -> Bytes -foreign import operationalCert_fromBytes :: Bytes -> ForeignErrorable OperationalCert -foreign import operationalCert_toHex :: OperationalCert -> String -foreign import operationalCert_fromHex :: String -> ForeignErrorable OperationalCert -foreign import operationalCert_toJson :: OperationalCert -> String -foreign import operationalCert_toJsValue :: OperationalCert -> OperationalCertJson -foreign import operationalCert_fromJson :: String -> ForeignErrorable OperationalCert -foreign import operationalCert_hotVkey :: OperationalCert -> KESVKey -foreign import operationalCert_sequenceNumber :: OperationalCert -> Number -foreign import operationalCert_kesPeriod :: OperationalCert -> Number -foreign import operationalCert_sigma :: OperationalCert -> Ed25519Signature -foreign import operationalCert_new :: KESVKey -> Number -> Number -> Ed25519Signature -> OperationalCert - --- | Operational cert class -type OperationalCertClass = - { free :: OperationalCert -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: OperationalCert -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe OperationalCert - -- ^ From bytes - -- > fromBytes bytes - , toHex :: OperationalCert -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe OperationalCert - -- ^ From hex - -- > fromHex hexStr - , toJson :: OperationalCert -> String - -- ^ To json - -- > toJson self - , toJsValue :: OperationalCert -> OperationalCertJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe OperationalCert - -- ^ From json - -- > fromJson json - , hotVkey :: OperationalCert -> KESVKey - -- ^ Hot vkey - -- > hotVkey self - , sequenceNumber :: OperationalCert -> Number - -- ^ Sequence number - -- > sequenceNumber self - , kesPeriod :: OperationalCert -> Number - -- ^ Kes period - -- > kesPeriod self - , sigma :: OperationalCert -> Ed25519Signature - -- ^ Sigma - -- > sigma self - , new :: KESVKey -> Number -> Number -> Ed25519Signature -> OperationalCert - -- ^ New - -- > new hotVkey sequenceNumber kesPeriod sigma - } - --- | Operational cert class API -operationalCert :: OperationalCertClass -operationalCert = - { free: operationalCert_free - , toBytes: operationalCert_toBytes - , fromBytes: \a1 -> runForeignMaybe $ operationalCert_fromBytes a1 - , toHex: operationalCert_toHex - , fromHex: \a1 -> runForeignMaybe $ operationalCert_fromHex a1 - , toJson: operationalCert_toJson - , toJsValue: operationalCert_toJsValue - , fromJson: \a1 -> runForeignMaybe $ operationalCert_fromJson a1 - , hotVkey: operationalCert_hotVkey - , sequenceNumber: operationalCert_sequenceNumber - , kesPeriod: operationalCert_kesPeriod - , sigma: operationalCert_sigma - , new: operationalCert_new - } - -instance HasFree OperationalCert where - free = operationalCert.free - -instance Show OperationalCert where - show = operationalCert.toHex - -instance ToJsValue OperationalCert where - toJsValue = operationalCert.toJsValue - -instance IsHex OperationalCert where - toHex = operationalCert.toHex - fromHex = operationalCert.fromHex - -instance IsBytes OperationalCert where - toBytes = operationalCert.toBytes - fromBytes = operationalCert.fromBytes - -instance IsJson OperationalCert where - toJson = operationalCert.toJson - fromJson = operationalCert.fromJson - -------------------------------------------------------------------------------------- --- Plutus data - -foreign import plutusData_free :: PlutusData -> Effect Unit -foreign import plutusData_toBytes :: PlutusData -> Bytes -foreign import plutusData_fromBytes :: Bytes -> ForeignErrorable PlutusData -foreign import plutusData_toHex :: PlutusData -> String -foreign import plutusData_fromHex :: String -> ForeignErrorable PlutusData -foreign import plutusData_toJson :: PlutusData -> String -foreign import plutusData_toJsValue :: PlutusData -> PlutusDataJson -foreign import plutusData_fromJson :: String -> ForeignErrorable PlutusData -foreign import plutusData_newConstrPlutusData :: ConstrPlutusData -> PlutusData -foreign import plutusData_newEmptyConstrPlutusData :: BigNum -> PlutusData -foreign import plutusData_newMap :: PlutusMap -> PlutusData -foreign import plutusData_newList :: PlutusList -> PlutusData -foreign import plutusData_newInteger :: BigInt -> PlutusData -foreign import plutusData_newBytes :: Bytes -> PlutusData -foreign import plutusData_kind :: PlutusData -> Number -foreign import plutusData_asConstrPlutusData :: PlutusData -> Nullable ConstrPlutusData -foreign import plutusData_asMap :: PlutusData -> Nullable PlutusMap -foreign import plutusData_asList :: PlutusData -> Nullable PlutusList -foreign import plutusData_asInteger :: PlutusData -> Nullable BigInt -foreign import plutusData_asBytes :: PlutusData -> Nullable Bytes - --- | Plutus data class -type PlutusDataClass = - { free :: PlutusData -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: PlutusData -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe PlutusData - -- ^ From bytes - -- > fromBytes bytes - , toHex :: PlutusData -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe PlutusData - -- ^ From hex - -- > fromHex hexStr - , toJson :: PlutusData -> String - -- ^ To json - -- > toJson self - , toJsValue :: PlutusData -> PlutusDataJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe PlutusData - -- ^ From json - -- > fromJson json - , newConstrPlutusData :: ConstrPlutusData -> PlutusData - -- ^ New constr plutus data - -- > newConstrPlutusData constrPlutusData - , newEmptyConstrPlutusData :: BigNum -> PlutusData - -- ^ New empty constr plutus data - -- > newEmptyConstrPlutusData alternative - , newMap :: PlutusMap -> PlutusData - -- ^ New map - -- > newMap map - , newList :: PlutusList -> PlutusData - -- ^ New list - -- > newList list - , newInteger :: BigInt -> PlutusData - -- ^ New integer - -- > newInteger integer - , newBytes :: Bytes -> PlutusData - -- ^ New bytes - -- > newBytes bytes - , kind :: PlutusData -> Number - -- ^ Kind - -- > kind self - , asConstrPlutusData :: PlutusData -> Maybe ConstrPlutusData - -- ^ As constr plutus data - -- > asConstrPlutusData self - , asMap :: PlutusData -> Maybe PlutusMap - -- ^ As map - -- > asMap self - , asList :: PlutusData -> Maybe PlutusList - -- ^ As list - -- > asList self - , asInteger :: PlutusData -> Maybe BigInt - -- ^ As integer - -- > asInteger self - , asBytes :: PlutusData -> Maybe Bytes - -- ^ As bytes - -- > asBytes self - } - --- | Plutus data class API -plutusData :: PlutusDataClass -plutusData = - { free: plutusData_free - , toBytes: plutusData_toBytes - , fromBytes: \a1 -> runForeignMaybe $ plutusData_fromBytes a1 - , toHex: plutusData_toHex - , fromHex: \a1 -> runForeignMaybe $ plutusData_fromHex a1 - , toJson: plutusData_toJson - , toJsValue: plutusData_toJsValue - , fromJson: \a1 -> runForeignMaybe $ plutusData_fromJson a1 - , newConstrPlutusData: plutusData_newConstrPlutusData - , newEmptyConstrPlutusData: plutusData_newEmptyConstrPlutusData - , newMap: plutusData_newMap - , newList: plutusData_newList - , newInteger: plutusData_newInteger - , newBytes: plutusData_newBytes - , kind: plutusData_kind - , asConstrPlutusData: \a1 -> Nullable.toMaybe $ plutusData_asConstrPlutusData a1 - , asMap: \a1 -> Nullable.toMaybe $ plutusData_asMap a1 - , asList: \a1 -> Nullable.toMaybe $ plutusData_asList a1 - , asInteger: \a1 -> Nullable.toMaybe $ plutusData_asInteger a1 - , asBytes: \a1 -> Nullable.toMaybe $ plutusData_asBytes a1 - } - -instance HasFree PlutusData where - free = plutusData.free - -instance Show PlutusData where - show = plutusData.toHex - -instance ToJsValue PlutusData where - toJsValue = plutusData.toJsValue - -instance IsHex PlutusData where - toHex = plutusData.toHex - fromHex = plutusData.fromHex - -instance IsBytes PlutusData where - toBytes = plutusData.toBytes - fromBytes = plutusData.fromBytes - -instance IsJson PlutusData where - toJson = plutusData.toJson - fromJson = plutusData.fromJson - -------------------------------------------------------------------------------------- --- Plutus list - -foreign import plutusList_free :: PlutusList -> Effect Unit -foreign import plutusList_toBytes :: PlutusList -> Bytes -foreign import plutusList_fromBytes :: Bytes -> ForeignErrorable PlutusList -foreign import plutusList_toHex :: PlutusList -> String -foreign import plutusList_fromHex :: String -> ForeignErrorable PlutusList -foreign import plutusList_toJson :: PlutusList -> String -foreign import plutusList_toJsValue :: PlutusList -> PlutusListJson -foreign import plutusList_fromJson :: String -> ForeignErrorable PlutusList -foreign import plutusList_new :: Effect PlutusList -foreign import plutusList_len :: PlutusList -> Effect Int -foreign import plutusList_get :: PlutusList -> Int -> Effect PlutusData -foreign import plutusList_add :: PlutusList -> PlutusData -> Effect Unit - --- | Plutus list class -type PlutusListClass = - { free :: PlutusList -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: PlutusList -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe PlutusList - -- ^ From bytes - -- > fromBytes bytes - , toHex :: PlutusList -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe PlutusList - -- ^ From hex - -- > fromHex hexStr - , toJson :: PlutusList -> String - -- ^ To json - -- > toJson self - , toJsValue :: PlutusList -> PlutusListJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe PlutusList - -- ^ From json - -- > fromJson json - , new :: Effect PlutusList - -- ^ New - -- > new - , len :: PlutusList -> Effect Int - -- ^ Len - -- > len self - , get :: PlutusList -> Int -> Effect PlutusData - -- ^ Get - -- > get self index - , add :: PlutusList -> PlutusData -> Effect Unit - -- ^ Add - -- > add self elem - } - --- | Plutus list class API -plutusList :: PlutusListClass -plutusList = - { free: plutusList_free - , toBytes: plutusList_toBytes - , fromBytes: \a1 -> runForeignMaybe $ plutusList_fromBytes a1 - , toHex: plutusList_toHex - , fromHex: \a1 -> runForeignMaybe $ plutusList_fromHex a1 - , toJson: plutusList_toJson - , toJsValue: plutusList_toJsValue - , fromJson: \a1 -> runForeignMaybe $ plutusList_fromJson a1 - , new: plutusList_new - , len: plutusList_len - , get: plutusList_get - , add: plutusList_add - } - -instance HasFree PlutusList where - free = plutusList.free - -instance Show PlutusList where - show = plutusList.toHex - -instance MutableList PlutusList PlutusData where - addItem = plutusList.add - getItem = plutusList.get - emptyList = plutusList.new - -instance MutableLen PlutusList where - getLen = plutusList.len - - -instance ToJsValue PlutusList where - toJsValue = plutusList.toJsValue - -instance IsHex PlutusList where - toHex = plutusList.toHex - fromHex = plutusList.fromHex - -instance IsBytes PlutusList where - toBytes = plutusList.toBytes - fromBytes = plutusList.fromBytes - -instance IsJson PlutusList where - toJson = plutusList.toJson - fromJson = plutusList.fromJson - -------------------------------------------------------------------------------------- --- Plutus map - -foreign import plutusMap_free :: PlutusMap -> Effect Unit -foreign import plutusMap_toBytes :: PlutusMap -> Bytes -foreign import plutusMap_fromBytes :: Bytes -> ForeignErrorable PlutusMap -foreign import plutusMap_toHex :: PlutusMap -> String -foreign import plutusMap_fromHex :: String -> ForeignErrorable PlutusMap -foreign import plutusMap_toJson :: PlutusMap -> String -foreign import plutusMap_toJsValue :: PlutusMap -> PlutusMapJson -foreign import plutusMap_fromJson :: String -> ForeignErrorable PlutusMap -foreign import plutusMap_new :: Effect PlutusMap -foreign import plutusMap_len :: PlutusMap -> Effect Int -foreign import plutusMap_insert :: PlutusMap -> PlutusData -> PlutusData -> Effect ((Nullable PlutusData)) -foreign import plutusMap_get :: PlutusMap -> PlutusData -> Effect ((Nullable PlutusData)) -foreign import plutusMap_keys :: PlutusMap -> Effect PlutusList - --- | Plutus map class -type PlutusMapClass = - { free :: PlutusMap -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: PlutusMap -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe PlutusMap - -- ^ From bytes - -- > fromBytes bytes - , toHex :: PlutusMap -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe PlutusMap - -- ^ From hex - -- > fromHex hexStr - , toJson :: PlutusMap -> String - -- ^ To json - -- > toJson self - , toJsValue :: PlutusMap -> PlutusMapJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe PlutusMap - -- ^ From json - -- > fromJson json - , new :: Effect PlutusMap - -- ^ New - -- > new - , len :: PlutusMap -> Effect Int - -- ^ Len - -- > len self - , insert :: PlutusMap -> PlutusData -> PlutusData -> Effect ((Maybe PlutusData)) - -- ^ Insert - -- > insert self key value - , get :: PlutusMap -> PlutusData -> Effect ((Maybe PlutusData)) - -- ^ Get - -- > get self key - , keys :: PlutusMap -> Effect PlutusList - -- ^ Keys - -- > keys self - } - --- | Plutus map class API -plutusMap :: PlutusMapClass -plutusMap = - { free: plutusMap_free - , toBytes: plutusMap_toBytes - , fromBytes: \a1 -> runForeignMaybe $ plutusMap_fromBytes a1 - , toHex: plutusMap_toHex - , fromHex: \a1 -> runForeignMaybe $ plutusMap_fromHex a1 - , toJson: plutusMap_toJson - , toJsValue: plutusMap_toJsValue - , fromJson: \a1 -> runForeignMaybe $ plutusMap_fromJson a1 - , new: plutusMap_new - , len: plutusMap_len - , insert: \a1 a2 a3 -> Nullable.toMaybe <$> plutusMap_insert a1 a2 a3 - , get: \a1 a2 -> Nullable.toMaybe <$> plutusMap_get a1 a2 - , keys: plutusMap_keys - } - -instance HasFree PlutusMap where - free = plutusMap.free - -instance Show PlutusMap where - show = plutusMap.toHex - -instance ToJsValue PlutusMap where - toJsValue = plutusMap.toJsValue - -instance IsHex PlutusMap where - toHex = plutusMap.toHex - fromHex = plutusMap.fromHex - -instance IsBytes PlutusMap where - toBytes = plutusMap.toBytes - fromBytes = plutusMap.fromBytes - -instance IsJson PlutusMap where - toJson = plutusMap.toJson - fromJson = plutusMap.fromJson - -------------------------------------------------------------------------------------- --- Plutus script - -foreign import plutusScript_free :: PlutusScript -> Effect Unit -foreign import plutusScript_toBytes :: PlutusScript -> Bytes -foreign import plutusScript_fromBytes :: Bytes -> ForeignErrorable PlutusScript -foreign import plutusScript_toHex :: PlutusScript -> String -foreign import plutusScript_fromHex :: String -> ForeignErrorable PlutusScript -foreign import plutusScript_new :: Bytes -> PlutusScript -foreign import plutusScript_newV2 :: Bytes -> PlutusScript -foreign import plutusScript_newWithVersion :: Bytes -> Language -> PlutusScript -foreign import plutusScript_bytes :: PlutusScript -> Bytes -foreign import plutusScript_fromBytesV2 :: Bytes -> PlutusScript -foreign import plutusScript_fromBytesWithVersion :: Bytes -> Language -> PlutusScript -foreign import plutusScript_hash :: PlutusScript -> ScriptHash -foreign import plutusScript_languageVersion :: PlutusScript -> Language - --- | Plutus script class -type PlutusScriptClass = - { free :: PlutusScript -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: PlutusScript -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe PlutusScript - -- ^ From bytes - -- > fromBytes bytes - , toHex :: PlutusScript -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe PlutusScript - -- ^ From hex - -- > fromHex hexStr - , new :: Bytes -> PlutusScript - -- ^ New - -- > new bytes - , newV2 :: Bytes -> PlutusScript - -- ^ New v2 - -- > newV2 bytes - , newWithVersion :: Bytes -> Language -> PlutusScript - -- ^ New with version - -- > newWithVersion bytes language - , bytes :: PlutusScript -> Bytes - -- ^ Bytes - -- > bytes self - , fromBytesV2 :: Bytes -> PlutusScript - -- ^ From bytes v2 - -- > fromBytesV2 bytes - , fromBytesWithVersion :: Bytes -> Language -> PlutusScript - -- ^ From bytes with version - -- > fromBytesWithVersion bytes language - , hash :: PlutusScript -> ScriptHash - -- ^ Hash - -- > hash self - , languageVersion :: PlutusScript -> Language - -- ^ Language version - -- > languageVersion self - } - --- | Plutus script class API -plutusScript :: PlutusScriptClass -plutusScript = - { free: plutusScript_free - , toBytes: plutusScript_toBytes - , fromBytes: \a1 -> runForeignMaybe $ plutusScript_fromBytes a1 - , toHex: plutusScript_toHex - , fromHex: \a1 -> runForeignMaybe $ plutusScript_fromHex a1 - , new: plutusScript_new - , newV2: plutusScript_newV2 - , newWithVersion: plutusScript_newWithVersion - , bytes: plutusScript_bytes - , fromBytesV2: plutusScript_fromBytesV2 - , fromBytesWithVersion: plutusScript_fromBytesWithVersion - , hash: plutusScript_hash - , languageVersion: plutusScript_languageVersion - } - -instance HasFree PlutusScript where - free = plutusScript.free - -instance Show PlutusScript where - show = plutusScript.toHex - -instance IsHex PlutusScript where - toHex = plutusScript.toHex - fromHex = plutusScript.fromHex - -instance IsBytes PlutusScript where - toBytes = plutusScript.toBytes - fromBytes = plutusScript.fromBytes - -------------------------------------------------------------------------------------- --- Plutus script source - -foreign import plutusScriptSource_free :: PlutusScriptSource -> Effect Unit -foreign import plutusScriptSource_new :: PlutusScript -> PlutusScriptSource -foreign import plutusScriptSource_newRefIn :: ScriptHash -> TxIn -> PlutusScriptSource - --- | Plutus script source class -type PlutusScriptSourceClass = - { free :: PlutusScriptSource -> Effect Unit - -- ^ Free - -- > free self - , new :: PlutusScript -> PlutusScriptSource - -- ^ New - -- > new script - , newRefIn :: ScriptHash -> TxIn -> PlutusScriptSource - -- ^ New ref input - -- > newRefIn scriptHash in - } - --- | Plutus script source class API -plutusScriptSource :: PlutusScriptSourceClass -plutusScriptSource = - { free: plutusScriptSource_free - , new: plutusScriptSource_new - , newRefIn: plutusScriptSource_newRefIn - } - -instance HasFree PlutusScriptSource where - free = plutusScriptSource.free - -------------------------------------------------------------------------------------- --- Plutus scripts - -foreign import plutusScripts_free :: PlutusScripts -> Effect Unit -foreign import plutusScripts_toBytes :: PlutusScripts -> Bytes -foreign import plutusScripts_fromBytes :: Bytes -> ForeignErrorable PlutusScripts -foreign import plutusScripts_toHex :: PlutusScripts -> String -foreign import plutusScripts_fromHex :: String -> ForeignErrorable PlutusScripts -foreign import plutusScripts_toJson :: PlutusScripts -> String -foreign import plutusScripts_toJsValue :: PlutusScripts -> PlutusScriptsJson -foreign import plutusScripts_fromJson :: String -> ForeignErrorable PlutusScripts -foreign import plutusScripts_new :: Effect PlutusScripts -foreign import plutusScripts_len :: PlutusScripts -> Effect Int -foreign import plutusScripts_get :: PlutusScripts -> Int -> Effect PlutusScript -foreign import plutusScripts_add :: PlutusScripts -> PlutusScript -> Effect Unit - --- | Plutus scripts class -type PlutusScriptsClass = - { free :: PlutusScripts -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: PlutusScripts -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe PlutusScripts - -- ^ From bytes - -- > fromBytes bytes - , toHex :: PlutusScripts -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe PlutusScripts - -- ^ From hex - -- > fromHex hexStr - , toJson :: PlutusScripts -> String - -- ^ To json - -- > toJson self - , toJsValue :: PlutusScripts -> PlutusScriptsJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe PlutusScripts - -- ^ From json - -- > fromJson json - , new :: Effect PlutusScripts - -- ^ New - -- > new - , len :: PlutusScripts -> Effect Int - -- ^ Len - -- > len self - , get :: PlutusScripts -> Int -> Effect PlutusScript - -- ^ Get - -- > get self index - , add :: PlutusScripts -> PlutusScript -> Effect Unit - -- ^ Add - -- > add self elem - } - --- | Plutus scripts class API -plutusScripts :: PlutusScriptsClass -plutusScripts = - { free: plutusScripts_free - , toBytes: plutusScripts_toBytes - , fromBytes: \a1 -> runForeignMaybe $ plutusScripts_fromBytes a1 - , toHex: plutusScripts_toHex - , fromHex: \a1 -> runForeignMaybe $ plutusScripts_fromHex a1 - , toJson: plutusScripts_toJson - , toJsValue: plutusScripts_toJsValue - , fromJson: \a1 -> runForeignMaybe $ plutusScripts_fromJson a1 - , new: plutusScripts_new - , len: plutusScripts_len - , get: plutusScripts_get - , add: plutusScripts_add - } - -instance HasFree PlutusScripts where - free = plutusScripts.free - -instance Show PlutusScripts where - show = plutusScripts.toHex - -instance MutableList PlutusScripts PlutusScript where - addItem = plutusScripts.add - getItem = plutusScripts.get - emptyList = plutusScripts.new - -instance MutableLen PlutusScripts where - getLen = plutusScripts.len - - -instance ToJsValue PlutusScripts where - toJsValue = plutusScripts.toJsValue - -instance IsHex PlutusScripts where - toHex = plutusScripts.toHex - fromHex = plutusScripts.fromHex - -instance IsBytes PlutusScripts where - toBytes = plutusScripts.toBytes - fromBytes = plutusScripts.fromBytes - -instance IsJson PlutusScripts where - toJson = plutusScripts.toJson - fromJson = plutusScripts.fromJson - -------------------------------------------------------------------------------------- --- Plutus witness - -foreign import plutusWitness_free :: PlutusWitness -> Effect Unit -foreign import plutusWitness_new :: PlutusScript -> PlutusData -> Redeemer -> PlutusWitness -foreign import plutusWitness_newWithRef :: PlutusScriptSource -> DatumSource -> Redeemer -> PlutusWitness -foreign import plutusWitness_script :: PlutusWitness -> Nullable PlutusScript -foreign import plutusWitness_datum :: PlutusWitness -> Nullable PlutusData -foreign import plutusWitness_redeemer :: PlutusWitness -> Redeemer - --- | Plutus witness class -type PlutusWitnessClass = - { free :: PlutusWitness -> Effect Unit - -- ^ Free - -- > free self - , new :: PlutusScript -> PlutusData -> Redeemer -> PlutusWitness - -- ^ New - -- > new script datum redeemer - , newWithRef :: PlutusScriptSource -> DatumSource -> Redeemer -> PlutusWitness - -- ^ New with ref - -- > newWithRef script datum redeemer - , script :: PlutusWitness -> Maybe PlutusScript - -- ^ Script - -- > script self - , datum :: PlutusWitness -> Maybe PlutusData - -- ^ Datum - -- > datum self - , redeemer :: PlutusWitness -> Redeemer - -- ^ Redeemer - -- > redeemer self - } - --- | Plutus witness class API -plutusWitness :: PlutusWitnessClass -plutusWitness = - { free: plutusWitness_free - , new: plutusWitness_new - , newWithRef: plutusWitness_newWithRef - , script: \a1 -> Nullable.toMaybe $ plutusWitness_script a1 - , datum: \a1 -> Nullable.toMaybe $ plutusWitness_datum a1 - , redeemer: plutusWitness_redeemer - } - -instance HasFree PlutusWitness where - free = plutusWitness.free - -------------------------------------------------------------------------------------- --- Plutus witnesses - -foreign import plutusWitnesses_free :: PlutusWitnesses -> Effect Unit -foreign import plutusWitnesses_new :: Effect PlutusWitnesses -foreign import plutusWitnesses_len :: PlutusWitnesses -> Effect Int -foreign import plutusWitnesses_get :: PlutusWitnesses -> Int -> Effect PlutusWitness -foreign import plutusWitnesses_add :: PlutusWitnesses -> PlutusWitness -> Effect Unit - --- | Plutus witnesses class -type PlutusWitnessesClass = - { free :: PlutusWitnesses -> Effect Unit - -- ^ Free - -- > free self - , new :: Effect PlutusWitnesses - -- ^ New - -- > new - , len :: PlutusWitnesses -> Effect Int - -- ^ Len - -- > len self - , get :: PlutusWitnesses -> Int -> Effect PlutusWitness - -- ^ Get - -- > get self index - , add :: PlutusWitnesses -> PlutusWitness -> Effect Unit - -- ^ Add - -- > add self elem - } - --- | Plutus witnesses class API -plutusWitnesses :: PlutusWitnessesClass -plutusWitnesses = - { free: plutusWitnesses_free - , new: plutusWitnesses_new - , len: plutusWitnesses_len - , get: plutusWitnesses_get - , add: plutusWitnesses_add - } - -instance HasFree PlutusWitnesses where - free = plutusWitnesses.free - -instance MutableList PlutusWitnesses PlutusWitness where - addItem = plutusWitnesses.add - getItem = plutusWitnesses.get - emptyList = plutusWitnesses.new - -instance MutableLen PlutusWitnesses where - getLen = plutusWitnesses.len - -------------------------------------------------------------------------------------- --- Pointer - -foreign import pointer_free :: Pointer -> Effect Unit -foreign import pointer_new :: Number -> Number -> Number -> Pointer -foreign import pointer_newPointer :: BigNum -> BigNum -> BigNum -> Pointer -foreign import pointer_slot :: Pointer -> Number -foreign import pointer_txIndex :: Pointer -> Number -foreign import pointer_certIndex :: Pointer -> Number -foreign import pointer_slotBignum :: Pointer -> BigNum -foreign import pointer_txIndexBignum :: Pointer -> BigNum -foreign import pointer_certIndexBignum :: Pointer -> BigNum - --- | Pointer class -type PointerClass = - { free :: Pointer -> Effect Unit - -- ^ Free - -- > free self - , new :: Number -> Number -> Number -> Pointer - -- ^ New - -- > new slot txIndex certIndex - , newPointer :: BigNum -> BigNum -> BigNum -> Pointer - -- ^ New pointer - -- > newPointer slot txIndex certIndex - , slot :: Pointer -> Number - -- ^ Slot - -- > slot self - , txIndex :: Pointer -> Number - -- ^ Tx index - -- > txIndex self - , certIndex :: Pointer -> Number - -- ^ Cert index - -- > certIndex self - , slotBignum :: Pointer -> BigNum - -- ^ Slot bignum - -- > slotBignum self - , txIndexBignum :: Pointer -> BigNum - -- ^ Tx index bignum - -- > txIndexBignum self - , certIndexBignum :: Pointer -> BigNum - -- ^ Cert index bignum - -- > certIndexBignum self - } - --- | Pointer class API -pointer :: PointerClass -pointer = - { free: pointer_free - , new: pointer_new - , newPointer: pointer_newPointer - , slot: pointer_slot - , txIndex: pointer_txIndex - , certIndex: pointer_certIndex - , slotBignum: pointer_slotBignum - , txIndexBignum: pointer_txIndexBignum - , certIndexBignum: pointer_certIndexBignum - } - -instance HasFree Pointer where - free = pointer.free - -------------------------------------------------------------------------------------- --- Pointer address - -foreign import pointerAddress_free :: PointerAddress -> Effect Unit -foreign import pointerAddress_new :: Number -> StakeCredential -> Pointer -> PointerAddress -foreign import pointerAddress_paymentCred :: PointerAddress -> StakeCredential -foreign import pointerAddress_stakePointer :: PointerAddress -> Pointer -foreign import pointerAddress_toAddress :: PointerAddress -> Address -foreign import pointerAddress_fromAddress :: Address -> Nullable PointerAddress - --- | Pointer address class -type PointerAddressClass = - { free :: PointerAddress -> Effect Unit - -- ^ Free - -- > free self - , new :: Number -> StakeCredential -> Pointer -> PointerAddress - -- ^ New - -- > new network payment stake - , paymentCred :: PointerAddress -> StakeCredential - -- ^ Payment cred - -- > paymentCred self - , stakePointer :: PointerAddress -> Pointer - -- ^ Stake pointer - -- > stakePointer self - , toAddress :: PointerAddress -> Address - -- ^ To address - -- > toAddress self - , fromAddress :: Address -> Maybe PointerAddress - -- ^ From address - -- > fromAddress addr - } - --- | Pointer address class API -pointerAddress :: PointerAddressClass -pointerAddress = - { free: pointerAddress_free - , new: pointerAddress_new - , paymentCred: pointerAddress_paymentCred - , stakePointer: pointerAddress_stakePointer - , toAddress: pointerAddress_toAddress - , fromAddress: \a1 -> Nullable.toMaybe $ pointerAddress_fromAddress a1 - } - -instance HasFree PointerAddress where - free = pointerAddress.free - -------------------------------------------------------------------------------------- --- Pool metadata - -foreign import poolMetadata_free :: PoolMetadata -> Effect Unit -foreign import poolMetadata_toBytes :: PoolMetadata -> Bytes -foreign import poolMetadata_fromBytes :: Bytes -> ForeignErrorable PoolMetadata -foreign import poolMetadata_toHex :: PoolMetadata -> String -foreign import poolMetadata_fromHex :: String -> ForeignErrorable PoolMetadata -foreign import poolMetadata_toJson :: PoolMetadata -> String -foreign import poolMetadata_toJsValue :: PoolMetadata -> PoolMetadataJson -foreign import poolMetadata_fromJson :: String -> ForeignErrorable PoolMetadata -foreign import poolMetadata_url :: PoolMetadata -> URL -foreign import poolMetadata_poolMetadataHash :: PoolMetadata -> PoolMetadataHash -foreign import poolMetadata_new :: URL -> PoolMetadataHash -> PoolMetadata - --- | Pool metadata class -type PoolMetadataClass = - { free :: PoolMetadata -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: PoolMetadata -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe PoolMetadata - -- ^ From bytes - -- > fromBytes bytes - , toHex :: PoolMetadata -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe PoolMetadata - -- ^ From hex - -- > fromHex hexStr - , toJson :: PoolMetadata -> String - -- ^ To json - -- > toJson self - , toJsValue :: PoolMetadata -> PoolMetadataJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe PoolMetadata - -- ^ From json - -- > fromJson json - , url :: PoolMetadata -> URL - -- ^ Url - -- > url self - , poolMetadataHash :: PoolMetadata -> PoolMetadataHash - -- ^ Pool metadata hash - -- > poolMetadataHash self - , new :: URL -> PoolMetadataHash -> PoolMetadata - -- ^ New - -- > new url poolMetadataHash - } - --- | Pool metadata class API -poolMetadata :: PoolMetadataClass -poolMetadata = - { free: poolMetadata_free - , toBytes: poolMetadata_toBytes - , fromBytes: \a1 -> runForeignMaybe $ poolMetadata_fromBytes a1 - , toHex: poolMetadata_toHex - , fromHex: \a1 -> runForeignMaybe $ poolMetadata_fromHex a1 - , toJson: poolMetadata_toJson - , toJsValue: poolMetadata_toJsValue - , fromJson: \a1 -> runForeignMaybe $ poolMetadata_fromJson a1 - , url: poolMetadata_url - , poolMetadataHash: poolMetadata_poolMetadataHash - , new: poolMetadata_new - } - -instance HasFree PoolMetadata where - free = poolMetadata.free - -instance Show PoolMetadata where - show = poolMetadata.toHex - -instance ToJsValue PoolMetadata where - toJsValue = poolMetadata.toJsValue - -instance IsHex PoolMetadata where - toHex = poolMetadata.toHex - fromHex = poolMetadata.fromHex - -instance IsBytes PoolMetadata where - toBytes = poolMetadata.toBytes - fromBytes = poolMetadata.fromBytes - -instance IsJson PoolMetadata where - toJson = poolMetadata.toJson - fromJson = poolMetadata.fromJson - -------------------------------------------------------------------------------------- --- Pool metadata hash - -foreign import poolMetadataHash_free :: PoolMetadataHash -> Effect Unit -foreign import poolMetadataHash_fromBytes :: Bytes -> ForeignErrorable PoolMetadataHash -foreign import poolMetadataHash_toBytes :: PoolMetadataHash -> Bytes -foreign import poolMetadataHash_toBech32 :: PoolMetadataHash -> String -> String -foreign import poolMetadataHash_fromBech32 :: String -> ForeignErrorable PoolMetadataHash -foreign import poolMetadataHash_toHex :: PoolMetadataHash -> String -foreign import poolMetadataHash_fromHex :: String -> ForeignErrorable PoolMetadataHash - --- | Pool metadata hash class -type PoolMetadataHashClass = - { free :: PoolMetadataHash -> Effect Unit - -- ^ Free - -- > free self - , fromBytes :: Bytes -> Maybe PoolMetadataHash - -- ^ From bytes - -- > fromBytes bytes - , toBytes :: PoolMetadataHash -> Bytes - -- ^ To bytes - -- > toBytes self - , toBech32 :: PoolMetadataHash -> String -> String - -- ^ To bech32 - -- > toBech32 self prefix - , fromBech32 :: String -> Maybe PoolMetadataHash - -- ^ From bech32 - -- > fromBech32 bechStr - , toHex :: PoolMetadataHash -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe PoolMetadataHash - -- ^ From hex - -- > fromHex hex - } - --- | Pool metadata hash class API -poolMetadataHash :: PoolMetadataHashClass -poolMetadataHash = - { free: poolMetadataHash_free - , fromBytes: \a1 -> runForeignMaybe $ poolMetadataHash_fromBytes a1 - , toBytes: poolMetadataHash_toBytes - , toBech32: poolMetadataHash_toBech32 - , fromBech32: \a1 -> runForeignMaybe $ poolMetadataHash_fromBech32 a1 - , toHex: poolMetadataHash_toHex - , fromHex: \a1 -> runForeignMaybe $ poolMetadataHash_fromHex a1 - } - -instance HasFree PoolMetadataHash where - free = poolMetadataHash.free - -instance Show PoolMetadataHash where - show = poolMetadataHash.toHex - -instance IsHex PoolMetadataHash where - toHex = poolMetadataHash.toHex - fromHex = poolMetadataHash.fromHex - -instance IsBytes PoolMetadataHash where - toBytes = poolMetadataHash.toBytes - fromBytes = poolMetadataHash.fromBytes - -------------------------------------------------------------------------------------- --- Pool params - -foreign import poolParams_free :: PoolParams -> Effect Unit -foreign import poolParams_toBytes :: PoolParams -> Bytes -foreign import poolParams_fromBytes :: Bytes -> ForeignErrorable PoolParams -foreign import poolParams_toHex :: PoolParams -> String -foreign import poolParams_fromHex :: String -> ForeignErrorable PoolParams -foreign import poolParams_toJson :: PoolParams -> String -foreign import poolParams_toJsValue :: PoolParams -> PoolParamsJson -foreign import poolParams_fromJson :: String -> ForeignErrorable PoolParams -foreign import poolParams_operator :: PoolParams -> Ed25519KeyHash -foreign import poolParams_vrfKeyhash :: PoolParams -> VRFKeyHash -foreign import poolParams_pledge :: PoolParams -> BigNum -foreign import poolParams_cost :: PoolParams -> BigNum -foreign import poolParams_margin :: PoolParams -> UnitInterval -foreign import poolParams_rewardAccount :: PoolParams -> RewardAddress -foreign import poolParams_poolOwners :: PoolParams -> Ed25519KeyHashes -foreign import poolParams_relays :: PoolParams -> Relays -foreign import poolParams_poolMetadata :: PoolParams -> Nullable PoolMetadata -foreign import poolParams_new :: Ed25519KeyHash -> VRFKeyHash -> BigNum -> BigNum -> UnitInterval -> RewardAddress -> Ed25519KeyHashes -> Relays -> PoolMetadata -> PoolParams - --- | Pool params class -type PoolParamsClass = - { free :: PoolParams -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: PoolParams -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe PoolParams - -- ^ From bytes - -- > fromBytes bytes - , toHex :: PoolParams -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe PoolParams - -- ^ From hex - -- > fromHex hexStr - , toJson :: PoolParams -> String - -- ^ To json - -- > toJson self - , toJsValue :: PoolParams -> PoolParamsJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe PoolParams - -- ^ From json - -- > fromJson json - , operator :: PoolParams -> Ed25519KeyHash - -- ^ Operator - -- > operator self - , vrfKeyhash :: PoolParams -> VRFKeyHash - -- ^ Vrf keyhash - -- > vrfKeyhash self - , pledge :: PoolParams -> BigNum - -- ^ Pledge - -- > pledge self - , cost :: PoolParams -> BigNum - -- ^ Cost - -- > cost self - , margin :: PoolParams -> UnitInterval - -- ^ Margin - -- > margin self - , rewardAccount :: PoolParams -> RewardAddress - -- ^ Reward account - -- > rewardAccount self - , poolOwners :: PoolParams -> Ed25519KeyHashes - -- ^ Pool owners - -- > poolOwners self - , relays :: PoolParams -> Relays - -- ^ Relays - -- > relays self - , poolMetadata :: PoolParams -> Maybe PoolMetadata - -- ^ Pool metadata - -- > poolMetadata self - , new :: Ed25519KeyHash -> VRFKeyHash -> BigNum -> BigNum -> UnitInterval -> RewardAddress -> Ed25519KeyHashes -> Relays -> PoolMetadata -> PoolParams - -- ^ New - -- > new operator vrfKeyhash pledge cost margin rewardAccount poolOwners relays poolMetadata - } - --- | Pool params class API -poolParams :: PoolParamsClass -poolParams = - { free: poolParams_free - , toBytes: poolParams_toBytes - , fromBytes: \a1 -> runForeignMaybe $ poolParams_fromBytes a1 - , toHex: poolParams_toHex - , fromHex: \a1 -> runForeignMaybe $ poolParams_fromHex a1 - , toJson: poolParams_toJson - , toJsValue: poolParams_toJsValue - , fromJson: \a1 -> runForeignMaybe $ poolParams_fromJson a1 - , operator: poolParams_operator - , vrfKeyhash: poolParams_vrfKeyhash - , pledge: poolParams_pledge - , cost: poolParams_cost - , margin: poolParams_margin - , rewardAccount: poolParams_rewardAccount - , poolOwners: poolParams_poolOwners - , relays: poolParams_relays - , poolMetadata: \a1 -> Nullable.toMaybe $ poolParams_poolMetadata a1 - , new: poolParams_new - } - -instance HasFree PoolParams where - free = poolParams.free - -instance Show PoolParams where - show = poolParams.toHex - -instance ToJsValue PoolParams where - toJsValue = poolParams.toJsValue - -instance IsHex PoolParams where - toHex = poolParams.toHex - fromHex = poolParams.fromHex - -instance IsBytes PoolParams where - toBytes = poolParams.toBytes - fromBytes = poolParams.fromBytes - -instance IsJson PoolParams where - toJson = poolParams.toJson - fromJson = poolParams.fromJson - -------------------------------------------------------------------------------------- --- Pool registration - -foreign import poolRegistration_free :: PoolRegistration -> Effect Unit -foreign import poolRegistration_toBytes :: PoolRegistration -> Bytes -foreign import poolRegistration_fromBytes :: Bytes -> ForeignErrorable PoolRegistration -foreign import poolRegistration_toHex :: PoolRegistration -> String -foreign import poolRegistration_fromHex :: String -> ForeignErrorable PoolRegistration -foreign import poolRegistration_toJson :: PoolRegistration -> String -foreign import poolRegistration_toJsValue :: PoolRegistration -> PoolRegistrationJson -foreign import poolRegistration_fromJson :: String -> ForeignErrorable PoolRegistration -foreign import poolRegistration_poolParams :: PoolRegistration -> PoolParams -foreign import poolRegistration_new :: PoolParams -> PoolRegistration - --- | Pool registration class -type PoolRegistrationClass = - { free :: PoolRegistration -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: PoolRegistration -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe PoolRegistration - -- ^ From bytes - -- > fromBytes bytes - , toHex :: PoolRegistration -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe PoolRegistration - -- ^ From hex - -- > fromHex hexStr - , toJson :: PoolRegistration -> String - -- ^ To json - -- > toJson self - , toJsValue :: PoolRegistration -> PoolRegistrationJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe PoolRegistration - -- ^ From json - -- > fromJson json - , poolParams :: PoolRegistration -> PoolParams - -- ^ Pool params - -- > poolParams self - , new :: PoolParams -> PoolRegistration - -- ^ New - -- > new poolParams - } - --- | Pool registration class API -poolRegistration :: PoolRegistrationClass -poolRegistration = - { free: poolRegistration_free - , toBytes: poolRegistration_toBytes - , fromBytes: \a1 -> runForeignMaybe $ poolRegistration_fromBytes a1 - , toHex: poolRegistration_toHex - , fromHex: \a1 -> runForeignMaybe $ poolRegistration_fromHex a1 - , toJson: poolRegistration_toJson - , toJsValue: poolRegistration_toJsValue - , fromJson: \a1 -> runForeignMaybe $ poolRegistration_fromJson a1 - , poolParams: poolRegistration_poolParams - , new: poolRegistration_new - } - -instance HasFree PoolRegistration where - free = poolRegistration.free - -instance Show PoolRegistration where - show = poolRegistration.toHex - -instance ToJsValue PoolRegistration where - toJsValue = poolRegistration.toJsValue - -instance IsHex PoolRegistration where - toHex = poolRegistration.toHex - fromHex = poolRegistration.fromHex - -instance IsBytes PoolRegistration where - toBytes = poolRegistration.toBytes - fromBytes = poolRegistration.fromBytes - -instance IsJson PoolRegistration where - toJson = poolRegistration.toJson - fromJson = poolRegistration.fromJson - -------------------------------------------------------------------------------------- --- Pool retirement - -foreign import poolRetirement_free :: PoolRetirement -> Effect Unit -foreign import poolRetirement_toBytes :: PoolRetirement -> Bytes -foreign import poolRetirement_fromBytes :: Bytes -> ForeignErrorable PoolRetirement -foreign import poolRetirement_toHex :: PoolRetirement -> String -foreign import poolRetirement_fromHex :: String -> ForeignErrorable PoolRetirement -foreign import poolRetirement_toJson :: PoolRetirement -> String -foreign import poolRetirement_toJsValue :: PoolRetirement -> PoolRetirementJson -foreign import poolRetirement_fromJson :: String -> ForeignErrorable PoolRetirement -foreign import poolRetirement_poolKeyhash :: PoolRetirement -> Ed25519KeyHash -foreign import poolRetirement_epoch :: PoolRetirement -> Number -foreign import poolRetirement_new :: Ed25519KeyHash -> Number -> PoolRetirement - --- | Pool retirement class -type PoolRetirementClass = - { free :: PoolRetirement -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: PoolRetirement -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe PoolRetirement - -- ^ From bytes - -- > fromBytes bytes - , toHex :: PoolRetirement -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe PoolRetirement - -- ^ From hex - -- > fromHex hexStr - , toJson :: PoolRetirement -> String - -- ^ To json - -- > toJson self - , toJsValue :: PoolRetirement -> PoolRetirementJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe PoolRetirement - -- ^ From json - -- > fromJson json - , poolKeyhash :: PoolRetirement -> Ed25519KeyHash - -- ^ Pool keyhash - -- > poolKeyhash self - , epoch :: PoolRetirement -> Number - -- ^ Epoch - -- > epoch self - , new :: Ed25519KeyHash -> Number -> PoolRetirement - -- ^ New - -- > new poolKeyhash epoch - } - --- | Pool retirement class API -poolRetirement :: PoolRetirementClass -poolRetirement = - { free: poolRetirement_free - , toBytes: poolRetirement_toBytes - , fromBytes: \a1 -> runForeignMaybe $ poolRetirement_fromBytes a1 - , toHex: poolRetirement_toHex - , fromHex: \a1 -> runForeignMaybe $ poolRetirement_fromHex a1 - , toJson: poolRetirement_toJson - , toJsValue: poolRetirement_toJsValue - , fromJson: \a1 -> runForeignMaybe $ poolRetirement_fromJson a1 - , poolKeyhash: poolRetirement_poolKeyhash - , epoch: poolRetirement_epoch - , new: poolRetirement_new - } - -instance HasFree PoolRetirement where - free = poolRetirement.free - -instance Show PoolRetirement where - show = poolRetirement.toHex - -instance ToJsValue PoolRetirement where - toJsValue = poolRetirement.toJsValue - -instance IsHex PoolRetirement where - toHex = poolRetirement.toHex - fromHex = poolRetirement.fromHex - -instance IsBytes PoolRetirement where - toBytes = poolRetirement.toBytes - fromBytes = poolRetirement.fromBytes - -instance IsJson PoolRetirement where - toJson = poolRetirement.toJson - fromJson = poolRetirement.fromJson - -------------------------------------------------------------------------------------- --- Private key - -foreign import privateKey_free :: PrivateKey -> Effect Unit -foreign import privateKey_toPublic :: PrivateKey -> PublicKey -foreign import privateKey_generateEd25519 :: PrivateKey -foreign import privateKey_generateEd25519extended :: PrivateKey -foreign import privateKey_fromBech32 :: String -> ForeignErrorable PrivateKey -foreign import privateKey_toBech32 :: PrivateKey -> String -foreign import privateKey_asBytes :: PrivateKey -> Bytes -foreign import privateKey_fromExtendedBytes :: Bytes -> PrivateKey -foreign import privateKey_fromNormalBytes :: Bytes -> PrivateKey -foreign import privateKey_sign :: PrivateKey -> Bytes -> Ed25519Signature -foreign import privateKey_toHex :: PrivateKey -> String -foreign import privateKey_fromHex :: String -> ForeignErrorable PrivateKey - --- | Private key class -type PrivateKeyClass = - { free :: PrivateKey -> Effect Unit - -- ^ Free - -- > free self - , toPublic :: PrivateKey -> PublicKey - -- ^ To public - -- > toPublic self - , generateEd25519 :: PrivateKey - -- ^ Generate ed25519 - -- > generateEd25519 - , generateEd25519extended :: PrivateKey - -- ^ Generate ed25519extended - -- > generateEd25519extended - , fromBech32 :: String -> Maybe PrivateKey - -- ^ From bech32 - -- > fromBech32 bech32Str - , toBech32 :: PrivateKey -> String - -- ^ To bech32 - -- > toBech32 self - , asBytes :: PrivateKey -> Bytes - -- ^ As bytes - -- > asBytes self - , fromExtendedBytes :: Bytes -> PrivateKey - -- ^ From extended bytes - -- > fromExtendedBytes bytes - , fromNormalBytes :: Bytes -> PrivateKey - -- ^ From normal bytes - -- > fromNormalBytes bytes - , sign :: PrivateKey -> Bytes -> Ed25519Signature - -- ^ Sign - -- > sign self message - , toHex :: PrivateKey -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe PrivateKey - -- ^ From hex - -- > fromHex hexStr - } - --- | Private key class API -privateKey :: PrivateKeyClass -privateKey = - { free: privateKey_free - , toPublic: privateKey_toPublic - , generateEd25519: privateKey_generateEd25519 - , generateEd25519extended: privateKey_generateEd25519extended - , fromBech32: \a1 -> runForeignMaybe $ privateKey_fromBech32 a1 - , toBech32: privateKey_toBech32 - , asBytes: privateKey_asBytes - , fromExtendedBytes: privateKey_fromExtendedBytes - , fromNormalBytes: privateKey_fromNormalBytes - , sign: privateKey_sign - , toHex: privateKey_toHex - , fromHex: \a1 -> runForeignMaybe $ privateKey_fromHex a1 - } - -instance HasFree PrivateKey where - free = privateKey.free - -instance Show PrivateKey where - show = privateKey.toHex - -instance IsHex PrivateKey where - toHex = privateKey.toHex - fromHex = privateKey.fromHex - -instance IsBech32 PrivateKey where - toBech32 = privateKey.toBech32 - fromBech32 = privateKey.fromBech32 - -------------------------------------------------------------------------------------- --- Proposed protocol parameter updates - -foreign import proposedProtocolParameterUpdates_free :: ProposedProtocolParameterUpdates -> Effect Unit -foreign import proposedProtocolParameterUpdates_toBytes :: ProposedProtocolParameterUpdates -> Bytes -foreign import proposedProtocolParameterUpdates_fromBytes :: Bytes -> ForeignErrorable ProposedProtocolParameterUpdates -foreign import proposedProtocolParameterUpdates_toHex :: ProposedProtocolParameterUpdates -> String -foreign import proposedProtocolParameterUpdates_fromHex :: String -> ForeignErrorable ProposedProtocolParameterUpdates -foreign import proposedProtocolParameterUpdates_toJson :: ProposedProtocolParameterUpdates -> String -foreign import proposedProtocolParameterUpdates_toJsValue :: ProposedProtocolParameterUpdates -> ProposedProtocolParameterUpdatesJson -foreign import proposedProtocolParameterUpdates_fromJson :: String -> ForeignErrorable ProposedProtocolParameterUpdates -foreign import proposedProtocolParameterUpdates_new :: Effect ProposedProtocolParameterUpdates -foreign import proposedProtocolParameterUpdates_len :: ProposedProtocolParameterUpdates -> Effect Int -foreign import proposedProtocolParameterUpdates_insert :: ProposedProtocolParameterUpdates -> GenesisHash -> ProtocolParamUpdate -> Effect ((Nullable ProtocolParamUpdate)) -foreign import proposedProtocolParameterUpdates_get :: ProposedProtocolParameterUpdates -> GenesisHash -> Effect ((Nullable ProtocolParamUpdate)) -foreign import proposedProtocolParameterUpdates_keys :: ProposedProtocolParameterUpdates -> Effect GenesisHashes - --- | Proposed protocol parameter updates class -type ProposedProtocolParameterUpdatesClass = - { free :: ProposedProtocolParameterUpdates -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: ProposedProtocolParameterUpdates -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe ProposedProtocolParameterUpdates - -- ^ From bytes - -- > fromBytes bytes - , toHex :: ProposedProtocolParameterUpdates -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe ProposedProtocolParameterUpdates - -- ^ From hex - -- > fromHex hexStr - , toJson :: ProposedProtocolParameterUpdates -> String - -- ^ To json - -- > toJson self - , toJsValue :: ProposedProtocolParameterUpdates -> ProposedProtocolParameterUpdatesJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe ProposedProtocolParameterUpdates - -- ^ From json - -- > fromJson json - , new :: Effect ProposedProtocolParameterUpdates - -- ^ New - -- > new - , len :: ProposedProtocolParameterUpdates -> Effect Int - -- ^ Len - -- > len self - , insert :: ProposedProtocolParameterUpdates -> GenesisHash -> ProtocolParamUpdate -> Effect ((Maybe ProtocolParamUpdate)) - -- ^ Insert - -- > insert self key value - , get :: ProposedProtocolParameterUpdates -> GenesisHash -> Effect ((Maybe ProtocolParamUpdate)) - -- ^ Get - -- > get self key - , keys :: ProposedProtocolParameterUpdates -> Effect GenesisHashes - -- ^ Keys - -- > keys self - } - --- | Proposed protocol parameter updates class API -proposedProtocolParameterUpdates :: ProposedProtocolParameterUpdatesClass -proposedProtocolParameterUpdates = - { free: proposedProtocolParameterUpdates_free - , toBytes: proposedProtocolParameterUpdates_toBytes - , fromBytes: \a1 -> runForeignMaybe $ proposedProtocolParameterUpdates_fromBytes a1 - , toHex: proposedProtocolParameterUpdates_toHex - , fromHex: \a1 -> runForeignMaybe $ proposedProtocolParameterUpdates_fromHex a1 - , toJson: proposedProtocolParameterUpdates_toJson - , toJsValue: proposedProtocolParameterUpdates_toJsValue - , fromJson: \a1 -> runForeignMaybe $ proposedProtocolParameterUpdates_fromJson a1 - , new: proposedProtocolParameterUpdates_new - , len: proposedProtocolParameterUpdates_len - , insert: \a1 a2 a3 -> Nullable.toMaybe <$> proposedProtocolParameterUpdates_insert a1 a2 a3 - , get: \a1 a2 -> Nullable.toMaybe <$> proposedProtocolParameterUpdates_get a1 a2 - , keys: proposedProtocolParameterUpdates_keys - } - -instance HasFree ProposedProtocolParameterUpdates where - free = proposedProtocolParameterUpdates.free - -instance Show ProposedProtocolParameterUpdates where - show = proposedProtocolParameterUpdates.toHex - -instance ToJsValue ProposedProtocolParameterUpdates where - toJsValue = proposedProtocolParameterUpdates.toJsValue - -instance IsHex ProposedProtocolParameterUpdates where - toHex = proposedProtocolParameterUpdates.toHex - fromHex = proposedProtocolParameterUpdates.fromHex - -instance IsBytes ProposedProtocolParameterUpdates where - toBytes = proposedProtocolParameterUpdates.toBytes - fromBytes = proposedProtocolParameterUpdates.fromBytes - -instance IsJson ProposedProtocolParameterUpdates where - toJson = proposedProtocolParameterUpdates.toJson - fromJson = proposedProtocolParameterUpdates.fromJson - -------------------------------------------------------------------------------------- --- Protocol param update - -foreign import protocolParamUpdate_free :: ProtocolParamUpdate -> Effect Unit -foreign import protocolParamUpdate_toBytes :: ProtocolParamUpdate -> Bytes -foreign import protocolParamUpdate_fromBytes :: Bytes -> ForeignErrorable ProtocolParamUpdate -foreign import protocolParamUpdate_toHex :: ProtocolParamUpdate -> String -foreign import protocolParamUpdate_fromHex :: String -> ForeignErrorable ProtocolParamUpdate -foreign import protocolParamUpdate_toJson :: ProtocolParamUpdate -> String -foreign import protocolParamUpdate_toJsValue :: ProtocolParamUpdate -> ProtocolParamUpdateJson -foreign import protocolParamUpdate_fromJson :: String -> ForeignErrorable ProtocolParamUpdate -foreign import protocolParamUpdate_setMinfeeA :: ProtocolParamUpdate -> BigNum -> Effect Unit -foreign import protocolParamUpdate_minfeeA :: ProtocolParamUpdate -> Nullable BigNum -foreign import protocolParamUpdate_setMinfeeB :: ProtocolParamUpdate -> BigNum -> Effect Unit -foreign import protocolParamUpdate_minfeeB :: ProtocolParamUpdate -> Nullable BigNum -foreign import protocolParamUpdate_setMaxBlockBodySize :: ProtocolParamUpdate -> Number -> Effect Unit -foreign import protocolParamUpdate_maxBlockBodySize :: ProtocolParamUpdate -> Nullable Number -foreign import protocolParamUpdate_setMaxTxSize :: ProtocolParamUpdate -> Number -> Effect Unit -foreign import protocolParamUpdate_maxTxSize :: ProtocolParamUpdate -> Nullable Number -foreign import protocolParamUpdate_setMaxBlockHeaderSize :: ProtocolParamUpdate -> Number -> Effect Unit -foreign import protocolParamUpdate_maxBlockHeaderSize :: ProtocolParamUpdate -> Nullable Number -foreign import protocolParamUpdate_setKeyDeposit :: ProtocolParamUpdate -> BigNum -> Effect Unit -foreign import protocolParamUpdate_keyDeposit :: ProtocolParamUpdate -> Nullable BigNum -foreign import protocolParamUpdate_setPoolDeposit :: ProtocolParamUpdate -> BigNum -> Effect Unit -foreign import protocolParamUpdate_poolDeposit :: ProtocolParamUpdate -> Nullable BigNum -foreign import protocolParamUpdate_setMaxEpoch :: ProtocolParamUpdate -> Number -> Effect Unit -foreign import protocolParamUpdate_maxEpoch :: ProtocolParamUpdate -> Nullable Number -foreign import protocolParamUpdate_setNOpt :: ProtocolParamUpdate -> Number -> Effect Unit -foreign import protocolParamUpdate_nOpt :: ProtocolParamUpdate -> Nullable Number -foreign import protocolParamUpdate_setPoolPledgeInfluence :: ProtocolParamUpdate -> UnitInterval -> Effect Unit -foreign import protocolParamUpdate_poolPledgeInfluence :: ProtocolParamUpdate -> Nullable UnitInterval -foreign import protocolParamUpdate_setExpansionRate :: ProtocolParamUpdate -> UnitInterval -> Effect Unit -foreign import protocolParamUpdate_expansionRate :: ProtocolParamUpdate -> Nullable UnitInterval -foreign import protocolParamUpdate_setTreasuryGrowthRate :: ProtocolParamUpdate -> UnitInterval -> Effect Unit -foreign import protocolParamUpdate_treasuryGrowthRate :: ProtocolParamUpdate -> Nullable UnitInterval -foreign import protocolParamUpdate_d :: ProtocolParamUpdate -> Nullable UnitInterval -foreign import protocolParamUpdate_extraEntropy :: ProtocolParamUpdate -> Nullable Nonce -foreign import protocolParamUpdate_setProtocolVersion :: ProtocolParamUpdate -> ProtocolVersion -> Effect Unit -foreign import protocolParamUpdate_protocolVersion :: ProtocolParamUpdate -> Nullable ProtocolVersion -foreign import protocolParamUpdate_setMinPoolCost :: ProtocolParamUpdate -> BigNum -> Effect Unit -foreign import protocolParamUpdate_minPoolCost :: ProtocolParamUpdate -> Nullable BigNum -foreign import protocolParamUpdate_setAdaPerUtxoByte :: ProtocolParamUpdate -> BigNum -> Effect Unit -foreign import protocolParamUpdate_adaPerUtxoByte :: ProtocolParamUpdate -> Nullable BigNum -foreign import protocolParamUpdate_setCostModels :: ProtocolParamUpdate -> Costmdls -> Effect Unit -foreign import protocolParamUpdate_costModels :: ProtocolParamUpdate -> Nullable Costmdls -foreign import protocolParamUpdate_setExecutionCosts :: ProtocolParamUpdate -> ExUnitPrices -> Effect Unit -foreign import protocolParamUpdate_executionCosts :: ProtocolParamUpdate -> Nullable ExUnitPrices -foreign import protocolParamUpdate_setMaxTxExUnits :: ProtocolParamUpdate -> ExUnits -> Effect Unit -foreign import protocolParamUpdate_maxTxExUnits :: ProtocolParamUpdate -> Nullable ExUnits -foreign import protocolParamUpdate_setMaxBlockExUnits :: ProtocolParamUpdate -> ExUnits -> Effect Unit -foreign import protocolParamUpdate_maxBlockExUnits :: ProtocolParamUpdate -> Nullable ExUnits -foreign import protocolParamUpdate_setMaxValueSize :: ProtocolParamUpdate -> Number -> Effect Unit -foreign import protocolParamUpdate_maxValueSize :: ProtocolParamUpdate -> Nullable Number -foreign import protocolParamUpdate_setCollateralPercentage :: ProtocolParamUpdate -> Number -> Effect Unit -foreign import protocolParamUpdate_collateralPercentage :: ProtocolParamUpdate -> Nullable Number -foreign import protocolParamUpdate_setMaxCollateralIns :: ProtocolParamUpdate -> Number -> Effect Unit -foreign import protocolParamUpdate_maxCollateralIns :: ProtocolParamUpdate -> Nullable Number -foreign import protocolParamUpdate_new :: ProtocolParamUpdate - --- | Protocol param update class -type ProtocolParamUpdateClass = - { free :: ProtocolParamUpdate -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: ProtocolParamUpdate -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe ProtocolParamUpdate - -- ^ From bytes - -- > fromBytes bytes - , toHex :: ProtocolParamUpdate -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe ProtocolParamUpdate - -- ^ From hex - -- > fromHex hexStr - , toJson :: ProtocolParamUpdate -> String - -- ^ To json - -- > toJson self - , toJsValue :: ProtocolParamUpdate -> ProtocolParamUpdateJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe ProtocolParamUpdate - -- ^ From json - -- > fromJson json - , setMinfeeA :: ProtocolParamUpdate -> BigNum -> Effect Unit - -- ^ Set minfee a - -- > setMinfeeA self minfeeA - , minfeeA :: ProtocolParamUpdate -> Maybe BigNum - -- ^ Minfee a - -- > minfeeA self - , setMinfeeB :: ProtocolParamUpdate -> BigNum -> Effect Unit - -- ^ Set minfee b - -- > setMinfeeB self minfeeB - , minfeeB :: ProtocolParamUpdate -> Maybe BigNum - -- ^ Minfee b - -- > minfeeB self - , setMaxBlockBodySize :: ProtocolParamUpdate -> Number -> Effect Unit - -- ^ Set max block body size - -- > setMaxBlockBodySize self maxBlockBodySize - , maxBlockBodySize :: ProtocolParamUpdate -> Maybe Number - -- ^ Max block body size - -- > maxBlockBodySize self - , setMaxTxSize :: ProtocolParamUpdate -> Number -> Effect Unit - -- ^ Set max tx size - -- > setMaxTxSize self maxTxSize - , maxTxSize :: ProtocolParamUpdate -> Maybe Number - -- ^ Max tx size - -- > maxTxSize self - , setMaxBlockHeaderSize :: ProtocolParamUpdate -> Number -> Effect Unit - -- ^ Set max block header size - -- > setMaxBlockHeaderSize self maxBlockHeaderSize - , maxBlockHeaderSize :: ProtocolParamUpdate -> Maybe Number - -- ^ Max block header size - -- > maxBlockHeaderSize self - , setKeyDeposit :: ProtocolParamUpdate -> BigNum -> Effect Unit - -- ^ Set key deposit - -- > setKeyDeposit self keyDeposit - , keyDeposit :: ProtocolParamUpdate -> Maybe BigNum - -- ^ Key deposit - -- > keyDeposit self - , setPoolDeposit :: ProtocolParamUpdate -> BigNum -> Effect Unit - -- ^ Set pool deposit - -- > setPoolDeposit self poolDeposit - , poolDeposit :: ProtocolParamUpdate -> Maybe BigNum - -- ^ Pool deposit - -- > poolDeposit self - , setMaxEpoch :: ProtocolParamUpdate -> Number -> Effect Unit - -- ^ Set max epoch - -- > setMaxEpoch self maxEpoch - , maxEpoch :: ProtocolParamUpdate -> Maybe Number - -- ^ Max epoch - -- > maxEpoch self - , setNOpt :: ProtocolParamUpdate -> Number -> Effect Unit - -- ^ Set n opt - -- > setNOpt self nOpt - , nOpt :: ProtocolParamUpdate -> Maybe Number - -- ^ N opt - -- > nOpt self - , setPoolPledgeInfluence :: ProtocolParamUpdate -> UnitInterval -> Effect Unit - -- ^ Set pool pledge influence - -- > setPoolPledgeInfluence self poolPledgeInfluence - , poolPledgeInfluence :: ProtocolParamUpdate -> Maybe UnitInterval - -- ^ Pool pledge influence - -- > poolPledgeInfluence self - , setExpansionRate :: ProtocolParamUpdate -> UnitInterval -> Effect Unit - -- ^ Set expansion rate - -- > setExpansionRate self expansionRate - , expansionRate :: ProtocolParamUpdate -> Maybe UnitInterval - -- ^ Expansion rate - -- > expansionRate self - , setTreasuryGrowthRate :: ProtocolParamUpdate -> UnitInterval -> Effect Unit - -- ^ Set treasury growth rate - -- > setTreasuryGrowthRate self treasuryGrowthRate - , treasuryGrowthRate :: ProtocolParamUpdate -> Maybe UnitInterval - -- ^ Treasury growth rate - -- > treasuryGrowthRate self - , d :: ProtocolParamUpdate -> Maybe UnitInterval - -- ^ D - -- > d self - , extraEntropy :: ProtocolParamUpdate -> Maybe Nonce - -- ^ Extra entropy - -- > extraEntropy self - , setProtocolVersion :: ProtocolParamUpdate -> ProtocolVersion -> Effect Unit - -- ^ Set protocol version - -- > setProtocolVersion self protocolVersion - , protocolVersion :: ProtocolParamUpdate -> Maybe ProtocolVersion - -- ^ Protocol version - -- > protocolVersion self - , setMinPoolCost :: ProtocolParamUpdate -> BigNum -> Effect Unit - -- ^ Set min pool cost - -- > setMinPoolCost self minPoolCost - , minPoolCost :: ProtocolParamUpdate -> Maybe BigNum - -- ^ Min pool cost - -- > minPoolCost self - , setAdaPerUtxoByte :: ProtocolParamUpdate -> BigNum -> Effect Unit - -- ^ Set ada per utxo byte - -- > setAdaPerUtxoByte self adaPerUtxoByte - , adaPerUtxoByte :: ProtocolParamUpdate -> Maybe BigNum - -- ^ Ada per utxo byte - -- > adaPerUtxoByte self - , setCostModels :: ProtocolParamUpdate -> Costmdls -> Effect Unit - -- ^ Set cost models - -- > setCostModels self costModels - , costModels :: ProtocolParamUpdate -> Maybe Costmdls - -- ^ Cost models - -- > costModels self - , setExecutionCosts :: ProtocolParamUpdate -> ExUnitPrices -> Effect Unit - -- ^ Set execution costs - -- > setExecutionCosts self executionCosts - , executionCosts :: ProtocolParamUpdate -> Maybe ExUnitPrices - -- ^ Execution costs - -- > executionCosts self - , setMaxTxExUnits :: ProtocolParamUpdate -> ExUnits -> Effect Unit - -- ^ Set max tx ex units - -- > setMaxTxExUnits self maxTxExUnits - , maxTxExUnits :: ProtocolParamUpdate -> Maybe ExUnits - -- ^ Max tx ex units - -- > maxTxExUnits self - , setMaxBlockExUnits :: ProtocolParamUpdate -> ExUnits -> Effect Unit - -- ^ Set max block ex units - -- > setMaxBlockExUnits self maxBlockExUnits - , maxBlockExUnits :: ProtocolParamUpdate -> Maybe ExUnits - -- ^ Max block ex units - -- > maxBlockExUnits self - , setMaxValueSize :: ProtocolParamUpdate -> Number -> Effect Unit - -- ^ Set max value size - -- > setMaxValueSize self maxValueSize - , maxValueSize :: ProtocolParamUpdate -> Maybe Number - -- ^ Max value size - -- > maxValueSize self - , setCollateralPercentage :: ProtocolParamUpdate -> Number -> Effect Unit - -- ^ Set collateral percentage - -- > setCollateralPercentage self collateralPercentage - , collateralPercentage :: ProtocolParamUpdate -> Maybe Number - -- ^ Collateral percentage - -- > collateralPercentage self - , setMaxCollateralIns :: ProtocolParamUpdate -> Number -> Effect Unit - -- ^ Set max collateral inputs - -- > setMaxCollateralIns self maxCollateralIns - , maxCollateralIns :: ProtocolParamUpdate -> Maybe Number - -- ^ Max collateral inputs - -- > maxCollateralIns self - , new :: ProtocolParamUpdate - -- ^ New - -- > new - } - --- | Protocol param update class API -protocolParamUpdate :: ProtocolParamUpdateClass -protocolParamUpdate = - { free: protocolParamUpdate_free - , toBytes: protocolParamUpdate_toBytes - , fromBytes: \a1 -> runForeignMaybe $ protocolParamUpdate_fromBytes a1 - , toHex: protocolParamUpdate_toHex - , fromHex: \a1 -> runForeignMaybe $ protocolParamUpdate_fromHex a1 - , toJson: protocolParamUpdate_toJson - , toJsValue: protocolParamUpdate_toJsValue - , fromJson: \a1 -> runForeignMaybe $ protocolParamUpdate_fromJson a1 - , setMinfeeA: protocolParamUpdate_setMinfeeA - , minfeeA: \a1 -> Nullable.toMaybe $ protocolParamUpdate_minfeeA a1 - , setMinfeeB: protocolParamUpdate_setMinfeeB - , minfeeB: \a1 -> Nullable.toMaybe $ protocolParamUpdate_minfeeB a1 - , setMaxBlockBodySize: protocolParamUpdate_setMaxBlockBodySize - , maxBlockBodySize: \a1 -> Nullable.toMaybe $ protocolParamUpdate_maxBlockBodySize a1 - , setMaxTxSize: protocolParamUpdate_setMaxTxSize - , maxTxSize: \a1 -> Nullable.toMaybe $ protocolParamUpdate_maxTxSize a1 - , setMaxBlockHeaderSize: protocolParamUpdate_setMaxBlockHeaderSize - , maxBlockHeaderSize: \a1 -> Nullable.toMaybe $ protocolParamUpdate_maxBlockHeaderSize a1 - , setKeyDeposit: protocolParamUpdate_setKeyDeposit - , keyDeposit: \a1 -> Nullable.toMaybe $ protocolParamUpdate_keyDeposit a1 - , setPoolDeposit: protocolParamUpdate_setPoolDeposit - , poolDeposit: \a1 -> Nullable.toMaybe $ protocolParamUpdate_poolDeposit a1 - , setMaxEpoch: protocolParamUpdate_setMaxEpoch - , maxEpoch: \a1 -> Nullable.toMaybe $ protocolParamUpdate_maxEpoch a1 - , setNOpt: protocolParamUpdate_setNOpt - , nOpt: \a1 -> Nullable.toMaybe $ protocolParamUpdate_nOpt a1 - , setPoolPledgeInfluence: protocolParamUpdate_setPoolPledgeInfluence - , poolPledgeInfluence: \a1 -> Nullable.toMaybe $ protocolParamUpdate_poolPledgeInfluence a1 - , setExpansionRate: protocolParamUpdate_setExpansionRate - , expansionRate: \a1 -> Nullable.toMaybe $ protocolParamUpdate_expansionRate a1 - , setTreasuryGrowthRate: protocolParamUpdate_setTreasuryGrowthRate - , treasuryGrowthRate: \a1 -> Nullable.toMaybe $ protocolParamUpdate_treasuryGrowthRate a1 - , d: \a1 -> Nullable.toMaybe $ protocolParamUpdate_d a1 - , extraEntropy: \a1 -> Nullable.toMaybe $ protocolParamUpdate_extraEntropy a1 - , setProtocolVersion: protocolParamUpdate_setProtocolVersion - , protocolVersion: \a1 -> Nullable.toMaybe $ protocolParamUpdate_protocolVersion a1 - , setMinPoolCost: protocolParamUpdate_setMinPoolCost - , minPoolCost: \a1 -> Nullable.toMaybe $ protocolParamUpdate_minPoolCost a1 - , setAdaPerUtxoByte: protocolParamUpdate_setAdaPerUtxoByte - , adaPerUtxoByte: \a1 -> Nullable.toMaybe $ protocolParamUpdate_adaPerUtxoByte a1 - , setCostModels: protocolParamUpdate_setCostModels - , costModels: \a1 -> Nullable.toMaybe $ protocolParamUpdate_costModels a1 - , setExecutionCosts: protocolParamUpdate_setExecutionCosts - , executionCosts: \a1 -> Nullable.toMaybe $ protocolParamUpdate_executionCosts a1 - , setMaxTxExUnits: protocolParamUpdate_setMaxTxExUnits - , maxTxExUnits: \a1 -> Nullable.toMaybe $ protocolParamUpdate_maxTxExUnits a1 - , setMaxBlockExUnits: protocolParamUpdate_setMaxBlockExUnits - , maxBlockExUnits: \a1 -> Nullable.toMaybe $ protocolParamUpdate_maxBlockExUnits a1 - , setMaxValueSize: protocolParamUpdate_setMaxValueSize - , maxValueSize: \a1 -> Nullable.toMaybe $ protocolParamUpdate_maxValueSize a1 - , setCollateralPercentage: protocolParamUpdate_setCollateralPercentage - , collateralPercentage: \a1 -> Nullable.toMaybe $ protocolParamUpdate_collateralPercentage a1 - , setMaxCollateralIns: protocolParamUpdate_setMaxCollateralIns - , maxCollateralIns: \a1 -> Nullable.toMaybe $ protocolParamUpdate_maxCollateralIns a1 - , new: protocolParamUpdate_new - } - -instance HasFree ProtocolParamUpdate where - free = protocolParamUpdate.free - -instance Show ProtocolParamUpdate where - show = protocolParamUpdate.toHex - -instance ToJsValue ProtocolParamUpdate where - toJsValue = protocolParamUpdate.toJsValue - -instance IsHex ProtocolParamUpdate where - toHex = protocolParamUpdate.toHex - fromHex = protocolParamUpdate.fromHex - -instance IsBytes ProtocolParamUpdate where - toBytes = protocolParamUpdate.toBytes - fromBytes = protocolParamUpdate.fromBytes - -instance IsJson ProtocolParamUpdate where - toJson = protocolParamUpdate.toJson - fromJson = protocolParamUpdate.fromJson - -------------------------------------------------------------------------------------- --- Protocol version - -foreign import protocolVersion_free :: ProtocolVersion -> Effect Unit -foreign import protocolVersion_toBytes :: ProtocolVersion -> Bytes -foreign import protocolVersion_fromBytes :: Bytes -> ForeignErrorable ProtocolVersion -foreign import protocolVersion_toHex :: ProtocolVersion -> String -foreign import protocolVersion_fromHex :: String -> ForeignErrorable ProtocolVersion -foreign import protocolVersion_toJson :: ProtocolVersion -> String -foreign import protocolVersion_toJsValue :: ProtocolVersion -> ProtocolVersionJson -foreign import protocolVersion_fromJson :: String -> ForeignErrorable ProtocolVersion -foreign import protocolVersion_major :: ProtocolVersion -> Number -foreign import protocolVersion_minor :: ProtocolVersion -> Number -foreign import protocolVersion_new :: Number -> Number -> ProtocolVersion - --- | Protocol version class -type ProtocolVersionClass = - { free :: ProtocolVersion -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: ProtocolVersion -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe ProtocolVersion - -- ^ From bytes - -- > fromBytes bytes - , toHex :: ProtocolVersion -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe ProtocolVersion - -- ^ From hex - -- > fromHex hexStr - , toJson :: ProtocolVersion -> String - -- ^ To json - -- > toJson self - , toJsValue :: ProtocolVersion -> ProtocolVersionJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe ProtocolVersion - -- ^ From json - -- > fromJson json - , major :: ProtocolVersion -> Number - -- ^ Major - -- > major self - , minor :: ProtocolVersion -> Number - -- ^ Minor - -- > minor self - , new :: Number -> Number -> ProtocolVersion - -- ^ New - -- > new major minor - } - --- | Protocol version class API -protocolVersion :: ProtocolVersionClass -protocolVersion = - { free: protocolVersion_free - , toBytes: protocolVersion_toBytes - , fromBytes: \a1 -> runForeignMaybe $ protocolVersion_fromBytes a1 - , toHex: protocolVersion_toHex - , fromHex: \a1 -> runForeignMaybe $ protocolVersion_fromHex a1 - , toJson: protocolVersion_toJson - , toJsValue: protocolVersion_toJsValue - , fromJson: \a1 -> runForeignMaybe $ protocolVersion_fromJson a1 - , major: protocolVersion_major - , minor: protocolVersion_minor - , new: protocolVersion_new - } - -instance HasFree ProtocolVersion where - free = protocolVersion.free - -instance Show ProtocolVersion where - show = protocolVersion.toHex - -instance ToJsValue ProtocolVersion where - toJsValue = protocolVersion.toJsValue - -instance IsHex ProtocolVersion where - toHex = protocolVersion.toHex - fromHex = protocolVersion.fromHex - -instance IsBytes ProtocolVersion where - toBytes = protocolVersion.toBytes - fromBytes = protocolVersion.fromBytes - -instance IsJson ProtocolVersion where - toJson = protocolVersion.toJson - fromJson = protocolVersion.fromJson - -------------------------------------------------------------------------------------- --- Public key - -foreign import publicKey_free :: PublicKey -> Effect Unit -foreign import publicKey_fromBech32 :: String -> ForeignErrorable PublicKey -foreign import publicKey_toBech32 :: PublicKey -> String -foreign import publicKey_asBytes :: PublicKey -> Bytes -foreign import publicKey_fromBytes :: Bytes -> ForeignErrorable PublicKey -foreign import publicKey_verify :: PublicKey -> Bytes -> Ed25519Signature -> Boolean -foreign import publicKey_hash :: PublicKey -> Ed25519KeyHash -foreign import publicKey_toHex :: PublicKey -> String -foreign import publicKey_fromHex :: String -> ForeignErrorable PublicKey - --- | Public key class -type PublicKeyClass = - { free :: PublicKey -> Effect Unit - -- ^ Free - -- > free self - , fromBech32 :: String -> Maybe PublicKey - -- ^ From bech32 - -- > fromBech32 bech32Str - , toBech32 :: PublicKey -> String - -- ^ To bech32 - -- > toBech32 self - , asBytes :: PublicKey -> Bytes - -- ^ As bytes - -- > asBytes self - , fromBytes :: Bytes -> Maybe PublicKey - -- ^ From bytes - -- > fromBytes bytes - , verify :: PublicKey -> Bytes -> Ed25519Signature -> Boolean - -- ^ Verify - -- > verify self data signature - , hash :: PublicKey -> Ed25519KeyHash - -- ^ Hash - -- > hash self - , toHex :: PublicKey -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe PublicKey - -- ^ From hex - -- > fromHex hexStr - } - --- | Public key class API -publicKey :: PublicKeyClass -publicKey = - { free: publicKey_free - , fromBech32: \a1 -> runForeignMaybe $ publicKey_fromBech32 a1 - , toBech32: publicKey_toBech32 - , asBytes: publicKey_asBytes - , fromBytes: \a1 -> runForeignMaybe $ publicKey_fromBytes a1 - , verify: publicKey_verify - , hash: publicKey_hash - , toHex: publicKey_toHex - , fromHex: \a1 -> runForeignMaybe $ publicKey_fromHex a1 - } - -instance HasFree PublicKey where - free = publicKey.free - -instance Show PublicKey where - show = publicKey.toHex - -instance IsHex PublicKey where - toHex = publicKey.toHex - fromHex = publicKey.fromHex - -instance IsBech32 PublicKey where - toBech32 = publicKey.toBech32 - fromBech32 = publicKey.fromBech32 - -------------------------------------------------------------------------------------- --- Public keys - -foreign import publicKeys_free :: PublicKeys -> Effect Unit -foreign import publicKeys_constructor :: PublicKeys -> This -foreign import publicKeys_size :: PublicKeys -> Number -foreign import publicKeys_get :: PublicKeys -> Number -> PublicKey -foreign import publicKeys_add :: PublicKeys -> PublicKey -> Effect Unit - --- | Public keys class -type PublicKeysClass = - { free :: PublicKeys -> Effect Unit - -- ^ Free - -- > free self - , constructor :: PublicKeys -> This - -- ^ Constructor - -- > constructor self - , size :: PublicKeys -> Number - -- ^ Size - -- > size self - , get :: PublicKeys -> Number -> PublicKey - -- ^ Get - -- > get self index - , add :: PublicKeys -> PublicKey -> Effect Unit - -- ^ Add - -- > add self key - } - --- | Public keys class API -publicKeys :: PublicKeysClass -publicKeys = - { free: publicKeys_free - , constructor: publicKeys_constructor - , size: publicKeys_size - , get: publicKeys_get - , add: publicKeys_add - } - -instance HasFree PublicKeys where - free = publicKeys.free - -------------------------------------------------------------------------------------- --- Redeemer - -foreign import redeemer_free :: Redeemer -> Effect Unit -foreign import redeemer_toBytes :: Redeemer -> Bytes -foreign import redeemer_fromBytes :: Bytes -> ForeignErrorable Redeemer -foreign import redeemer_toHex :: Redeemer -> String -foreign import redeemer_fromHex :: String -> ForeignErrorable Redeemer -foreign import redeemer_toJson :: Redeemer -> String -foreign import redeemer_toJsValue :: Redeemer -> RedeemerJson -foreign import redeemer_fromJson :: String -> ForeignErrorable Redeemer -foreign import redeemer_tag :: Redeemer -> RedeemerTag -foreign import redeemer_index :: Redeemer -> BigNum -foreign import redeemer_data :: Redeemer -> PlutusData -foreign import redeemer_exUnits :: Redeemer -> ExUnits -foreign import redeemer_new :: RedeemerTag -> BigNum -> PlutusData -> ExUnits -> Redeemer - --- | Redeemer class -type RedeemerClass = - { free :: Redeemer -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: Redeemer -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe Redeemer - -- ^ From bytes - -- > fromBytes bytes - , toHex :: Redeemer -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe Redeemer - -- ^ From hex - -- > fromHex hexStr - , toJson :: Redeemer -> String - -- ^ To json - -- > toJson self - , toJsValue :: Redeemer -> RedeemerJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe Redeemer - -- ^ From json - -- > fromJson json - , tag :: Redeemer -> RedeemerTag - -- ^ Tag - -- > tag self - , index :: Redeemer -> BigNum - -- ^ Index - -- > index self - , data :: Redeemer -> PlutusData - -- ^ Data - -- > data self - , exUnits :: Redeemer -> ExUnits - -- ^ Ex units - -- > exUnits self - , new :: RedeemerTag -> BigNum -> PlutusData -> ExUnits -> Redeemer - -- ^ New - -- > new tag index data exUnits - } - --- | Redeemer class API -redeemer :: RedeemerClass -redeemer = - { free: redeemer_free - , toBytes: redeemer_toBytes - , fromBytes: \a1 -> runForeignMaybe $ redeemer_fromBytes a1 - , toHex: redeemer_toHex - , fromHex: \a1 -> runForeignMaybe $ redeemer_fromHex a1 - , toJson: redeemer_toJson - , toJsValue: redeemer_toJsValue - , fromJson: \a1 -> runForeignMaybe $ redeemer_fromJson a1 - , tag: redeemer_tag - , index: redeemer_index - , data: redeemer_data - , exUnits: redeemer_exUnits - , new: redeemer_new - } - -instance HasFree Redeemer where - free = redeemer.free - -instance Show Redeemer where - show = redeemer.toHex - -instance ToJsValue Redeemer where - toJsValue = redeemer.toJsValue - -instance IsHex Redeemer where - toHex = redeemer.toHex - fromHex = redeemer.fromHex - -instance IsBytes Redeemer where - toBytes = redeemer.toBytes - fromBytes = redeemer.fromBytes - -instance IsJson Redeemer where - toJson = redeemer.toJson - fromJson = redeemer.fromJson - -------------------------------------------------------------------------------------- --- Redeemer tag - -foreign import redeemerTag_free :: RedeemerTag -> Effect Unit -foreign import redeemerTag_toBytes :: RedeemerTag -> Bytes -foreign import redeemerTag_fromBytes :: Bytes -> ForeignErrorable RedeemerTag -foreign import redeemerTag_toHex :: RedeemerTag -> String -foreign import redeemerTag_fromHex :: String -> ForeignErrorable RedeemerTag -foreign import redeemerTag_toJson :: RedeemerTag -> String -foreign import redeemerTag_toJsValue :: RedeemerTag -> RedeemerTagJson -foreign import redeemerTag_fromJson :: String -> ForeignErrorable RedeemerTag -foreign import redeemerTag_newSpend :: RedeemerTag -foreign import redeemerTag_newMint :: RedeemerTag -foreign import redeemerTag_newCert :: RedeemerTag -foreign import redeemerTag_newReward :: RedeemerTag -foreign import redeemerTag_kind :: RedeemerTag -> Number - --- | Redeemer tag class -type RedeemerTagClass = - { free :: RedeemerTag -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: RedeemerTag -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe RedeemerTag - -- ^ From bytes - -- > fromBytes bytes - , toHex :: RedeemerTag -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe RedeemerTag - -- ^ From hex - -- > fromHex hexStr - , toJson :: RedeemerTag -> String - -- ^ To json - -- > toJson self - , toJsValue :: RedeemerTag -> RedeemerTagJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe RedeemerTag - -- ^ From json - -- > fromJson json - , newSpend :: RedeemerTag - -- ^ New spend - -- > newSpend - , newMint :: RedeemerTag - -- ^ New mint - -- > newMint - , newCert :: RedeemerTag - -- ^ New cert - -- > newCert - , newReward :: RedeemerTag - -- ^ New reward - -- > newReward - , kind :: RedeemerTag -> Number - -- ^ Kind - -- > kind self - } - --- | Redeemer tag class API -redeemerTag :: RedeemerTagClass -redeemerTag = - { free: redeemerTag_free - , toBytes: redeemerTag_toBytes - , fromBytes: \a1 -> runForeignMaybe $ redeemerTag_fromBytes a1 - , toHex: redeemerTag_toHex - , fromHex: \a1 -> runForeignMaybe $ redeemerTag_fromHex a1 - , toJson: redeemerTag_toJson - , toJsValue: redeemerTag_toJsValue - , fromJson: \a1 -> runForeignMaybe $ redeemerTag_fromJson a1 - , newSpend: redeemerTag_newSpend - , newMint: redeemerTag_newMint - , newCert: redeemerTag_newCert - , newReward: redeemerTag_newReward - , kind: redeemerTag_kind - } - -instance HasFree RedeemerTag where - free = redeemerTag.free - -instance Show RedeemerTag where - show = redeemerTag.toHex - -instance ToJsValue RedeemerTag where - toJsValue = redeemerTag.toJsValue - -instance IsHex RedeemerTag where - toHex = redeemerTag.toHex - fromHex = redeemerTag.fromHex - -instance IsBytes RedeemerTag where - toBytes = redeemerTag.toBytes - fromBytes = redeemerTag.fromBytes - -instance IsJson RedeemerTag where - toJson = redeemerTag.toJson - fromJson = redeemerTag.fromJson - -------------------------------------------------------------------------------------- --- Redeemers - -foreign import redeemers_free :: Redeemers -> Effect Unit -foreign import redeemers_toBytes :: Redeemers -> Bytes -foreign import redeemers_fromBytes :: Bytes -> ForeignErrorable Redeemers -foreign import redeemers_toHex :: Redeemers -> String -foreign import redeemers_fromHex :: String -> ForeignErrorable Redeemers -foreign import redeemers_toJson :: Redeemers -> String -foreign import redeemers_toJsValue :: Redeemers -> RedeemersJson -foreign import redeemers_fromJson :: String -> ForeignErrorable Redeemers -foreign import redeemers_new :: Effect Redeemers -foreign import redeemers_len :: Redeemers -> Effect Int -foreign import redeemers_get :: Redeemers -> Int -> Effect Redeemer -foreign import redeemers_add :: Redeemers -> Redeemer -> Effect Unit -foreign import redeemers_totalExUnits :: Redeemers -> ExUnits - --- | Redeemers class -type RedeemersClass = - { free :: Redeemers -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: Redeemers -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe Redeemers - -- ^ From bytes - -- > fromBytes bytes - , toHex :: Redeemers -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe Redeemers - -- ^ From hex - -- > fromHex hexStr - , toJson :: Redeemers -> String - -- ^ To json - -- > toJson self - , toJsValue :: Redeemers -> RedeemersJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe Redeemers - -- ^ From json - -- > fromJson json - , new :: Effect Redeemers - -- ^ New - -- > new - , len :: Redeemers -> Effect Int - -- ^ Len - -- > len self - , get :: Redeemers -> Int -> Effect Redeemer - -- ^ Get - -- > get self index - , add :: Redeemers -> Redeemer -> Effect Unit - -- ^ Add - -- > add self elem - , totalExUnits :: Redeemers -> ExUnits - -- ^ Total ex units - -- > totalExUnits self - } - --- | Redeemers class API -redeemers :: RedeemersClass -redeemers = - { free: redeemers_free - , toBytes: redeemers_toBytes - , fromBytes: \a1 -> runForeignMaybe $ redeemers_fromBytes a1 - , toHex: redeemers_toHex - , fromHex: \a1 -> runForeignMaybe $ redeemers_fromHex a1 - , toJson: redeemers_toJson - , toJsValue: redeemers_toJsValue - , fromJson: \a1 -> runForeignMaybe $ redeemers_fromJson a1 - , new: redeemers_new - , len: redeemers_len - , get: redeemers_get - , add: redeemers_add - , totalExUnits: redeemers_totalExUnits - } - -instance HasFree Redeemers where - free = redeemers.free - -instance Show Redeemers where - show = redeemers.toHex - -instance MutableList Redeemers Redeemer where - addItem = redeemers.add - getItem = redeemers.get - emptyList = redeemers.new - -instance MutableLen Redeemers where - getLen = redeemers.len - - -instance ToJsValue Redeemers where - toJsValue = redeemers.toJsValue - -instance IsHex Redeemers where - toHex = redeemers.toHex - fromHex = redeemers.fromHex - -instance IsBytes Redeemers where - toBytes = redeemers.toBytes - fromBytes = redeemers.fromBytes - -instance IsJson Redeemers where - toJson = redeemers.toJson - fromJson = redeemers.fromJson - -------------------------------------------------------------------------------------- --- Relay - -foreign import relay_free :: Relay -> Effect Unit -foreign import relay_toBytes :: Relay -> Bytes -foreign import relay_fromBytes :: Bytes -> ForeignErrorable Relay -foreign import relay_toHex :: Relay -> String -foreign import relay_fromHex :: String -> ForeignErrorable Relay -foreign import relay_toJson :: Relay -> String -foreign import relay_toJsValue :: Relay -> RelayJson -foreign import relay_fromJson :: String -> ForeignErrorable Relay -foreign import relay_newSingleHostAddr :: SingleHostAddr -> Relay -foreign import relay_newSingleHostName :: SingleHostName -> Relay -foreign import relay_newMultiHostName :: MultiHostName -> Relay -foreign import relay_kind :: Relay -> Number -foreign import relay_asSingleHostAddr :: Relay -> Nullable SingleHostAddr -foreign import relay_asSingleHostName :: Relay -> Nullable SingleHostName -foreign import relay_asMultiHostName :: Relay -> Nullable MultiHostName - --- | Relay class -type RelayClass = - { free :: Relay -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: Relay -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe Relay - -- ^ From bytes - -- > fromBytes bytes - , toHex :: Relay -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe Relay - -- ^ From hex - -- > fromHex hexStr - , toJson :: Relay -> String - -- ^ To json - -- > toJson self - , toJsValue :: Relay -> RelayJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe Relay - -- ^ From json - -- > fromJson json - , newSingleHostAddr :: SingleHostAddr -> Relay - -- ^ New single host addr - -- > newSingleHostAddr singleHostAddr - , newSingleHostName :: SingleHostName -> Relay - -- ^ New single host name - -- > newSingleHostName singleHostName - , newMultiHostName :: MultiHostName -> Relay - -- ^ New multi host name - -- > newMultiHostName multiHostName - , kind :: Relay -> Number - -- ^ Kind - -- > kind self - , asSingleHostAddr :: Relay -> Maybe SingleHostAddr - -- ^ As single host addr - -- > asSingleHostAddr self - , asSingleHostName :: Relay -> Maybe SingleHostName - -- ^ As single host name - -- > asSingleHostName self - , asMultiHostName :: Relay -> Maybe MultiHostName - -- ^ As multi host name - -- > asMultiHostName self - } - --- | Relay class API -relay :: RelayClass -relay = - { free: relay_free - , toBytes: relay_toBytes - , fromBytes: \a1 -> runForeignMaybe $ relay_fromBytes a1 - , toHex: relay_toHex - , fromHex: \a1 -> runForeignMaybe $ relay_fromHex a1 - , toJson: relay_toJson - , toJsValue: relay_toJsValue - , fromJson: \a1 -> runForeignMaybe $ relay_fromJson a1 - , newSingleHostAddr: relay_newSingleHostAddr - , newSingleHostName: relay_newSingleHostName - , newMultiHostName: relay_newMultiHostName - , kind: relay_kind - , asSingleHostAddr: \a1 -> Nullable.toMaybe $ relay_asSingleHostAddr a1 - , asSingleHostName: \a1 -> Nullable.toMaybe $ relay_asSingleHostName a1 - , asMultiHostName: \a1 -> Nullable.toMaybe $ relay_asMultiHostName a1 - } - -instance HasFree Relay where - free = relay.free - -instance Show Relay where - show = relay.toHex - -instance ToJsValue Relay where - toJsValue = relay.toJsValue - -instance IsHex Relay where - toHex = relay.toHex - fromHex = relay.fromHex - -instance IsBytes Relay where - toBytes = relay.toBytes - fromBytes = relay.fromBytes - -instance IsJson Relay where - toJson = relay.toJson - fromJson = relay.fromJson - -------------------------------------------------------------------------------------- --- Relays - -foreign import relays_free :: Relays -> Effect Unit -foreign import relays_toBytes :: Relays -> Bytes -foreign import relays_fromBytes :: Bytes -> ForeignErrorable Relays -foreign import relays_toHex :: Relays -> String -foreign import relays_fromHex :: String -> ForeignErrorable Relays -foreign import relays_toJson :: Relays -> String -foreign import relays_toJsValue :: Relays -> RelaysJson -foreign import relays_fromJson :: String -> ForeignErrorable Relays -foreign import relays_new :: Effect Relays -foreign import relays_len :: Relays -> Effect Int -foreign import relays_get :: Relays -> Int -> Effect Relay -foreign import relays_add :: Relays -> Relay -> Effect Unit - --- | Relays class -type RelaysClass = - { free :: Relays -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: Relays -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe Relays - -- ^ From bytes - -- > fromBytes bytes - , toHex :: Relays -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe Relays - -- ^ From hex - -- > fromHex hexStr - , toJson :: Relays -> String - -- ^ To json - -- > toJson self - , toJsValue :: Relays -> RelaysJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe Relays - -- ^ From json - -- > fromJson json - , new :: Effect Relays - -- ^ New - -- > new - , len :: Relays -> Effect Int - -- ^ Len - -- > len self - , get :: Relays -> Int -> Effect Relay - -- ^ Get - -- > get self index - , add :: Relays -> Relay -> Effect Unit - -- ^ Add - -- > add self elem - } - --- | Relays class API -relays :: RelaysClass -relays = - { free: relays_free - , toBytes: relays_toBytes - , fromBytes: \a1 -> runForeignMaybe $ relays_fromBytes a1 - , toHex: relays_toHex - , fromHex: \a1 -> runForeignMaybe $ relays_fromHex a1 - , toJson: relays_toJson - , toJsValue: relays_toJsValue - , fromJson: \a1 -> runForeignMaybe $ relays_fromJson a1 - , new: relays_new - , len: relays_len - , get: relays_get - , add: relays_add - } - -instance HasFree Relays where - free = relays.free - -instance Show Relays where - show = relays.toHex - -instance MutableList Relays Relay where - addItem = relays.add - getItem = relays.get - emptyList = relays.new - -instance MutableLen Relays where - getLen = relays.len - - -instance ToJsValue Relays where - toJsValue = relays.toJsValue - -instance IsHex Relays where - toHex = relays.toHex - fromHex = relays.fromHex - -instance IsBytes Relays where - toBytes = relays.toBytes - fromBytes = relays.fromBytes - -instance IsJson Relays where - toJson = relays.toJson - fromJson = relays.fromJson - -------------------------------------------------------------------------------------- --- Reward address - -foreign import rewardAddress_free :: RewardAddress -> Effect Unit -foreign import rewardAddress_new :: Number -> StakeCredential -> RewardAddress -foreign import rewardAddress_paymentCred :: RewardAddress -> StakeCredential -foreign import rewardAddress_toAddress :: RewardAddress -> Address -foreign import rewardAddress_fromAddress :: Address -> Nullable RewardAddress - --- | Reward address class -type RewardAddressClass = - { free :: RewardAddress -> Effect Unit - -- ^ Free - -- > free self - , new :: Number -> StakeCredential -> RewardAddress - -- ^ New - -- > new network payment - , paymentCred :: RewardAddress -> StakeCredential - -- ^ Payment cred - -- > paymentCred self - , toAddress :: RewardAddress -> Address - -- ^ To address - -- > toAddress self - , fromAddress :: Address -> Maybe RewardAddress - -- ^ From address - -- > fromAddress addr - } - --- | Reward address class API -rewardAddress :: RewardAddressClass -rewardAddress = - { free: rewardAddress_free - , new: rewardAddress_new - , paymentCred: rewardAddress_paymentCred - , toAddress: rewardAddress_toAddress - , fromAddress: \a1 -> Nullable.toMaybe $ rewardAddress_fromAddress a1 - } - -instance HasFree RewardAddress where - free = rewardAddress.free - -------------------------------------------------------------------------------------- --- Reward addresses - -foreign import rewardAddresses_free :: RewardAddresses -> Effect Unit -foreign import rewardAddresses_toBytes :: RewardAddresses -> Bytes -foreign import rewardAddresses_fromBytes :: Bytes -> ForeignErrorable RewardAddresses -foreign import rewardAddresses_toHex :: RewardAddresses -> String -foreign import rewardAddresses_fromHex :: String -> ForeignErrorable RewardAddresses -foreign import rewardAddresses_toJson :: RewardAddresses -> String -foreign import rewardAddresses_toJsValue :: RewardAddresses -> RewardAddressesJson -foreign import rewardAddresses_fromJson :: String -> ForeignErrorable RewardAddresses -foreign import rewardAddresses_new :: Effect RewardAddresses -foreign import rewardAddresses_len :: RewardAddresses -> Effect Int -foreign import rewardAddresses_get :: RewardAddresses -> Int -> Effect RewardAddress -foreign import rewardAddresses_add :: RewardAddresses -> RewardAddress -> Effect Unit - --- | Reward addresses class -type RewardAddressesClass = - { free :: RewardAddresses -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: RewardAddresses -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe RewardAddresses - -- ^ From bytes - -- > fromBytes bytes - , toHex :: RewardAddresses -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe RewardAddresses - -- ^ From hex - -- > fromHex hexStr - , toJson :: RewardAddresses -> String - -- ^ To json - -- > toJson self - , toJsValue :: RewardAddresses -> RewardAddressesJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe RewardAddresses - -- ^ From json - -- > fromJson json - , new :: Effect RewardAddresses - -- ^ New - -- > new - , len :: RewardAddresses -> Effect Int - -- ^ Len - -- > len self - , get :: RewardAddresses -> Int -> Effect RewardAddress - -- ^ Get - -- > get self index - , add :: RewardAddresses -> RewardAddress -> Effect Unit - -- ^ Add - -- > add self elem - } - --- | Reward addresses class API -rewardAddresses :: RewardAddressesClass -rewardAddresses = - { free: rewardAddresses_free - , toBytes: rewardAddresses_toBytes - , fromBytes: \a1 -> runForeignMaybe $ rewardAddresses_fromBytes a1 - , toHex: rewardAddresses_toHex - , fromHex: \a1 -> runForeignMaybe $ rewardAddresses_fromHex a1 - , toJson: rewardAddresses_toJson - , toJsValue: rewardAddresses_toJsValue - , fromJson: \a1 -> runForeignMaybe $ rewardAddresses_fromJson a1 - , new: rewardAddresses_new - , len: rewardAddresses_len - , get: rewardAddresses_get - , add: rewardAddresses_add - } - -instance HasFree RewardAddresses where - free = rewardAddresses.free - -instance Show RewardAddresses where - show = rewardAddresses.toHex - -instance MutableList RewardAddresses RewardAddress where - addItem = rewardAddresses.add - getItem = rewardAddresses.get - emptyList = rewardAddresses.new - -instance MutableLen RewardAddresses where - getLen = rewardAddresses.len - - -instance ToJsValue RewardAddresses where - toJsValue = rewardAddresses.toJsValue - -instance IsHex RewardAddresses where - toHex = rewardAddresses.toHex - fromHex = rewardAddresses.fromHex - -instance IsBytes RewardAddresses where - toBytes = rewardAddresses.toBytes - fromBytes = rewardAddresses.fromBytes - -instance IsJson RewardAddresses where - toJson = rewardAddresses.toJson - fromJson = rewardAddresses.fromJson - -------------------------------------------------------------------------------------- --- Script all - -foreign import scriptAll_free :: ScriptAll -> Effect Unit -foreign import scriptAll_toBytes :: ScriptAll -> Bytes -foreign import scriptAll_fromBytes :: Bytes -> ForeignErrorable ScriptAll -foreign import scriptAll_toHex :: ScriptAll -> String -foreign import scriptAll_fromHex :: String -> ForeignErrorable ScriptAll -foreign import scriptAll_toJson :: ScriptAll -> String -foreign import scriptAll_toJsValue :: ScriptAll -> ScriptAllJson -foreign import scriptAll_fromJson :: String -> ForeignErrorable ScriptAll -foreign import scriptAll_nativeScripts :: ScriptAll -> NativeScripts -foreign import scriptAll_new :: NativeScripts -> ScriptAll - --- | Script all class -type ScriptAllClass = - { free :: ScriptAll -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: ScriptAll -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe ScriptAll - -- ^ From bytes - -- > fromBytes bytes - , toHex :: ScriptAll -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe ScriptAll - -- ^ From hex - -- > fromHex hexStr - , toJson :: ScriptAll -> String - -- ^ To json - -- > toJson self - , toJsValue :: ScriptAll -> ScriptAllJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe ScriptAll - -- ^ From json - -- > fromJson json - , nativeScripts :: ScriptAll -> NativeScripts - -- ^ Native scripts - -- > nativeScripts self - , new :: NativeScripts -> ScriptAll - -- ^ New - -- > new nativeScripts - } - --- | Script all class API -scriptAll :: ScriptAllClass -scriptAll = - { free: scriptAll_free - , toBytes: scriptAll_toBytes - , fromBytes: \a1 -> runForeignMaybe $ scriptAll_fromBytes a1 - , toHex: scriptAll_toHex - , fromHex: \a1 -> runForeignMaybe $ scriptAll_fromHex a1 - , toJson: scriptAll_toJson - , toJsValue: scriptAll_toJsValue - , fromJson: \a1 -> runForeignMaybe $ scriptAll_fromJson a1 - , nativeScripts: scriptAll_nativeScripts - , new: scriptAll_new - } - -instance HasFree ScriptAll where - free = scriptAll.free - -instance Show ScriptAll where - show = scriptAll.toHex - -instance ToJsValue ScriptAll where - toJsValue = scriptAll.toJsValue - -instance IsHex ScriptAll where - toHex = scriptAll.toHex - fromHex = scriptAll.fromHex - -instance IsBytes ScriptAll where - toBytes = scriptAll.toBytes - fromBytes = scriptAll.fromBytes - -instance IsJson ScriptAll where - toJson = scriptAll.toJson - fromJson = scriptAll.fromJson - -------------------------------------------------------------------------------------- --- Script any - -foreign import scriptAny_free :: ScriptAny -> Effect Unit -foreign import scriptAny_toBytes :: ScriptAny -> Bytes -foreign import scriptAny_fromBytes :: Bytes -> ForeignErrorable ScriptAny -foreign import scriptAny_toHex :: ScriptAny -> String -foreign import scriptAny_fromHex :: String -> ForeignErrorable ScriptAny -foreign import scriptAny_toJson :: ScriptAny -> String -foreign import scriptAny_toJsValue :: ScriptAny -> ScriptAnyJson -foreign import scriptAny_fromJson :: String -> ForeignErrorable ScriptAny -foreign import scriptAny_nativeScripts :: ScriptAny -> NativeScripts -foreign import scriptAny_new :: NativeScripts -> ScriptAny - --- | Script any class -type ScriptAnyClass = - { free :: ScriptAny -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: ScriptAny -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe ScriptAny - -- ^ From bytes - -- > fromBytes bytes - , toHex :: ScriptAny -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe ScriptAny - -- ^ From hex - -- > fromHex hexStr - , toJson :: ScriptAny -> String - -- ^ To json - -- > toJson self - , toJsValue :: ScriptAny -> ScriptAnyJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe ScriptAny - -- ^ From json - -- > fromJson json - , nativeScripts :: ScriptAny -> NativeScripts - -- ^ Native scripts - -- > nativeScripts self - , new :: NativeScripts -> ScriptAny - -- ^ New - -- > new nativeScripts - } - --- | Script any class API -scriptAny :: ScriptAnyClass -scriptAny = - { free: scriptAny_free - , toBytes: scriptAny_toBytes - , fromBytes: \a1 -> runForeignMaybe $ scriptAny_fromBytes a1 - , toHex: scriptAny_toHex - , fromHex: \a1 -> runForeignMaybe $ scriptAny_fromHex a1 - , toJson: scriptAny_toJson - , toJsValue: scriptAny_toJsValue - , fromJson: \a1 -> runForeignMaybe $ scriptAny_fromJson a1 - , nativeScripts: scriptAny_nativeScripts - , new: scriptAny_new - } - -instance HasFree ScriptAny where - free = scriptAny.free - -instance Show ScriptAny where - show = scriptAny.toHex - -instance ToJsValue ScriptAny where - toJsValue = scriptAny.toJsValue - -instance IsHex ScriptAny where - toHex = scriptAny.toHex - fromHex = scriptAny.fromHex - -instance IsBytes ScriptAny where - toBytes = scriptAny.toBytes - fromBytes = scriptAny.fromBytes - -instance IsJson ScriptAny where - toJson = scriptAny.toJson - fromJson = scriptAny.fromJson - -------------------------------------------------------------------------------------- --- Script data hash - -foreign import scriptDataHash_free :: ScriptDataHash -> Effect Unit -foreign import scriptDataHash_fromBytes :: Bytes -> ForeignErrorable ScriptDataHash -foreign import scriptDataHash_toBytes :: ScriptDataHash -> Bytes -foreign import scriptDataHash_toBech32 :: ScriptDataHash -> String -> String -foreign import scriptDataHash_fromBech32 :: String -> ForeignErrorable ScriptDataHash -foreign import scriptDataHash_toHex :: ScriptDataHash -> String -foreign import scriptDataHash_fromHex :: String -> ForeignErrorable ScriptDataHash - --- | Script data hash class -type ScriptDataHashClass = - { free :: ScriptDataHash -> Effect Unit - -- ^ Free - -- > free self - , fromBytes :: Bytes -> Maybe ScriptDataHash - -- ^ From bytes - -- > fromBytes bytes - , toBytes :: ScriptDataHash -> Bytes - -- ^ To bytes - -- > toBytes self - , toBech32 :: ScriptDataHash -> String -> String - -- ^ To bech32 - -- > toBech32 self prefix - , fromBech32 :: String -> Maybe ScriptDataHash - -- ^ From bech32 - -- > fromBech32 bechStr - , toHex :: ScriptDataHash -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe ScriptDataHash - -- ^ From hex - -- > fromHex hex - } - --- | Script data hash class API -scriptDataHash :: ScriptDataHashClass -scriptDataHash = - { free: scriptDataHash_free - , fromBytes: \a1 -> runForeignMaybe $ scriptDataHash_fromBytes a1 - , toBytes: scriptDataHash_toBytes - , toBech32: scriptDataHash_toBech32 - , fromBech32: \a1 -> runForeignMaybe $ scriptDataHash_fromBech32 a1 - , toHex: scriptDataHash_toHex - , fromHex: \a1 -> runForeignMaybe $ scriptDataHash_fromHex a1 - } - -instance HasFree ScriptDataHash where - free = scriptDataHash.free - -instance Show ScriptDataHash where - show = scriptDataHash.toHex - -instance IsHex ScriptDataHash where - toHex = scriptDataHash.toHex - fromHex = scriptDataHash.fromHex - -instance IsBytes ScriptDataHash where - toBytes = scriptDataHash.toBytes - fromBytes = scriptDataHash.fromBytes - -------------------------------------------------------------------------------------- --- Script hash - -foreign import scriptHash_free :: ScriptHash -> Effect Unit -foreign import scriptHash_fromBytes :: Bytes -> ForeignErrorable ScriptHash -foreign import scriptHash_toBytes :: ScriptHash -> Bytes -foreign import scriptHash_toBech32 :: ScriptHash -> String -> String -foreign import scriptHash_fromBech32 :: String -> ForeignErrorable ScriptHash -foreign import scriptHash_toHex :: ScriptHash -> String -foreign import scriptHash_fromHex :: String -> ForeignErrorable ScriptHash - --- | Script hash class -type ScriptHashClass = - { free :: ScriptHash -> Effect Unit - -- ^ Free - -- > free self - , fromBytes :: Bytes -> Maybe ScriptHash - -- ^ From bytes - -- > fromBytes bytes - , toBytes :: ScriptHash -> Bytes - -- ^ To bytes - -- > toBytes self - , toBech32 :: ScriptHash -> String -> String - -- ^ To bech32 - -- > toBech32 self prefix - , fromBech32 :: String -> Maybe ScriptHash - -- ^ From bech32 - -- > fromBech32 bechStr - , toHex :: ScriptHash -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe ScriptHash - -- ^ From hex - -- > fromHex hex - } - --- | Script hash class API -scriptHash :: ScriptHashClass -scriptHash = - { free: scriptHash_free - , fromBytes: \a1 -> runForeignMaybe $ scriptHash_fromBytes a1 - , toBytes: scriptHash_toBytes - , toBech32: scriptHash_toBech32 - , fromBech32: \a1 -> runForeignMaybe $ scriptHash_fromBech32 a1 - , toHex: scriptHash_toHex - , fromHex: \a1 -> runForeignMaybe $ scriptHash_fromHex a1 - } - -instance HasFree ScriptHash where - free = scriptHash.free - -instance Show ScriptHash where - show = scriptHash.toHex - -instance IsHex ScriptHash where - toHex = scriptHash.toHex - fromHex = scriptHash.fromHex - -instance IsBytes ScriptHash where - toBytes = scriptHash.toBytes - fromBytes = scriptHash.fromBytes - -------------------------------------------------------------------------------------- --- Script hashes - -foreign import scriptHashes_free :: ScriptHashes -> Effect Unit -foreign import scriptHashes_toBytes :: ScriptHashes -> Bytes -foreign import scriptHashes_fromBytes :: Bytes -> ForeignErrorable ScriptHashes -foreign import scriptHashes_toHex :: ScriptHashes -> String -foreign import scriptHashes_fromHex :: String -> ForeignErrorable ScriptHashes -foreign import scriptHashes_toJson :: ScriptHashes -> String -foreign import scriptHashes_toJsValue :: ScriptHashes -> ScriptHashesJson -foreign import scriptHashes_fromJson :: String -> ForeignErrorable ScriptHashes -foreign import scriptHashes_new :: Effect ScriptHashes -foreign import scriptHashes_len :: ScriptHashes -> Effect Int -foreign import scriptHashes_get :: ScriptHashes -> Int -> Effect ScriptHash -foreign import scriptHashes_add :: ScriptHashes -> ScriptHash -> Effect Unit - --- | Script hashes class -type ScriptHashesClass = - { free :: ScriptHashes -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: ScriptHashes -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe ScriptHashes - -- ^ From bytes - -- > fromBytes bytes - , toHex :: ScriptHashes -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe ScriptHashes - -- ^ From hex - -- > fromHex hexStr - , toJson :: ScriptHashes -> String - -- ^ To json - -- > toJson self - , toJsValue :: ScriptHashes -> ScriptHashesJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe ScriptHashes - -- ^ From json - -- > fromJson json - , new :: Effect ScriptHashes - -- ^ New - -- > new - , len :: ScriptHashes -> Effect Int - -- ^ Len - -- > len self - , get :: ScriptHashes -> Int -> Effect ScriptHash - -- ^ Get - -- > get self index - , add :: ScriptHashes -> ScriptHash -> Effect Unit - -- ^ Add - -- > add self elem - } - --- | Script hashes class API -scriptHashes :: ScriptHashesClass -scriptHashes = - { free: scriptHashes_free - , toBytes: scriptHashes_toBytes - , fromBytes: \a1 -> runForeignMaybe $ scriptHashes_fromBytes a1 - , toHex: scriptHashes_toHex - , fromHex: \a1 -> runForeignMaybe $ scriptHashes_fromHex a1 - , toJson: scriptHashes_toJson - , toJsValue: scriptHashes_toJsValue - , fromJson: \a1 -> runForeignMaybe $ scriptHashes_fromJson a1 - , new: scriptHashes_new - , len: scriptHashes_len - , get: scriptHashes_get - , add: scriptHashes_add - } - -instance HasFree ScriptHashes where - free = scriptHashes.free - -instance Show ScriptHashes where - show = scriptHashes.toHex - -instance MutableList ScriptHashes ScriptHash where - addItem = scriptHashes.add - getItem = scriptHashes.get - emptyList = scriptHashes.new - -instance MutableLen ScriptHashes where - getLen = scriptHashes.len - - -instance ToJsValue ScriptHashes where - toJsValue = scriptHashes.toJsValue - -instance IsHex ScriptHashes where - toHex = scriptHashes.toHex - fromHex = scriptHashes.fromHex - -instance IsBytes ScriptHashes where - toBytes = scriptHashes.toBytes - fromBytes = scriptHashes.fromBytes - -instance IsJson ScriptHashes where - toJson = scriptHashes.toJson - fromJson = scriptHashes.fromJson - -------------------------------------------------------------------------------------- --- Script nOf k - -foreign import scriptNOfK_free :: ScriptNOfK -> Effect Unit -foreign import scriptNOfK_toBytes :: ScriptNOfK -> Bytes -foreign import scriptNOfK_fromBytes :: Bytes -> ForeignErrorable ScriptNOfK -foreign import scriptNOfK_toHex :: ScriptNOfK -> String -foreign import scriptNOfK_fromHex :: String -> ForeignErrorable ScriptNOfK -foreign import scriptNOfK_toJson :: ScriptNOfK -> String -foreign import scriptNOfK_toJsValue :: ScriptNOfK -> ScriptNOfKJson -foreign import scriptNOfK_fromJson :: String -> ForeignErrorable ScriptNOfK -foreign import scriptNOfK_n :: ScriptNOfK -> Number -foreign import scriptNOfK_nativeScripts :: ScriptNOfK -> NativeScripts -foreign import scriptNOfK_new :: Number -> NativeScripts -> ScriptNOfK - --- | Script nOf k class -type ScriptNOfKClass = - { free :: ScriptNOfK -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: ScriptNOfK -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe ScriptNOfK - -- ^ From bytes - -- > fromBytes bytes - , toHex :: ScriptNOfK -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe ScriptNOfK - -- ^ From hex - -- > fromHex hexStr - , toJson :: ScriptNOfK -> String - -- ^ To json - -- > toJson self - , toJsValue :: ScriptNOfK -> ScriptNOfKJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe ScriptNOfK - -- ^ From json - -- > fromJson json - , n :: ScriptNOfK -> Number - -- ^ N - -- > n self - , nativeScripts :: ScriptNOfK -> NativeScripts - -- ^ Native scripts - -- > nativeScripts self - , new :: Number -> NativeScripts -> ScriptNOfK - -- ^ New - -- > new n nativeScripts - } - --- | Script nOf k class API -scriptNOfK :: ScriptNOfKClass -scriptNOfK = - { free: scriptNOfK_free - , toBytes: scriptNOfK_toBytes - , fromBytes: \a1 -> runForeignMaybe $ scriptNOfK_fromBytes a1 - , toHex: scriptNOfK_toHex - , fromHex: \a1 -> runForeignMaybe $ scriptNOfK_fromHex a1 - , toJson: scriptNOfK_toJson - , toJsValue: scriptNOfK_toJsValue - , fromJson: \a1 -> runForeignMaybe $ scriptNOfK_fromJson a1 - , n: scriptNOfK_n - , nativeScripts: scriptNOfK_nativeScripts - , new: scriptNOfK_new - } - -instance HasFree ScriptNOfK where - free = scriptNOfK.free - -instance Show ScriptNOfK where - show = scriptNOfK.toHex - -instance ToJsValue ScriptNOfK where - toJsValue = scriptNOfK.toJsValue - -instance IsHex ScriptNOfK where - toHex = scriptNOfK.toHex - fromHex = scriptNOfK.fromHex - -instance IsBytes ScriptNOfK where - toBytes = scriptNOfK.toBytes - fromBytes = scriptNOfK.fromBytes - -instance IsJson ScriptNOfK where - toJson = scriptNOfK.toJson - fromJson = scriptNOfK.fromJson - -------------------------------------------------------------------------------------- --- Script pubkey - -foreign import scriptPubkey_free :: ScriptPubkey -> Effect Unit -foreign import scriptPubkey_toBytes :: ScriptPubkey -> Bytes -foreign import scriptPubkey_fromBytes :: Bytes -> ForeignErrorable ScriptPubkey -foreign import scriptPubkey_toHex :: ScriptPubkey -> String -foreign import scriptPubkey_fromHex :: String -> ForeignErrorable ScriptPubkey -foreign import scriptPubkey_toJson :: ScriptPubkey -> String -foreign import scriptPubkey_toJsValue :: ScriptPubkey -> ScriptPubkeyJson -foreign import scriptPubkey_fromJson :: String -> ForeignErrorable ScriptPubkey -foreign import scriptPubkey_addrKeyhash :: ScriptPubkey -> Ed25519KeyHash -foreign import scriptPubkey_new :: Ed25519KeyHash -> ScriptPubkey - --- | Script pubkey class -type ScriptPubkeyClass = - { free :: ScriptPubkey -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: ScriptPubkey -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe ScriptPubkey - -- ^ From bytes - -- > fromBytes bytes - , toHex :: ScriptPubkey -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe ScriptPubkey - -- ^ From hex - -- > fromHex hexStr - , toJson :: ScriptPubkey -> String - -- ^ To json - -- > toJson self - , toJsValue :: ScriptPubkey -> ScriptPubkeyJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe ScriptPubkey - -- ^ From json - -- > fromJson json - , addrKeyhash :: ScriptPubkey -> Ed25519KeyHash - -- ^ Addr keyhash - -- > addrKeyhash self - , new :: Ed25519KeyHash -> ScriptPubkey - -- ^ New - -- > new addrKeyhash - } - --- | Script pubkey class API -scriptPubkey :: ScriptPubkeyClass -scriptPubkey = - { free: scriptPubkey_free - , toBytes: scriptPubkey_toBytes - , fromBytes: \a1 -> runForeignMaybe $ scriptPubkey_fromBytes a1 - , toHex: scriptPubkey_toHex - , fromHex: \a1 -> runForeignMaybe $ scriptPubkey_fromHex a1 - , toJson: scriptPubkey_toJson - , toJsValue: scriptPubkey_toJsValue - , fromJson: \a1 -> runForeignMaybe $ scriptPubkey_fromJson a1 - , addrKeyhash: scriptPubkey_addrKeyhash - , new: scriptPubkey_new - } - -instance HasFree ScriptPubkey where - free = scriptPubkey.free - -instance Show ScriptPubkey where - show = scriptPubkey.toHex - -instance ToJsValue ScriptPubkey where - toJsValue = scriptPubkey.toJsValue - -instance IsHex ScriptPubkey where - toHex = scriptPubkey.toHex - fromHex = scriptPubkey.fromHex - -instance IsBytes ScriptPubkey where - toBytes = scriptPubkey.toBytes - fromBytes = scriptPubkey.fromBytes - -instance IsJson ScriptPubkey where - toJson = scriptPubkey.toJson - fromJson = scriptPubkey.fromJson - -------------------------------------------------------------------------------------- --- Script ref - -foreign import scriptRef_free :: ScriptRef -> Effect Unit -foreign import scriptRef_toBytes :: ScriptRef -> Bytes -foreign import scriptRef_fromBytes :: Bytes -> ForeignErrorable ScriptRef -foreign import scriptRef_toHex :: ScriptRef -> String -foreign import scriptRef_fromHex :: String -> ForeignErrorable ScriptRef -foreign import scriptRef_toJson :: ScriptRef -> String -foreign import scriptRef_toJsValue :: ScriptRef -> ScriptRefJson -foreign import scriptRef_fromJson :: String -> ForeignErrorable ScriptRef -foreign import scriptRef_newNativeScript :: NativeScript -> ScriptRef -foreign import scriptRef_newPlutusScript :: PlutusScript -> ScriptRef -foreign import scriptRef_isNativeScript :: ScriptRef -> Boolean -foreign import scriptRef_isPlutusScript :: ScriptRef -> Boolean -foreign import scriptRef_nativeScript :: ScriptRef -> Nullable NativeScript -foreign import scriptRef_plutusScript :: ScriptRef -> Nullable PlutusScript - --- | Script ref class -type ScriptRefClass = - { free :: ScriptRef -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: ScriptRef -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe ScriptRef - -- ^ From bytes - -- > fromBytes bytes - , toHex :: ScriptRef -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe ScriptRef - -- ^ From hex - -- > fromHex hexStr - , toJson :: ScriptRef -> String - -- ^ To json - -- > toJson self - , toJsValue :: ScriptRef -> ScriptRefJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe ScriptRef - -- ^ From json - -- > fromJson json - , newNativeScript :: NativeScript -> ScriptRef - -- ^ New native script - -- > newNativeScript nativeScript - , newPlutusScript :: PlutusScript -> ScriptRef - -- ^ New plutus script - -- > newPlutusScript plutusScript - , isNativeScript :: ScriptRef -> Boolean - -- ^ Is native script - -- > isNativeScript self - , isPlutusScript :: ScriptRef -> Boolean - -- ^ Is plutus script - -- > isPlutusScript self - , nativeScript :: ScriptRef -> Maybe NativeScript - -- ^ Native script - -- > nativeScript self - , plutusScript :: ScriptRef -> Maybe PlutusScript - -- ^ Plutus script - -- > plutusScript self - } - --- | Script ref class API -scriptRef :: ScriptRefClass -scriptRef = - { free: scriptRef_free - , toBytes: scriptRef_toBytes - , fromBytes: \a1 -> runForeignMaybe $ scriptRef_fromBytes a1 - , toHex: scriptRef_toHex - , fromHex: \a1 -> runForeignMaybe $ scriptRef_fromHex a1 - , toJson: scriptRef_toJson - , toJsValue: scriptRef_toJsValue - , fromJson: \a1 -> runForeignMaybe $ scriptRef_fromJson a1 - , newNativeScript: scriptRef_newNativeScript - , newPlutusScript: scriptRef_newPlutusScript - , isNativeScript: scriptRef_isNativeScript - , isPlutusScript: scriptRef_isPlutusScript - , nativeScript: \a1 -> Nullable.toMaybe $ scriptRef_nativeScript a1 - , plutusScript: \a1 -> Nullable.toMaybe $ scriptRef_plutusScript a1 - } - -instance HasFree ScriptRef where - free = scriptRef.free - -instance Show ScriptRef where - show = scriptRef.toHex - -instance ToJsValue ScriptRef where - toJsValue = scriptRef.toJsValue - -instance IsHex ScriptRef where - toHex = scriptRef.toHex - fromHex = scriptRef.fromHex - -instance IsBytes ScriptRef where - toBytes = scriptRef.toBytes - fromBytes = scriptRef.fromBytes - -instance IsJson ScriptRef where - toJson = scriptRef.toJson - fromJson = scriptRef.fromJson - -------------------------------------------------------------------------------------- --- Single host addr - -foreign import singleHostAddr_free :: SingleHostAddr -> Effect Unit -foreign import singleHostAddr_toBytes :: SingleHostAddr -> Bytes -foreign import singleHostAddr_fromBytes :: Bytes -> ForeignErrorable SingleHostAddr -foreign import singleHostAddr_toHex :: SingleHostAddr -> String -foreign import singleHostAddr_fromHex :: String -> ForeignErrorable SingleHostAddr -foreign import singleHostAddr_toJson :: SingleHostAddr -> String -foreign import singleHostAddr_toJsValue :: SingleHostAddr -> SingleHostAddrJson -foreign import singleHostAddr_fromJson :: String -> ForeignErrorable SingleHostAddr -foreign import singleHostAddr_port :: SingleHostAddr -> Nullable Number -foreign import singleHostAddr_ipv4 :: SingleHostAddr -> Nullable Ipv4 -foreign import singleHostAddr_ipv6 :: SingleHostAddr -> Nullable Ipv6 -foreign import singleHostAddr_new :: Number -> Ipv4 -> Ipv6 -> SingleHostAddr - --- | Single host addr class -type SingleHostAddrClass = - { free :: SingleHostAddr -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: SingleHostAddr -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe SingleHostAddr - -- ^ From bytes - -- > fromBytes bytes - , toHex :: SingleHostAddr -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe SingleHostAddr - -- ^ From hex - -- > fromHex hexStr - , toJson :: SingleHostAddr -> String - -- ^ To json - -- > toJson self - , toJsValue :: SingleHostAddr -> SingleHostAddrJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe SingleHostAddr - -- ^ From json - -- > fromJson json - , port :: SingleHostAddr -> Maybe Number - -- ^ Port - -- > port self - , ipv4 :: SingleHostAddr -> Maybe Ipv4 - -- ^ Ipv4 - -- > ipv4 self - , ipv6 :: SingleHostAddr -> Maybe Ipv6 - -- ^ Ipv6 - -- > ipv6 self - , new :: Number -> Ipv4 -> Ipv6 -> SingleHostAddr - -- ^ New - -- > new port ipv4 ipv6 - } - --- | Single host addr class API -singleHostAddr :: SingleHostAddrClass -singleHostAddr = - { free: singleHostAddr_free - , toBytes: singleHostAddr_toBytes - , fromBytes: \a1 -> runForeignMaybe $ singleHostAddr_fromBytes a1 - , toHex: singleHostAddr_toHex - , fromHex: \a1 -> runForeignMaybe $ singleHostAddr_fromHex a1 - , toJson: singleHostAddr_toJson - , toJsValue: singleHostAddr_toJsValue - , fromJson: \a1 -> runForeignMaybe $ singleHostAddr_fromJson a1 - , port: \a1 -> Nullable.toMaybe $ singleHostAddr_port a1 - , ipv4: \a1 -> Nullable.toMaybe $ singleHostAddr_ipv4 a1 - , ipv6: \a1 -> Nullable.toMaybe $ singleHostAddr_ipv6 a1 - , new: singleHostAddr_new - } - -instance HasFree SingleHostAddr where - free = singleHostAddr.free - -instance Show SingleHostAddr where - show = singleHostAddr.toHex - -instance ToJsValue SingleHostAddr where - toJsValue = singleHostAddr.toJsValue - -instance IsHex SingleHostAddr where - toHex = singleHostAddr.toHex - fromHex = singleHostAddr.fromHex - -instance IsBytes SingleHostAddr where - toBytes = singleHostAddr.toBytes - fromBytes = singleHostAddr.fromBytes - -instance IsJson SingleHostAddr where - toJson = singleHostAddr.toJson - fromJson = singleHostAddr.fromJson - -------------------------------------------------------------------------------------- --- Single host name - -foreign import singleHostName_free :: SingleHostName -> Effect Unit -foreign import singleHostName_toBytes :: SingleHostName -> Bytes -foreign import singleHostName_fromBytes :: Bytes -> ForeignErrorable SingleHostName -foreign import singleHostName_toHex :: SingleHostName -> String -foreign import singleHostName_fromHex :: String -> ForeignErrorable SingleHostName -foreign import singleHostName_toJson :: SingleHostName -> String -foreign import singleHostName_toJsValue :: SingleHostName -> SingleHostNameJson -foreign import singleHostName_fromJson :: String -> ForeignErrorable SingleHostName -foreign import singleHostName_port :: SingleHostName -> Nullable Number -foreign import singleHostName_dnsName :: SingleHostName -> DNSRecordAorAAAA -foreign import singleHostName_new :: Nullable Number -> DNSRecordAorAAAA -> SingleHostName - --- | Single host name class -type SingleHostNameClass = - { free :: SingleHostName -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: SingleHostName -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe SingleHostName - -- ^ From bytes - -- > fromBytes bytes - , toHex :: SingleHostName -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe SingleHostName - -- ^ From hex - -- > fromHex hexStr - , toJson :: SingleHostName -> String - -- ^ To json - -- > toJson self - , toJsValue :: SingleHostName -> SingleHostNameJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe SingleHostName - -- ^ From json - -- > fromJson json - , port :: SingleHostName -> Maybe Number - -- ^ Port - -- > port self - , dnsName :: SingleHostName -> DNSRecordAorAAAA - -- ^ Dns name - -- > dnsName self - , new :: Maybe Number -> DNSRecordAorAAAA -> SingleHostName - -- ^ New - -- > new port dnsName - } - --- | Single host name class API -singleHostName :: SingleHostNameClass -singleHostName = - { free: singleHostName_free - , toBytes: singleHostName_toBytes - , fromBytes: \a1 -> runForeignMaybe $ singleHostName_fromBytes a1 - , toHex: singleHostName_toHex - , fromHex: \a1 -> runForeignMaybe $ singleHostName_fromHex a1 - , toJson: singleHostName_toJson - , toJsValue: singleHostName_toJsValue - , fromJson: \a1 -> runForeignMaybe $ singleHostName_fromJson a1 - , port: \a1 -> Nullable.toMaybe $ singleHostName_port a1 - , dnsName: singleHostName_dnsName - , new: \a1 a2 -> singleHostName_new (Nullable.toNullable a1) a2 - } - -instance HasFree SingleHostName where - free = singleHostName.free - -instance Show SingleHostName where - show = singleHostName.toHex - -instance ToJsValue SingleHostName where - toJsValue = singleHostName.toJsValue - -instance IsHex SingleHostName where - toHex = singleHostName.toHex - fromHex = singleHostName.fromHex - -instance IsBytes SingleHostName where - toBytes = singleHostName.toBytes - fromBytes = singleHostName.fromBytes - -instance IsJson SingleHostName where - toJson = singleHostName.toJson - fromJson = singleHostName.fromJson - -------------------------------------------------------------------------------------- --- Stake credential - -foreign import stakeCredential_free :: StakeCredential -> Effect Unit -foreign import stakeCredential_fromKeyhash :: Ed25519KeyHash -> StakeCredential -foreign import stakeCredential_fromScripthash :: ScriptHash -> StakeCredential -foreign import stakeCredential_toKeyhash :: StakeCredential -> Nullable Ed25519KeyHash -foreign import stakeCredential_toScripthash :: StakeCredential -> Nullable ScriptHash -foreign import stakeCredential_kind :: StakeCredential -> Number -foreign import stakeCredential_toBytes :: StakeCredential -> Bytes -foreign import stakeCredential_fromBytes :: Bytes -> ForeignErrorable StakeCredential -foreign import stakeCredential_toHex :: StakeCredential -> String -foreign import stakeCredential_fromHex :: String -> ForeignErrorable StakeCredential -foreign import stakeCredential_toJson :: StakeCredential -> String -foreign import stakeCredential_toJsValue :: StakeCredential -> StakeCredentialJson -foreign import stakeCredential_fromJson :: String -> ForeignErrorable StakeCredential - --- | Stake credential class -type StakeCredentialClass = - { free :: StakeCredential -> Effect Unit - -- ^ Free - -- > free self - , fromKeyhash :: Ed25519KeyHash -> StakeCredential - -- ^ From keyhash - -- > fromKeyhash hash - , fromScripthash :: ScriptHash -> StakeCredential - -- ^ From scripthash - -- > fromScripthash hash - , toKeyhash :: StakeCredential -> Maybe Ed25519KeyHash - -- ^ To keyhash - -- > toKeyhash self - , toScripthash :: StakeCredential -> Maybe ScriptHash - -- ^ To scripthash - -- > toScripthash self - , kind :: StakeCredential -> Number - -- ^ Kind - -- > kind self - , toBytes :: StakeCredential -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe StakeCredential - -- ^ From bytes - -- > fromBytes bytes - , toHex :: StakeCredential -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe StakeCredential - -- ^ From hex - -- > fromHex hexStr - , toJson :: StakeCredential -> String - -- ^ To json - -- > toJson self - , toJsValue :: StakeCredential -> StakeCredentialJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe StakeCredential - -- ^ From json - -- > fromJson json - } - --- | Stake credential class API -stakeCredential :: StakeCredentialClass -stakeCredential = - { free: stakeCredential_free - , fromKeyhash: stakeCredential_fromKeyhash - , fromScripthash: stakeCredential_fromScripthash - , toKeyhash: \a1 -> Nullable.toMaybe $ stakeCredential_toKeyhash a1 - , toScripthash: \a1 -> Nullable.toMaybe $ stakeCredential_toScripthash a1 - , kind: stakeCredential_kind - , toBytes: stakeCredential_toBytes - , fromBytes: \a1 -> runForeignMaybe $ stakeCredential_fromBytes a1 - , toHex: stakeCredential_toHex - , fromHex: \a1 -> runForeignMaybe $ stakeCredential_fromHex a1 - , toJson: stakeCredential_toJson - , toJsValue: stakeCredential_toJsValue - , fromJson: \a1 -> runForeignMaybe $ stakeCredential_fromJson a1 - } - -instance HasFree StakeCredential where - free = stakeCredential.free - -instance Show StakeCredential where - show = stakeCredential.toHex - -instance ToJsValue StakeCredential where - toJsValue = stakeCredential.toJsValue - -instance IsHex StakeCredential where - toHex = stakeCredential.toHex - fromHex = stakeCredential.fromHex - -instance IsBytes StakeCredential where - toBytes = stakeCredential.toBytes - fromBytes = stakeCredential.fromBytes - -instance IsJson StakeCredential where - toJson = stakeCredential.toJson - fromJson = stakeCredential.fromJson - -------------------------------------------------------------------------------------- --- Stake credentials - -foreign import stakeCredentials_free :: StakeCredentials -> Effect Unit -foreign import stakeCredentials_toBytes :: StakeCredentials -> Bytes -foreign import stakeCredentials_fromBytes :: Bytes -> ForeignErrorable StakeCredentials -foreign import stakeCredentials_toHex :: StakeCredentials -> String -foreign import stakeCredentials_fromHex :: String -> ForeignErrorable StakeCredentials -foreign import stakeCredentials_toJson :: StakeCredentials -> String -foreign import stakeCredentials_toJsValue :: StakeCredentials -> StakeCredentialsJson -foreign import stakeCredentials_fromJson :: String -> ForeignErrorable StakeCredentials -foreign import stakeCredentials_new :: Effect StakeCredentials -foreign import stakeCredentials_len :: StakeCredentials -> Effect Int -foreign import stakeCredentials_get :: StakeCredentials -> Int -> Effect StakeCredential -foreign import stakeCredentials_add :: StakeCredentials -> StakeCredential -> Effect Unit - --- | Stake credentials class -type StakeCredentialsClass = - { free :: StakeCredentials -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: StakeCredentials -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe StakeCredentials - -- ^ From bytes - -- > fromBytes bytes - , toHex :: StakeCredentials -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe StakeCredentials - -- ^ From hex - -- > fromHex hexStr - , toJson :: StakeCredentials -> String - -- ^ To json - -- > toJson self - , toJsValue :: StakeCredentials -> StakeCredentialsJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe StakeCredentials - -- ^ From json - -- > fromJson json - , new :: Effect StakeCredentials - -- ^ New - -- > new - , len :: StakeCredentials -> Effect Int - -- ^ Len - -- > len self - , get :: StakeCredentials -> Int -> Effect StakeCredential - -- ^ Get - -- > get self index - , add :: StakeCredentials -> StakeCredential -> Effect Unit - -- ^ Add - -- > add self elem - } - --- | Stake credentials class API -stakeCredentials :: StakeCredentialsClass -stakeCredentials = - { free: stakeCredentials_free - , toBytes: stakeCredentials_toBytes - , fromBytes: \a1 -> runForeignMaybe $ stakeCredentials_fromBytes a1 - , toHex: stakeCredentials_toHex - , fromHex: \a1 -> runForeignMaybe $ stakeCredentials_fromHex a1 - , toJson: stakeCredentials_toJson - , toJsValue: stakeCredentials_toJsValue - , fromJson: \a1 -> runForeignMaybe $ stakeCredentials_fromJson a1 - , new: stakeCredentials_new - , len: stakeCredentials_len - , get: stakeCredentials_get - , add: stakeCredentials_add - } - -instance HasFree StakeCredentials where - free = stakeCredentials.free - -instance Show StakeCredentials where - show = stakeCredentials.toHex - -instance MutableList StakeCredentials StakeCredential where - addItem = stakeCredentials.add - getItem = stakeCredentials.get - emptyList = stakeCredentials.new - -instance MutableLen StakeCredentials where - getLen = stakeCredentials.len - - -instance ToJsValue StakeCredentials where - toJsValue = stakeCredentials.toJsValue - -instance IsHex StakeCredentials where - toHex = stakeCredentials.toHex - fromHex = stakeCredentials.fromHex - -instance IsBytes StakeCredentials where - toBytes = stakeCredentials.toBytes - fromBytes = stakeCredentials.fromBytes - -instance IsJson StakeCredentials where - toJson = stakeCredentials.toJson - fromJson = stakeCredentials.fromJson - -------------------------------------------------------------------------------------- --- Stake delegation - -foreign import stakeDelegation_free :: StakeDelegation -> Effect Unit -foreign import stakeDelegation_toBytes :: StakeDelegation -> Bytes -foreign import stakeDelegation_fromBytes :: Bytes -> ForeignErrorable StakeDelegation -foreign import stakeDelegation_toHex :: StakeDelegation -> String -foreign import stakeDelegation_fromHex :: String -> ForeignErrorable StakeDelegation -foreign import stakeDelegation_toJson :: StakeDelegation -> String -foreign import stakeDelegation_toJsValue :: StakeDelegation -> StakeDelegationJson -foreign import stakeDelegation_fromJson :: String -> ForeignErrorable StakeDelegation -foreign import stakeDelegation_stakeCredential :: StakeDelegation -> StakeCredential -foreign import stakeDelegation_poolKeyhash :: StakeDelegation -> Ed25519KeyHash -foreign import stakeDelegation_new :: StakeCredential -> Ed25519KeyHash -> StakeDelegation - --- | Stake delegation class -type StakeDelegationClass = - { free :: StakeDelegation -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: StakeDelegation -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe StakeDelegation - -- ^ From bytes - -- > fromBytes bytes - , toHex :: StakeDelegation -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe StakeDelegation - -- ^ From hex - -- > fromHex hexStr - , toJson :: StakeDelegation -> String - -- ^ To json - -- > toJson self - , toJsValue :: StakeDelegation -> StakeDelegationJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe StakeDelegation - -- ^ From json - -- > fromJson json - , stakeCredential :: StakeDelegation -> StakeCredential - -- ^ Stake credential - -- > stakeCredential self - , poolKeyhash :: StakeDelegation -> Ed25519KeyHash - -- ^ Pool keyhash - -- > poolKeyhash self - , new :: StakeCredential -> Ed25519KeyHash -> StakeDelegation - -- ^ New - -- > new stakeCredential poolKeyhash - } - --- | Stake delegation class API -stakeDelegation :: StakeDelegationClass -stakeDelegation = - { free: stakeDelegation_free - , toBytes: stakeDelegation_toBytes - , fromBytes: \a1 -> runForeignMaybe $ stakeDelegation_fromBytes a1 - , toHex: stakeDelegation_toHex - , fromHex: \a1 -> runForeignMaybe $ stakeDelegation_fromHex a1 - , toJson: stakeDelegation_toJson - , toJsValue: stakeDelegation_toJsValue - , fromJson: \a1 -> runForeignMaybe $ stakeDelegation_fromJson a1 - , stakeCredential: stakeDelegation_stakeCredential - , poolKeyhash: stakeDelegation_poolKeyhash - , new: stakeDelegation_new - } - -instance HasFree StakeDelegation where - free = stakeDelegation.free - -instance Show StakeDelegation where - show = stakeDelegation.toHex - -instance ToJsValue StakeDelegation where - toJsValue = stakeDelegation.toJsValue - -instance IsHex StakeDelegation where - toHex = stakeDelegation.toHex - fromHex = stakeDelegation.fromHex - -instance IsBytes StakeDelegation where - toBytes = stakeDelegation.toBytes - fromBytes = stakeDelegation.fromBytes - -instance IsJson StakeDelegation where - toJson = stakeDelegation.toJson - fromJson = stakeDelegation.fromJson - -------------------------------------------------------------------------------------- --- Stake deregistration - -foreign import stakeDeregistration_free :: StakeDeregistration -> Effect Unit -foreign import stakeDeregistration_toBytes :: StakeDeregistration -> Bytes -foreign import stakeDeregistration_fromBytes :: Bytes -> ForeignErrorable StakeDeregistration -foreign import stakeDeregistration_toHex :: StakeDeregistration -> String -foreign import stakeDeregistration_fromHex :: String -> ForeignErrorable StakeDeregistration -foreign import stakeDeregistration_toJson :: StakeDeregistration -> String -foreign import stakeDeregistration_toJsValue :: StakeDeregistration -> StakeDeregistrationJson -foreign import stakeDeregistration_fromJson :: String -> ForeignErrorable StakeDeregistration -foreign import stakeDeregistration_stakeCredential :: StakeDeregistration -> StakeCredential -foreign import stakeDeregistration_new :: StakeCredential -> StakeDeregistration - --- | Stake deregistration class -type StakeDeregistrationClass = - { free :: StakeDeregistration -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: StakeDeregistration -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe StakeDeregistration - -- ^ From bytes - -- > fromBytes bytes - , toHex :: StakeDeregistration -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe StakeDeregistration - -- ^ From hex - -- > fromHex hexStr - , toJson :: StakeDeregistration -> String - -- ^ To json - -- > toJson self - , toJsValue :: StakeDeregistration -> StakeDeregistrationJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe StakeDeregistration - -- ^ From json - -- > fromJson json - , stakeCredential :: StakeDeregistration -> StakeCredential - -- ^ Stake credential - -- > stakeCredential self - , new :: StakeCredential -> StakeDeregistration - -- ^ New - -- > new stakeCredential - } - --- | Stake deregistration class API -stakeDeregistration :: StakeDeregistrationClass -stakeDeregistration = - { free: stakeDeregistration_free - , toBytes: stakeDeregistration_toBytes - , fromBytes: \a1 -> runForeignMaybe $ stakeDeregistration_fromBytes a1 - , toHex: stakeDeregistration_toHex - , fromHex: \a1 -> runForeignMaybe $ stakeDeregistration_fromHex a1 - , toJson: stakeDeregistration_toJson - , toJsValue: stakeDeregistration_toJsValue - , fromJson: \a1 -> runForeignMaybe $ stakeDeregistration_fromJson a1 - , stakeCredential: stakeDeregistration_stakeCredential - , new: stakeDeregistration_new - } - -instance HasFree StakeDeregistration where - free = stakeDeregistration.free - -instance Show StakeDeregistration where - show = stakeDeregistration.toHex - -instance ToJsValue StakeDeregistration where - toJsValue = stakeDeregistration.toJsValue - -instance IsHex StakeDeregistration where - toHex = stakeDeregistration.toHex - fromHex = stakeDeregistration.fromHex - -instance IsBytes StakeDeregistration where - toBytes = stakeDeregistration.toBytes - fromBytes = stakeDeregistration.fromBytes - -instance IsJson StakeDeregistration where - toJson = stakeDeregistration.toJson - fromJson = stakeDeregistration.fromJson - -------------------------------------------------------------------------------------- --- Stake registration - -foreign import stakeRegistration_free :: StakeRegistration -> Effect Unit -foreign import stakeRegistration_toBytes :: StakeRegistration -> Bytes -foreign import stakeRegistration_fromBytes :: Bytes -> ForeignErrorable StakeRegistration -foreign import stakeRegistration_toHex :: StakeRegistration -> String -foreign import stakeRegistration_fromHex :: String -> ForeignErrorable StakeRegistration -foreign import stakeRegistration_toJson :: StakeRegistration -> String -foreign import stakeRegistration_toJsValue :: StakeRegistration -> StakeRegistrationJson -foreign import stakeRegistration_fromJson :: String -> ForeignErrorable StakeRegistration -foreign import stakeRegistration_stakeCredential :: StakeRegistration -> StakeCredential -foreign import stakeRegistration_new :: StakeCredential -> StakeRegistration - --- | Stake registration class -type StakeRegistrationClass = - { free :: StakeRegistration -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: StakeRegistration -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe StakeRegistration - -- ^ From bytes - -- > fromBytes bytes - , toHex :: StakeRegistration -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe StakeRegistration - -- ^ From hex - -- > fromHex hexStr - , toJson :: StakeRegistration -> String - -- ^ To json - -- > toJson self - , toJsValue :: StakeRegistration -> StakeRegistrationJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe StakeRegistration - -- ^ From json - -- > fromJson json - , stakeCredential :: StakeRegistration -> StakeCredential - -- ^ Stake credential - -- > stakeCredential self - , new :: StakeCredential -> StakeRegistration - -- ^ New - -- > new stakeCredential - } - --- | Stake registration class API -stakeRegistration :: StakeRegistrationClass -stakeRegistration = - { free: stakeRegistration_free - , toBytes: stakeRegistration_toBytes - , fromBytes: \a1 -> runForeignMaybe $ stakeRegistration_fromBytes a1 - , toHex: stakeRegistration_toHex - , fromHex: \a1 -> runForeignMaybe $ stakeRegistration_fromHex a1 - , toJson: stakeRegistration_toJson - , toJsValue: stakeRegistration_toJsValue - , fromJson: \a1 -> runForeignMaybe $ stakeRegistration_fromJson a1 - , stakeCredential: stakeRegistration_stakeCredential - , new: stakeRegistration_new - } - -instance HasFree StakeRegistration where - free = stakeRegistration.free - -instance Show StakeRegistration where - show = stakeRegistration.toHex - -instance ToJsValue StakeRegistration where - toJsValue = stakeRegistration.toJsValue - -instance IsHex StakeRegistration where - toHex = stakeRegistration.toHex - fromHex = stakeRegistration.fromHex - -instance IsBytes StakeRegistration where - toBytes = stakeRegistration.toBytes - fromBytes = stakeRegistration.fromBytes - -instance IsJson StakeRegistration where - toJson = stakeRegistration.toJson - fromJson = stakeRegistration.fromJson - -------------------------------------------------------------------------------------- --- Strings - -foreign import strings_free :: Strings -> Effect Unit -foreign import strings_new :: Effect Strings -foreign import strings_len :: Strings -> Effect Int -foreign import strings_get :: Strings -> Int -> Effect String -foreign import strings_add :: Strings -> String -> Effect Unit - --- | Strings class -type StringsClass = - { free :: Strings -> Effect Unit - -- ^ Free - -- > free self - , new :: Effect Strings - -- ^ New - -- > new - , len :: Strings -> Effect Int - -- ^ Len - -- > len self - , get :: Strings -> Int -> Effect String - -- ^ Get - -- > get self index - , add :: Strings -> String -> Effect Unit - -- ^ Add - -- > add self elem - } - --- | Strings class API -strings :: StringsClass -strings = - { free: strings_free - , new: strings_new - , len: strings_len - , get: strings_get - , add: strings_add - } - -instance HasFree Strings where - free = strings.free - -instance MutableList Strings String where - addItem = strings.add - getItem = strings.get - emptyList = strings.new - -instance MutableLen Strings where - getLen = strings.len - -------------------------------------------------------------------------------------- --- Timelock expiry - -foreign import timelockExpiry_free :: TimelockExpiry -> Effect Unit -foreign import timelockExpiry_toBytes :: TimelockExpiry -> Bytes -foreign import timelockExpiry_fromBytes :: Bytes -> ForeignErrorable TimelockExpiry -foreign import timelockExpiry_toHex :: TimelockExpiry -> String -foreign import timelockExpiry_fromHex :: String -> ForeignErrorable TimelockExpiry -foreign import timelockExpiry_toJson :: TimelockExpiry -> String -foreign import timelockExpiry_toJsValue :: TimelockExpiry -> TimelockExpiryJson -foreign import timelockExpiry_fromJson :: String -> ForeignErrorable TimelockExpiry -foreign import timelockExpiry_slot :: TimelockExpiry -> Number -foreign import timelockExpiry_slotBignum :: TimelockExpiry -> BigNum -foreign import timelockExpiry_new :: Number -> TimelockExpiry -foreign import timelockExpiry_newTimelockexpiry :: BigNum -> TimelockExpiry - --- | Timelock expiry class -type TimelockExpiryClass = - { free :: TimelockExpiry -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: TimelockExpiry -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe TimelockExpiry - -- ^ From bytes - -- > fromBytes bytes - , toHex :: TimelockExpiry -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe TimelockExpiry - -- ^ From hex - -- > fromHex hexStr - , toJson :: TimelockExpiry -> String - -- ^ To json - -- > toJson self - , toJsValue :: TimelockExpiry -> TimelockExpiryJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe TimelockExpiry - -- ^ From json - -- > fromJson json - , slot :: TimelockExpiry -> Number - -- ^ Slot - -- > slot self - , slotBignum :: TimelockExpiry -> BigNum - -- ^ Slot bignum - -- > slotBignum self - , new :: Number -> TimelockExpiry - -- ^ New - -- > new slot - , newTimelockexpiry :: BigNum -> TimelockExpiry - -- ^ New timelockexpiry - -- > newTimelockexpiry slot - } - --- | Timelock expiry class API -timelockExpiry :: TimelockExpiryClass -timelockExpiry = - { free: timelockExpiry_free - , toBytes: timelockExpiry_toBytes - , fromBytes: \a1 -> runForeignMaybe $ timelockExpiry_fromBytes a1 - , toHex: timelockExpiry_toHex - , fromHex: \a1 -> runForeignMaybe $ timelockExpiry_fromHex a1 - , toJson: timelockExpiry_toJson - , toJsValue: timelockExpiry_toJsValue - , fromJson: \a1 -> runForeignMaybe $ timelockExpiry_fromJson a1 - , slot: timelockExpiry_slot - , slotBignum: timelockExpiry_slotBignum - , new: timelockExpiry_new - , newTimelockexpiry: timelockExpiry_newTimelockexpiry - } - -instance HasFree TimelockExpiry where - free = timelockExpiry.free - -instance Show TimelockExpiry where - show = timelockExpiry.toHex - -instance ToJsValue TimelockExpiry where - toJsValue = timelockExpiry.toJsValue - -instance IsHex TimelockExpiry where - toHex = timelockExpiry.toHex - fromHex = timelockExpiry.fromHex - -instance IsBytes TimelockExpiry where - toBytes = timelockExpiry.toBytes - fromBytes = timelockExpiry.fromBytes - -instance IsJson TimelockExpiry where - toJson = timelockExpiry.toJson - fromJson = timelockExpiry.fromJson - -------------------------------------------------------------------------------------- --- Timelock start - -foreign import timelockStart_free :: TimelockStart -> Effect Unit -foreign import timelockStart_toBytes :: TimelockStart -> Bytes -foreign import timelockStart_fromBytes :: Bytes -> ForeignErrorable TimelockStart -foreign import timelockStart_toHex :: TimelockStart -> String -foreign import timelockStart_fromHex :: String -> ForeignErrorable TimelockStart -foreign import timelockStart_toJson :: TimelockStart -> String -foreign import timelockStart_toJsValue :: TimelockStart -> TimelockStartJson -foreign import timelockStart_fromJson :: String -> ForeignErrorable TimelockStart -foreign import timelockStart_slot :: TimelockStart -> Number -foreign import timelockStart_slotBignum :: TimelockStart -> BigNum -foreign import timelockStart_new :: Number -> TimelockStart -foreign import timelockStart_newTimelockstart :: BigNum -> TimelockStart - --- | Timelock start class -type TimelockStartClass = - { free :: TimelockStart -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: TimelockStart -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe TimelockStart - -- ^ From bytes - -- > fromBytes bytes - , toHex :: TimelockStart -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe TimelockStart - -- ^ From hex - -- > fromHex hexStr - , toJson :: TimelockStart -> String - -- ^ To json - -- > toJson self - , toJsValue :: TimelockStart -> TimelockStartJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe TimelockStart - -- ^ From json - -- > fromJson json - , slot :: TimelockStart -> Number - -- ^ Slot - -- > slot self - , slotBignum :: TimelockStart -> BigNum - -- ^ Slot bignum - -- > slotBignum self - , new :: Number -> TimelockStart - -- ^ New - -- > new slot - , newTimelockstart :: BigNum -> TimelockStart - -- ^ New timelockstart - -- > newTimelockstart slot - } - --- | Timelock start class API -timelockStart :: TimelockStartClass -timelockStart = - { free: timelockStart_free - , toBytes: timelockStart_toBytes - , fromBytes: \a1 -> runForeignMaybe $ timelockStart_fromBytes a1 - , toHex: timelockStart_toHex - , fromHex: \a1 -> runForeignMaybe $ timelockStart_fromHex a1 - , toJson: timelockStart_toJson - , toJsValue: timelockStart_toJsValue - , fromJson: \a1 -> runForeignMaybe $ timelockStart_fromJson a1 - , slot: timelockStart_slot - , slotBignum: timelockStart_slotBignum - , new: timelockStart_new - , newTimelockstart: timelockStart_newTimelockstart - } - -instance HasFree TimelockStart where - free = timelockStart.free - -instance Show TimelockStart where - show = timelockStart.toHex - -instance ToJsValue TimelockStart where - toJsValue = timelockStart.toJsValue - -instance IsHex TimelockStart where - toHex = timelockStart.toHex - fromHex = timelockStart.fromHex - -instance IsBytes TimelockStart where - toBytes = timelockStart.toBytes - fromBytes = timelockStart.fromBytes - -instance IsJson TimelockStart where - toJson = timelockStart.toJson - fromJson = timelockStart.fromJson - -------------------------------------------------------------------------------------- --- Transaction - -foreign import tx_free :: Tx -> Effect Unit -foreign import tx_toBytes :: Tx -> Bytes -foreign import tx_fromBytes :: Bytes -> ForeignErrorable Tx -foreign import tx_toHex :: Tx -> String -foreign import tx_fromHex :: String -> ForeignErrorable Tx -foreign import tx_toJson :: Tx -> String -foreign import tx_toJsValue :: Tx -> TxJson -foreign import tx_fromJson :: String -> ForeignErrorable Tx -foreign import tx_body :: Tx -> TxBody -foreign import tx_witnessSet :: Tx -> TxWitnessSet -foreign import tx_isValid :: Tx -> Boolean -foreign import tx_auxiliaryData :: Tx -> Nullable AuxiliaryData -foreign import tx_setIsValid :: Tx -> Boolean -> Effect Unit -foreign import tx_new :: TxBody -> TxWitnessSet -> AuxiliaryData -> Tx - --- | Transaction class -type TxClass = - { free :: Tx -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: Tx -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe Tx - -- ^ From bytes - -- > fromBytes bytes - , toHex :: Tx -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe Tx - -- ^ From hex - -- > fromHex hexStr - , toJson :: Tx -> String - -- ^ To json - -- > toJson self - , toJsValue :: Tx -> TxJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe Tx - -- ^ From json - -- > fromJson json - , body :: Tx -> TxBody - -- ^ Body - -- > body self - , witnessSet :: Tx -> TxWitnessSet - -- ^ Witness set - -- > witnessSet self - , isValid :: Tx -> Boolean - -- ^ Is valid - -- > isValid self - , auxiliaryData :: Tx -> Maybe AuxiliaryData - -- ^ Auxiliary data - -- > auxiliaryData self - , setIsValid :: Tx -> Boolean -> Effect Unit - -- ^ Set is valid - -- > setIsValid self valid - , new :: TxBody -> TxWitnessSet -> AuxiliaryData -> Tx - -- ^ New - -- > new body witnessSet auxiliaryData - } - --- | Transaction class API -tx :: TxClass -tx = - { free: tx_free - , toBytes: tx_toBytes - , fromBytes: \a1 -> runForeignMaybe $ tx_fromBytes a1 - , toHex: tx_toHex - , fromHex: \a1 -> runForeignMaybe $ tx_fromHex a1 - , toJson: tx_toJson - , toJsValue: tx_toJsValue - , fromJson: \a1 -> runForeignMaybe $ tx_fromJson a1 - , body: tx_body - , witnessSet: tx_witnessSet - , isValid: tx_isValid - , auxiliaryData: \a1 -> Nullable.toMaybe $ tx_auxiliaryData a1 - , setIsValid: tx_setIsValid - , new: tx_new - } - -instance HasFree Tx where - free = tx.free - -instance Show Tx where - show = tx.toHex - -instance ToJsValue Tx where - toJsValue = tx.toJsValue - -instance IsHex Tx where - toHex = tx.toHex - fromHex = tx.fromHex - -instance IsBytes Tx where - toBytes = tx.toBytes - fromBytes = tx.fromBytes - -instance IsJson Tx where - toJson = tx.toJson - fromJson = tx.fromJson - -------------------------------------------------------------------------------------- --- Transaction bodies - -foreign import txBodies_free :: TxBodies -> Effect Unit -foreign import txBodies_toBytes :: TxBodies -> Bytes -foreign import txBodies_fromBytes :: Bytes -> ForeignErrorable TxBodies -foreign import txBodies_toHex :: TxBodies -> String -foreign import txBodies_fromHex :: String -> ForeignErrorable TxBodies -foreign import txBodies_toJson :: TxBodies -> String -foreign import txBodies_toJsValue :: TxBodies -> TxBodiesJson -foreign import txBodies_fromJson :: String -> ForeignErrorable TxBodies -foreign import txBodies_new :: Effect TxBodies -foreign import txBodies_len :: TxBodies -> Effect Int -foreign import txBodies_get :: TxBodies -> Int -> Effect TxBody -foreign import txBodies_add :: TxBodies -> TxBody -> Effect Unit - --- | Transaction bodies class -type TxBodiesClass = - { free :: TxBodies -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: TxBodies -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe TxBodies - -- ^ From bytes - -- > fromBytes bytes - , toHex :: TxBodies -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe TxBodies - -- ^ From hex - -- > fromHex hexStr - , toJson :: TxBodies -> String - -- ^ To json - -- > toJson self - , toJsValue :: TxBodies -> TxBodiesJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe TxBodies - -- ^ From json - -- > fromJson json - , new :: Effect TxBodies - -- ^ New - -- > new - , len :: TxBodies -> Effect Int - -- ^ Len - -- > len self - , get :: TxBodies -> Int -> Effect TxBody - -- ^ Get - -- > get self index - , add :: TxBodies -> TxBody -> Effect Unit - -- ^ Add - -- > add self elem - } - --- | Transaction bodies class API -txBodies :: TxBodiesClass -txBodies = - { free: txBodies_free - , toBytes: txBodies_toBytes - , fromBytes: \a1 -> runForeignMaybe $ txBodies_fromBytes a1 - , toHex: txBodies_toHex - , fromHex: \a1 -> runForeignMaybe $ txBodies_fromHex a1 - , toJson: txBodies_toJson - , toJsValue: txBodies_toJsValue - , fromJson: \a1 -> runForeignMaybe $ txBodies_fromJson a1 - , new: txBodies_new - , len: txBodies_len - , get: txBodies_get - , add: txBodies_add - } - -instance HasFree TxBodies where - free = txBodies.free - -instance Show TxBodies where - show = txBodies.toHex - -instance MutableList TxBodies TxBody where - addItem = txBodies.add - getItem = txBodies.get - emptyList = txBodies.new - -instance MutableLen TxBodies where - getLen = txBodies.len - - -instance ToJsValue TxBodies where - toJsValue = txBodies.toJsValue - -instance IsHex TxBodies where - toHex = txBodies.toHex - fromHex = txBodies.fromHex - -instance IsBytes TxBodies where - toBytes = txBodies.toBytes - fromBytes = txBodies.fromBytes - -instance IsJson TxBodies where - toJson = txBodies.toJson - fromJson = txBodies.fromJson - -------------------------------------------------------------------------------------- --- Transaction body - -foreign import txBody_free :: TxBody -> Effect Unit -foreign import txBody_toBytes :: TxBody -> Bytes -foreign import txBody_fromBytes :: Bytes -> ForeignErrorable TxBody -foreign import txBody_toHex :: TxBody -> String -foreign import txBody_fromHex :: String -> ForeignErrorable TxBody -foreign import txBody_toJson :: TxBody -> String -foreign import txBody_toJsValue :: TxBody -> TxBodyJson -foreign import txBody_fromJson :: String -> ForeignErrorable TxBody -foreign import txBody_ins :: TxBody -> TxIns -foreign import txBody_outs :: TxBody -> TxOuts -foreign import txBody_fee :: TxBody -> BigNum -foreign import txBody_ttl :: TxBody -> Nullable Number -foreign import txBody_ttlBignum :: TxBody -> Nullable BigNum -foreign import txBody_setTtl :: TxBody -> BigNum -> Effect Unit -foreign import txBody_removeTtl :: TxBody -> Effect Unit -foreign import txBody_setCerts :: TxBody -> Certificates -> Effect Unit -foreign import txBody_certs :: TxBody -> Nullable Certificates -foreign import txBody_setWithdrawals :: TxBody -> Withdrawals -> Effect Unit -foreign import txBody_withdrawals :: TxBody -> Nullable Withdrawals -foreign import txBody_setUpdate :: TxBody -> Update -> Effect Unit -foreign import txBody_update :: TxBody -> Nullable Update -foreign import txBody_setAuxiliaryDataHash :: TxBody -> AuxiliaryDataHash -> Effect Unit -foreign import txBody_auxiliaryDataHash :: TxBody -> Nullable AuxiliaryDataHash -foreign import txBody_setValidityStartInterval :: TxBody -> Number -> Effect Unit -foreign import txBody_setValidityStartIntervalBignum :: TxBody -> BigNum -> Effect Unit -foreign import txBody_validityStartIntervalBignum :: TxBody -> Nullable BigNum -foreign import txBody_validityStartInterval :: TxBody -> Nullable Number -foreign import txBody_setMint :: TxBody -> Mint -> Effect Unit -foreign import txBody_mint :: TxBody -> Nullable Mint -foreign import txBody_multiassets :: TxBody -> Nullable Mint -foreign import txBody_setReferenceIns :: TxBody -> TxIns -> Effect Unit -foreign import txBody_referenceIns :: TxBody -> Nullable TxIns -foreign import txBody_setScriptDataHash :: TxBody -> ScriptDataHash -> Effect Unit -foreign import txBody_scriptDataHash :: TxBody -> Nullable ScriptDataHash -foreign import txBody_setCollateral :: TxBody -> TxIns -> Effect Unit -foreign import txBody_collateral :: TxBody -> Nullable TxIns -foreign import txBody_setRequiredSigners :: TxBody -> Ed25519KeyHashes -> Effect Unit -foreign import txBody_requiredSigners :: TxBody -> Nullable Ed25519KeyHashes -foreign import txBody_setNetworkId :: TxBody -> NetworkId -> Effect Unit -foreign import txBody_networkId :: TxBody -> Nullable NetworkId -foreign import txBody_setCollateralReturn :: TxBody -> TxOut -> Effect Unit -foreign import txBody_collateralReturn :: TxBody -> Nullable TxOut -foreign import txBody_setTotalCollateral :: TxBody -> BigNum -> Effect Unit -foreign import txBody_totalCollateral :: TxBody -> Nullable BigNum -foreign import txBody_new :: TxIns -> TxOuts -> BigNum -> Number -> TxBody -foreign import txBody_newTxBody :: TxIns -> TxOuts -> BigNum -> TxBody - --- | Transaction body class -type TxBodyClass = - { free :: TxBody -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: TxBody -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe TxBody - -- ^ From bytes - -- > fromBytes bytes - , toHex :: TxBody -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe TxBody - -- ^ From hex - -- > fromHex hexStr - , toJson :: TxBody -> String - -- ^ To json - -- > toJson self - , toJsValue :: TxBody -> TxBodyJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe TxBody - -- ^ From json - -- > fromJson json - , ins :: TxBody -> TxIns - -- ^ Inputs - -- > ins self - , outs :: TxBody -> TxOuts - -- ^ Outputs - -- > outs self - , fee :: TxBody -> BigNum - -- ^ Fee - -- > fee self - , ttl :: TxBody -> Maybe Number - -- ^ Ttl - -- > ttl self - , ttlBignum :: TxBody -> Maybe BigNum - -- ^ Ttl bignum - -- > ttlBignum self - , setTtl :: TxBody -> BigNum -> Effect Unit - -- ^ Set ttl - -- > setTtl self ttl - , removeTtl :: TxBody -> Effect Unit - -- ^ Remove ttl - -- > removeTtl self - , setCerts :: TxBody -> Certificates -> Effect Unit - -- ^ Set certs - -- > setCerts self certs - , certs :: TxBody -> Maybe Certificates - -- ^ Certs - -- > certs self - , setWithdrawals :: TxBody -> Withdrawals -> Effect Unit - -- ^ Set withdrawals - -- > setWithdrawals self withdrawals - , withdrawals :: TxBody -> Maybe Withdrawals - -- ^ Withdrawals - -- > withdrawals self - , setUpdate :: TxBody -> Update -> Effect Unit - -- ^ Set update - -- > setUpdate self update - , update :: TxBody -> Maybe Update - -- ^ Update - -- > update self - , setAuxiliaryDataHash :: TxBody -> AuxiliaryDataHash -> Effect Unit - -- ^ Set auxiliary data hash - -- > setAuxiliaryDataHash self auxiliaryDataHash - , auxiliaryDataHash :: TxBody -> Maybe AuxiliaryDataHash - -- ^ Auxiliary data hash - -- > auxiliaryDataHash self - , setValidityStartInterval :: TxBody -> Number -> Effect Unit - -- ^ Set validity start interval - -- > setValidityStartInterval self validityStartInterval - , setValidityStartIntervalBignum :: TxBody -> BigNum -> Effect Unit - -- ^ Set validity start interval bignum - -- > setValidityStartIntervalBignum self validityStartInterval - , validityStartIntervalBignum :: TxBody -> Maybe BigNum - -- ^ Validity start interval bignum - -- > validityStartIntervalBignum self - , validityStartInterval :: TxBody -> Maybe Number - -- ^ Validity start interval - -- > validityStartInterval self - , setMint :: TxBody -> Mint -> Effect Unit - -- ^ Set mint - -- > setMint self mint - , mint :: TxBody -> Maybe Mint - -- ^ Mint - -- > mint self - , multiassets :: TxBody -> Maybe Mint - -- ^ Multiassets - -- > multiassets self - , setReferenceIns :: TxBody -> TxIns -> Effect Unit - -- ^ Set reference inputs - -- > setReferenceIns self referenceIns - , referenceIns :: TxBody -> Maybe TxIns - -- ^ Reference inputs - -- > referenceIns self - , setScriptDataHash :: TxBody -> ScriptDataHash -> Effect Unit - -- ^ Set script data hash - -- > setScriptDataHash self scriptDataHash - , scriptDataHash :: TxBody -> Maybe ScriptDataHash - -- ^ Script data hash - -- > scriptDataHash self - , setCollateral :: TxBody -> TxIns -> Effect Unit - -- ^ Set collateral - -- > setCollateral self collateral - , collateral :: TxBody -> Maybe TxIns - -- ^ Collateral - -- > collateral self - , setRequiredSigners :: TxBody -> Ed25519KeyHashes -> Effect Unit - -- ^ Set required signers - -- > setRequiredSigners self requiredSigners - , requiredSigners :: TxBody -> Maybe Ed25519KeyHashes - -- ^ Required signers - -- > requiredSigners self - , setNetworkId :: TxBody -> NetworkId -> Effect Unit - -- ^ Set network id - -- > setNetworkId self networkId - , networkId :: TxBody -> Maybe NetworkId - -- ^ Network id - -- > networkId self - , setCollateralReturn :: TxBody -> TxOut -> Effect Unit - -- ^ Set collateral return - -- > setCollateralReturn self collateralReturn - , collateralReturn :: TxBody -> Maybe TxOut - -- ^ Collateral return - -- > collateralReturn self - , setTotalCollateral :: TxBody -> BigNum -> Effect Unit - -- ^ Set total collateral - -- > setTotalCollateral self totalCollateral - , totalCollateral :: TxBody -> Maybe BigNum - -- ^ Total collateral - -- > totalCollateral self - , new :: TxIns -> TxOuts -> BigNum -> Number -> TxBody - -- ^ New - -- > new ins outs fee ttl - , newTxBody :: TxIns -> TxOuts -> BigNum -> TxBody - -- ^ New tx body - -- > newTxBody ins outs fee - } - --- | Transaction body class API -txBody :: TxBodyClass -txBody = - { free: txBody_free - , toBytes: txBody_toBytes - , fromBytes: \a1 -> runForeignMaybe $ txBody_fromBytes a1 - , toHex: txBody_toHex - , fromHex: \a1 -> runForeignMaybe $ txBody_fromHex a1 - , toJson: txBody_toJson - , toJsValue: txBody_toJsValue - , fromJson: \a1 -> runForeignMaybe $ txBody_fromJson a1 - , ins: txBody_ins - , outs: txBody_outs - , fee: txBody_fee - , ttl: \a1 -> Nullable.toMaybe $ txBody_ttl a1 - , ttlBignum: \a1 -> Nullable.toMaybe $ txBody_ttlBignum a1 - , setTtl: txBody_setTtl - , removeTtl: txBody_removeTtl - , setCerts: txBody_setCerts - , certs: \a1 -> Nullable.toMaybe $ txBody_certs a1 - , setWithdrawals: txBody_setWithdrawals - , withdrawals: \a1 -> Nullable.toMaybe $ txBody_withdrawals a1 - , setUpdate: txBody_setUpdate - , update: \a1 -> Nullable.toMaybe $ txBody_update a1 - , setAuxiliaryDataHash: txBody_setAuxiliaryDataHash - , auxiliaryDataHash: \a1 -> Nullable.toMaybe $ txBody_auxiliaryDataHash a1 - , setValidityStartInterval: txBody_setValidityStartInterval - , setValidityStartIntervalBignum: txBody_setValidityStartIntervalBignum - , validityStartIntervalBignum: \a1 -> Nullable.toMaybe $ txBody_validityStartIntervalBignum a1 - , validityStartInterval: \a1 -> Nullable.toMaybe $ txBody_validityStartInterval a1 - , setMint: txBody_setMint - , mint: \a1 -> Nullable.toMaybe $ txBody_mint a1 - , multiassets: \a1 -> Nullable.toMaybe $ txBody_multiassets a1 - , setReferenceIns: txBody_setReferenceIns - , referenceIns: \a1 -> Nullable.toMaybe $ txBody_referenceIns a1 - , setScriptDataHash: txBody_setScriptDataHash - , scriptDataHash: \a1 -> Nullable.toMaybe $ txBody_scriptDataHash a1 - , setCollateral: txBody_setCollateral - , collateral: \a1 -> Nullable.toMaybe $ txBody_collateral a1 - , setRequiredSigners: txBody_setRequiredSigners - , requiredSigners: \a1 -> Nullable.toMaybe $ txBody_requiredSigners a1 - , setNetworkId: txBody_setNetworkId - , networkId: \a1 -> Nullable.toMaybe $ txBody_networkId a1 - , setCollateralReturn: txBody_setCollateralReturn - , collateralReturn: \a1 -> Nullable.toMaybe $ txBody_collateralReturn a1 - , setTotalCollateral: txBody_setTotalCollateral - , totalCollateral: \a1 -> Nullable.toMaybe $ txBody_totalCollateral a1 - , new: txBody_new - , newTxBody: txBody_newTxBody - } - -instance HasFree TxBody where - free = txBody.free - -instance Show TxBody where - show = txBody.toHex - -instance ToJsValue TxBody where - toJsValue = txBody.toJsValue - -instance IsHex TxBody where - toHex = txBody.toHex - fromHex = txBody.fromHex - -instance IsBytes TxBody where - toBytes = txBody.toBytes - fromBytes = txBody.fromBytes - -instance IsJson TxBody where - toJson = txBody.toJson - fromJson = txBody.fromJson - -------------------------------------------------------------------------------------- --- Transaction builder - -foreign import txBuilder_free :: TxBuilder -> Effect Unit -foreign import txBuilder_addInsFrom :: TxBuilder -> TxUnspentOuts -> Number -> Effect Unit -foreign import txBuilder_setIns :: TxBuilder -> TxInsBuilder -> Effect Unit -foreign import txBuilder_setCollateral :: TxBuilder -> TxInsBuilder -> Effect Unit -foreign import txBuilder_setCollateralReturn :: TxBuilder -> TxOut -> Effect Unit -foreign import txBuilder_setCollateralReturnAndTotal :: TxBuilder -> TxOut -> Effect Unit -foreign import txBuilder_setTotalCollateral :: TxBuilder -> BigNum -> Effect Unit -foreign import txBuilder_setTotalCollateralAndReturn :: TxBuilder -> BigNum -> Address -> Effect Unit -foreign import txBuilder_addReferenceIn :: TxBuilder -> TxIn -> Effect Unit -foreign import txBuilder_addKeyIn :: TxBuilder -> Ed25519KeyHash -> TxIn -> Value -> Effect Unit -foreign import txBuilder_addScriptIn :: TxBuilder -> ScriptHash -> TxIn -> Value -> Effect Unit -foreign import txBuilder_addNativeScriptIn :: TxBuilder -> NativeScript -> TxIn -> Value -> Effect Unit -foreign import txBuilder_addPlutusScriptIn :: TxBuilder -> PlutusWitness -> TxIn -> Value -> Effect Unit -foreign import txBuilder_addBootstrapIn :: TxBuilder -> ByronAddress -> TxIn -> Value -> Effect Unit -foreign import txBuilder_addIn :: TxBuilder -> Address -> TxIn -> Value -> Effect Unit -foreign import txBuilder_countMissingInScripts :: TxBuilder -> Effect Number -foreign import txBuilder_addRequiredNativeInScripts :: TxBuilder -> NativeScripts -> Effect Number -foreign import txBuilder_addRequiredPlutusInScripts :: TxBuilder -> PlutusWitnesses -> Effect Number -foreign import txBuilder_getNativeInScripts :: TxBuilder -> Effect ((Nullable NativeScripts)) -foreign import txBuilder_getPlutusInScripts :: TxBuilder -> Effect ((Nullable PlutusWitnesses)) -foreign import txBuilder_feeForIn :: TxBuilder -> Address -> TxIn -> Value -> Effect BigNum -foreign import txBuilder_addOut :: TxBuilder -> TxOut -> Effect Unit -foreign import txBuilder_feeForOut :: TxBuilder -> TxOut -> Effect BigNum -foreign import txBuilder_setFee :: TxBuilder -> BigNum -> Effect Unit -foreign import txBuilder_setTtl :: TxBuilder -> Number -> Effect Unit -foreign import txBuilder_setTtlBignum :: TxBuilder -> BigNum -> Effect Unit -foreign import txBuilder_setValidityStartInterval :: TxBuilder -> Number -> Effect Unit -foreign import txBuilder_setValidityStartIntervalBignum :: TxBuilder -> BigNum -> Effect Unit -foreign import txBuilder_setCerts :: TxBuilder -> Certificates -> Effect Unit -foreign import txBuilder_setWithdrawals :: TxBuilder -> Withdrawals -> Effect Unit -foreign import txBuilder_getAuxiliaryData :: TxBuilder -> Effect ((Nullable AuxiliaryData)) -foreign import txBuilder_setAuxiliaryData :: TxBuilder -> AuxiliaryData -> Effect Unit -foreign import txBuilder_setMetadata :: TxBuilder -> GeneralTxMetadata -> Effect Unit -foreign import txBuilder_addMetadatum :: TxBuilder -> BigNum -> TxMetadatum -> Effect Unit -foreign import txBuilder_addJsonMetadatum :: TxBuilder -> BigNum -> String -> Effect Unit -foreign import txBuilder_addJsonMetadatumWithSchema :: TxBuilder -> BigNum -> String -> Number -> Effect Unit -foreign import txBuilder_setMint :: TxBuilder -> Mint -> NativeScripts -> Effect Unit -foreign import txBuilder_getMint :: TxBuilder -> Effect ((Nullable Mint)) -foreign import txBuilder_getMintScripts :: TxBuilder -> Effect ((Nullable NativeScripts)) -foreign import txBuilder_setMintAsset :: TxBuilder -> NativeScript -> MintAssets -> Effect Unit -foreign import txBuilder_addMintAsset :: TxBuilder -> NativeScript -> AssetName -> Int -> Effect Unit -foreign import txBuilder_addMintAssetAndOut :: TxBuilder -> NativeScript -> AssetName -> Int -> TxOutAmountBuilder -> BigNum -> Effect Unit -foreign import txBuilder_addMintAssetAndOutMinRequiredCoin :: TxBuilder -> NativeScript -> AssetName -> Int -> TxOutAmountBuilder -> Effect Unit -foreign import txBuilder_new :: TxBuilderConfig -> Effect TxBuilder -foreign import txBuilder_getReferenceIns :: TxBuilder -> Effect TxIns -foreign import txBuilder_getExplicitIn :: TxBuilder -> Effect Value -foreign import txBuilder_getImplicitIn :: TxBuilder -> Effect Value -foreign import txBuilder_getTotalIn :: TxBuilder -> Effect Value -foreign import txBuilder_getTotalOut :: TxBuilder -> Effect Value -foreign import txBuilder_getExplicitOut :: TxBuilder -> Effect Value -foreign import txBuilder_getDeposit :: TxBuilder -> Effect BigNum -foreign import txBuilder_getFeeIfSet :: TxBuilder -> Effect ((Nullable BigNum)) -foreign import txBuilder_addChangeIfNeeded :: TxBuilder -> Address -> Effect Boolean -foreign import txBuilder_calcScriptDataHash :: TxBuilder -> Costmdls -> Effect Unit -foreign import txBuilder_setScriptDataHash :: TxBuilder -> ScriptDataHash -> Effect Unit -foreign import txBuilder_removeScriptDataHash :: TxBuilder -> Effect Unit -foreign import txBuilder_addRequiredSigner :: TxBuilder -> Ed25519KeyHash -> Effect Unit -foreign import txBuilder_fullSize :: TxBuilder -> Effect Number -foreign import txBuilder_outSizes :: TxBuilder -> Effect Uint32Array -foreign import txBuilder_build :: TxBuilder -> Effect TxBody -foreign import txBuilder_buildTx :: TxBuilder -> Effect Tx -foreign import txBuilder_buildTxUnsafe :: TxBuilder -> Effect Tx -foreign import txBuilder_minFee :: TxBuilder -> Effect BigNum - --- | Transaction builder class -type TxBuilderClass = - { free :: TxBuilder -> Effect Unit - -- ^ Free - -- > free self - , addInsFrom :: TxBuilder -> TxUnspentOuts -> Number -> Effect Unit - -- ^ Add inputs from - -- > addInsFrom self ins strategy - , setIns :: TxBuilder -> TxInsBuilder -> Effect Unit - -- ^ Set inputs - -- > setIns self ins - , setCollateral :: TxBuilder -> TxInsBuilder -> Effect Unit - -- ^ Set collateral - -- > setCollateral self collateral - , setCollateralReturn :: TxBuilder -> TxOut -> Effect Unit - -- ^ Set collateral return - -- > setCollateralReturn self collateralReturn - , setCollateralReturnAndTotal :: TxBuilder -> TxOut -> Effect Unit - -- ^ Set collateral return and total - -- > setCollateralReturnAndTotal self collateralReturn - , setTotalCollateral :: TxBuilder -> BigNum -> Effect Unit - -- ^ Set total collateral - -- > setTotalCollateral self totalCollateral - , setTotalCollateralAndReturn :: TxBuilder -> BigNum -> Address -> Effect Unit - -- ^ Set total collateral and return - -- > setTotalCollateralAndReturn self totalCollateral returnAddress - , addReferenceIn :: TxBuilder -> TxIn -> Effect Unit - -- ^ Add reference input - -- > addReferenceIn self referenceIn - , addKeyIn :: TxBuilder -> Ed25519KeyHash -> TxIn -> Value -> Effect Unit - -- ^ Add key input - -- > addKeyIn self hash in amount - , addScriptIn :: TxBuilder -> ScriptHash -> TxIn -> Value -> Effect Unit - -- ^ Add script input - -- > addScriptIn self hash in amount - , addNativeScriptIn :: TxBuilder -> NativeScript -> TxIn -> Value -> Effect Unit - -- ^ Add native script input - -- > addNativeScriptIn self script in amount - , addPlutusScriptIn :: TxBuilder -> PlutusWitness -> TxIn -> Value -> Effect Unit - -- ^ Add plutus script input - -- > addPlutusScriptIn self witness in amount - , addBootstrapIn :: TxBuilder -> ByronAddress -> TxIn -> Value -> Effect Unit - -- ^ Add bootstrap input - -- > addBootstrapIn self hash in amount - , addIn :: TxBuilder -> Address -> TxIn -> Value -> Effect Unit - -- ^ Add input - -- > addIn self address in amount - , countMissingInScripts :: TxBuilder -> Effect Number - -- ^ Count missing input scripts - -- > countMissingInScripts self - , addRequiredNativeInScripts :: TxBuilder -> NativeScripts -> Effect Number - -- ^ Add required native input scripts - -- > addRequiredNativeInScripts self scripts - , addRequiredPlutusInScripts :: TxBuilder -> PlutusWitnesses -> Effect Number - -- ^ Add required plutus input scripts - -- > addRequiredPlutusInScripts self scripts - , getNativeInScripts :: TxBuilder -> Effect ((Maybe NativeScripts)) - -- ^ Get native input scripts - -- > getNativeInScripts self - , getPlutusInScripts :: TxBuilder -> Effect ((Maybe PlutusWitnesses)) - -- ^ Get plutus input scripts - -- > getPlutusInScripts self - , feeForIn :: TxBuilder -> Address -> TxIn -> Value -> Effect BigNum - -- ^ Fee for input - -- > feeForIn self address in amount - , addOut :: TxBuilder -> TxOut -> Effect Unit - -- ^ Add output - -- > addOut self out - , feeForOut :: TxBuilder -> TxOut -> Effect BigNum - -- ^ Fee for output - -- > feeForOut self out - , setFee :: TxBuilder -> BigNum -> Effect Unit - -- ^ Set fee - -- > setFee self fee - , setTtl :: TxBuilder -> Number -> Effect Unit - -- ^ Set ttl - -- > setTtl self ttl - , setTtlBignum :: TxBuilder -> BigNum -> Effect Unit - -- ^ Set ttl bignum - -- > setTtlBignum self ttl - , setValidityStartInterval :: TxBuilder -> Number -> Effect Unit - -- ^ Set validity start interval - -- > setValidityStartInterval self validityStartInterval - , setValidityStartIntervalBignum :: TxBuilder -> BigNum -> Effect Unit - -- ^ Set validity start interval bignum - -- > setValidityStartIntervalBignum self validityStartInterval - , setCerts :: TxBuilder -> Certificates -> Effect Unit - -- ^ Set certs - -- > setCerts self certs - , setWithdrawals :: TxBuilder -> Withdrawals -> Effect Unit - -- ^ Set withdrawals - -- > setWithdrawals self withdrawals - , getAuxiliaryData :: TxBuilder -> Effect ((Maybe AuxiliaryData)) - -- ^ Get auxiliary data - -- > getAuxiliaryData self - , setAuxiliaryData :: TxBuilder -> AuxiliaryData -> Effect Unit - -- ^ Set auxiliary data - -- > setAuxiliaryData self auxiliaryData - , setMetadata :: TxBuilder -> GeneralTxMetadata -> Effect Unit - -- ^ Set metadata - -- > setMetadata self metadata - , addMetadatum :: TxBuilder -> BigNum -> TxMetadatum -> Effect Unit - -- ^ Add metadatum - -- > addMetadatum self key val - , addJsonMetadatum :: TxBuilder -> BigNum -> String -> Effect Unit - -- ^ Add json metadatum - -- > addJsonMetadatum self key val - , addJsonMetadatumWithSchema :: TxBuilder -> BigNum -> String -> Number -> Effect Unit - -- ^ Add json metadatum with schema - -- > addJsonMetadatumWithSchema self key val schema - , setMint :: TxBuilder -> Mint -> NativeScripts -> Effect Unit - -- ^ Set mint - -- > setMint self mint mintScripts - , getMint :: TxBuilder -> Effect ((Maybe Mint)) - -- ^ Get mint - -- > getMint self - , getMintScripts :: TxBuilder -> Effect ((Maybe NativeScripts)) - -- ^ Get mint scripts - -- > getMintScripts self - , setMintAsset :: TxBuilder -> NativeScript -> MintAssets -> Effect Unit - -- ^ Set mint asset - -- > setMintAsset self policyScript mintAssets - , addMintAsset :: TxBuilder -> NativeScript -> AssetName -> Int -> Effect Unit - -- ^ Add mint asset - -- > addMintAsset self policyScript assetName amount - , addMintAssetAndOut :: TxBuilder -> NativeScript -> AssetName -> Int -> TxOutAmountBuilder -> BigNum -> Effect Unit - -- ^ Add mint asset and output - -- > addMintAssetAndOut self policyScript assetName amount outBuilder outCoin - , addMintAssetAndOutMinRequiredCoin :: TxBuilder -> NativeScript -> AssetName -> Int -> TxOutAmountBuilder -> Effect Unit - -- ^ Add mint asset and output min required coin - -- > addMintAssetAndOutMinRequiredCoin self policyScript assetName amount outBuilder - , new :: TxBuilderConfig -> Effect TxBuilder - -- ^ New - -- > new cfg - , getReferenceIns :: TxBuilder -> Effect TxIns - -- ^ Get reference inputs - -- > getReferenceIns self - , getExplicitIn :: TxBuilder -> Effect Value - -- ^ Get explicit input - -- > getExplicitIn self - , getImplicitIn :: TxBuilder -> Effect Value - -- ^ Get implicit input - -- > getImplicitIn self - , getTotalIn :: TxBuilder -> Effect Value - -- ^ Get total input - -- > getTotalIn self - , getTotalOut :: TxBuilder -> Effect Value - -- ^ Get total output - -- > getTotalOut self - , getExplicitOut :: TxBuilder -> Effect Value - -- ^ Get explicit output - -- > getExplicitOut self - , getDeposit :: TxBuilder -> Effect BigNum - -- ^ Get deposit - -- > getDeposit self - , getFeeIfSet :: TxBuilder -> Effect ((Maybe BigNum)) - -- ^ Get fee if set - -- > getFeeIfSet self - , addChangeIfNeeded :: TxBuilder -> Address -> Effect Boolean - -- ^ Add change if needed - -- > addChangeIfNeeded self address - , calcScriptDataHash :: TxBuilder -> Costmdls -> Effect Unit - -- ^ Calc script data hash - -- > calcScriptDataHash self costModels - , setScriptDataHash :: TxBuilder -> ScriptDataHash -> Effect Unit - -- ^ Set script data hash - -- > setScriptDataHash self hash - , removeScriptDataHash :: TxBuilder -> Effect Unit - -- ^ Remove script data hash - -- > removeScriptDataHash self - , addRequiredSigner :: TxBuilder -> Ed25519KeyHash -> Effect Unit - -- ^ Add required signer - -- > addRequiredSigner self key - , fullSize :: TxBuilder -> Effect Number - -- ^ Full size - -- > fullSize self - , outSizes :: TxBuilder -> Effect Uint32Array - -- ^ Output sizes - -- > outSizes self - , build :: TxBuilder -> Effect TxBody - -- ^ Build - -- > build self - , buildTx :: TxBuilder -> Effect Tx - -- ^ Build tx - -- > buildTx self - , buildTxUnsafe :: TxBuilder -> Effect Tx - -- ^ Build tx unsafe - -- > buildTxUnsafe self - , minFee :: TxBuilder -> Effect BigNum - -- ^ Min fee - -- > minFee self - } - --- | Transaction builder class API -txBuilder :: TxBuilderClass -txBuilder = - { free: txBuilder_free - , addInsFrom: txBuilder_addInsFrom - , setIns: txBuilder_setIns - , setCollateral: txBuilder_setCollateral - , setCollateralReturn: txBuilder_setCollateralReturn - , setCollateralReturnAndTotal: txBuilder_setCollateralReturnAndTotal - , setTotalCollateral: txBuilder_setTotalCollateral - , setTotalCollateralAndReturn: txBuilder_setTotalCollateralAndReturn - , addReferenceIn: txBuilder_addReferenceIn - , addKeyIn: txBuilder_addKeyIn - , addScriptIn: txBuilder_addScriptIn - , addNativeScriptIn: txBuilder_addNativeScriptIn - , addPlutusScriptIn: txBuilder_addPlutusScriptIn - , addBootstrapIn: txBuilder_addBootstrapIn - , addIn: txBuilder_addIn - , countMissingInScripts: txBuilder_countMissingInScripts - , addRequiredNativeInScripts: txBuilder_addRequiredNativeInScripts - , addRequiredPlutusInScripts: txBuilder_addRequiredPlutusInScripts - , getNativeInScripts: \a1 -> Nullable.toMaybe <$> txBuilder_getNativeInScripts a1 - , getPlutusInScripts: \a1 -> Nullable.toMaybe <$> txBuilder_getPlutusInScripts a1 - , feeForIn: txBuilder_feeForIn - , addOut: txBuilder_addOut - , feeForOut: txBuilder_feeForOut - , setFee: txBuilder_setFee - , setTtl: txBuilder_setTtl - , setTtlBignum: txBuilder_setTtlBignum - , setValidityStartInterval: txBuilder_setValidityStartInterval - , setValidityStartIntervalBignum: txBuilder_setValidityStartIntervalBignum - , setCerts: txBuilder_setCerts - , setWithdrawals: txBuilder_setWithdrawals - , getAuxiliaryData: \a1 -> Nullable.toMaybe <$> txBuilder_getAuxiliaryData a1 - , setAuxiliaryData: txBuilder_setAuxiliaryData - , setMetadata: txBuilder_setMetadata - , addMetadatum: txBuilder_addMetadatum - , addJsonMetadatum: txBuilder_addJsonMetadatum - , addJsonMetadatumWithSchema: txBuilder_addJsonMetadatumWithSchema - , setMint: txBuilder_setMint - , getMint: \a1 -> Nullable.toMaybe <$> txBuilder_getMint a1 - , getMintScripts: \a1 -> Nullable.toMaybe <$> txBuilder_getMintScripts a1 - , setMintAsset: txBuilder_setMintAsset - , addMintAsset: txBuilder_addMintAsset - , addMintAssetAndOut: txBuilder_addMintAssetAndOut - , addMintAssetAndOutMinRequiredCoin: txBuilder_addMintAssetAndOutMinRequiredCoin - , new: txBuilder_new - , getReferenceIns: txBuilder_getReferenceIns - , getExplicitIn: txBuilder_getExplicitIn - , getImplicitIn: txBuilder_getImplicitIn - , getTotalIn: txBuilder_getTotalIn - , getTotalOut: txBuilder_getTotalOut - , getExplicitOut: txBuilder_getExplicitOut - , getDeposit: txBuilder_getDeposit - , getFeeIfSet: \a1 -> Nullable.toMaybe <$> txBuilder_getFeeIfSet a1 - , addChangeIfNeeded: txBuilder_addChangeIfNeeded - , calcScriptDataHash: txBuilder_calcScriptDataHash - , setScriptDataHash: txBuilder_setScriptDataHash - , removeScriptDataHash: txBuilder_removeScriptDataHash - , addRequiredSigner: txBuilder_addRequiredSigner - , fullSize: txBuilder_fullSize - , outSizes: txBuilder_outSizes - , build: txBuilder_build - , buildTx: txBuilder_buildTx - , buildTxUnsafe: txBuilder_buildTxUnsafe - , minFee: txBuilder_minFee - } - -instance HasFree TxBuilder where - free = txBuilder.free - -------------------------------------------------------------------------------------- --- Transaction builder config - -foreign import txBuilderConfig_free :: TxBuilderConfig -> Effect Unit - --- | Transaction builder config class -type TxBuilderConfigClass = - { free :: TxBuilderConfig -> Effect Unit - -- ^ Free - -- > free self - } - --- | Transaction builder config class API -txBuilderConfig :: TxBuilderConfigClass -txBuilderConfig = - { free: txBuilderConfig_free - } - -instance HasFree TxBuilderConfig where - free = txBuilderConfig.free - -------------------------------------------------------------------------------------- --- Transaction builder config builder - -foreign import txBuilderConfigBuilder_free :: TxBuilderConfigBuilder -> Effect Unit -foreign import txBuilderConfigBuilder_new :: TxBuilderConfigBuilder -foreign import txBuilderConfigBuilder_feeAlgo :: TxBuilderConfigBuilder -> LinearFee -> TxBuilderConfigBuilder -foreign import txBuilderConfigBuilder_coinsPerUtxoWord :: TxBuilderConfigBuilder -> BigNum -> TxBuilderConfigBuilder -foreign import txBuilderConfigBuilder_coinsPerUtxoByte :: TxBuilderConfigBuilder -> BigNum -> TxBuilderConfigBuilder -foreign import txBuilderConfigBuilder_exUnitPrices :: TxBuilderConfigBuilder -> ExUnitPrices -> TxBuilderConfigBuilder -foreign import txBuilderConfigBuilder_poolDeposit :: TxBuilderConfigBuilder -> BigNum -> TxBuilderConfigBuilder -foreign import txBuilderConfigBuilder_keyDeposit :: TxBuilderConfigBuilder -> BigNum -> TxBuilderConfigBuilder -foreign import txBuilderConfigBuilder_maxValueSize :: TxBuilderConfigBuilder -> Int -> TxBuilderConfigBuilder -foreign import txBuilderConfigBuilder_maxTxSize :: TxBuilderConfigBuilder -> Int -> TxBuilderConfigBuilder -foreign import txBuilderConfigBuilder_preferPureChange :: TxBuilderConfigBuilder -> Boolean -> TxBuilderConfigBuilder -foreign import txBuilderConfigBuilder_build :: TxBuilderConfigBuilder -> TxBuilderConfig - --- | Transaction builder config builder class -type TxBuilderConfigBuilderClass = - { free :: TxBuilderConfigBuilder -> Effect Unit - -- ^ Free - -- > free self - , new :: TxBuilderConfigBuilder - -- ^ New - -- > new - , feeAlgo :: TxBuilderConfigBuilder -> LinearFee -> TxBuilderConfigBuilder - -- ^ Fee algo - -- > feeAlgo self feeAlgo - , coinsPerUtxoWord :: TxBuilderConfigBuilder -> BigNum -> TxBuilderConfigBuilder - -- ^ Coins per utxo word - -- > coinsPerUtxoWord self coinsPerUtxoWord - , coinsPerUtxoByte :: TxBuilderConfigBuilder -> BigNum -> TxBuilderConfigBuilder - -- ^ Coins per utxo byte - -- > coinsPerUtxoByte self coinsPerUtxoByte - , exUnitPrices :: TxBuilderConfigBuilder -> ExUnitPrices -> TxBuilderConfigBuilder - -- ^ Ex unit prices - -- > exUnitPrices self exUnitPrices - , poolDeposit :: TxBuilderConfigBuilder -> BigNum -> TxBuilderConfigBuilder - -- ^ Pool deposit - -- > poolDeposit self poolDeposit - , keyDeposit :: TxBuilderConfigBuilder -> BigNum -> TxBuilderConfigBuilder - -- ^ Key deposit - -- > keyDeposit self keyDeposit - , maxValueSize :: TxBuilderConfigBuilder -> Int -> TxBuilderConfigBuilder - -- ^ Max value size - -- > maxValueSize self maxValueSize - , maxTxSize :: TxBuilderConfigBuilder -> Int -> TxBuilderConfigBuilder - -- ^ Max tx size - -- > maxTxSize self maxTxSize - , preferPureChange :: TxBuilderConfigBuilder -> Boolean -> TxBuilderConfigBuilder - -- ^ Prefer pure change - -- > preferPureChange self preferPureChange - , build :: TxBuilderConfigBuilder -> TxBuilderConfig - -- ^ Build - -- > build self - } - --- | Transaction builder config builder class API -txBuilderConfigBuilder :: TxBuilderConfigBuilderClass -txBuilderConfigBuilder = - { free: txBuilderConfigBuilder_free - , new: txBuilderConfigBuilder_new - , feeAlgo: txBuilderConfigBuilder_feeAlgo - , coinsPerUtxoWord: txBuilderConfigBuilder_coinsPerUtxoWord - , coinsPerUtxoByte: txBuilderConfigBuilder_coinsPerUtxoByte - , exUnitPrices: txBuilderConfigBuilder_exUnitPrices - , poolDeposit: txBuilderConfigBuilder_poolDeposit - , keyDeposit: txBuilderConfigBuilder_keyDeposit - , maxValueSize: txBuilderConfigBuilder_maxValueSize - , maxTxSize: txBuilderConfigBuilder_maxTxSize - , preferPureChange: txBuilderConfigBuilder_preferPureChange - , build: txBuilderConfigBuilder_build - } - -instance HasFree TxBuilderConfigBuilder where - free = txBuilderConfigBuilder.free - -------------------------------------------------------------------------------------- --- Transaction hash - -foreign import txHash_free :: TxHash -> Effect Unit -foreign import txHash_fromBytes :: Bytes -> ForeignErrorable TxHash -foreign import txHash_toBytes :: TxHash -> Bytes -foreign import txHash_toBech32 :: TxHash -> String -> String -foreign import txHash_fromBech32 :: String -> ForeignErrorable TxHash -foreign import txHash_toHex :: TxHash -> String -foreign import txHash_fromHex :: String -> ForeignErrorable TxHash - --- | Transaction hash class -type TxHashClass = - { free :: TxHash -> Effect Unit - -- ^ Free - -- > free self - , fromBytes :: Bytes -> Maybe TxHash - -- ^ From bytes - -- > fromBytes bytes - , toBytes :: TxHash -> Bytes - -- ^ To bytes - -- > toBytes self - , toBech32 :: TxHash -> String -> String - -- ^ To bech32 - -- > toBech32 self prefix - , fromBech32 :: String -> Maybe TxHash - -- ^ From bech32 - -- > fromBech32 bechStr - , toHex :: TxHash -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe TxHash - -- ^ From hex - -- > fromHex hex - } - --- | Transaction hash class API -txHash :: TxHashClass -txHash = - { free: txHash_free - , fromBytes: \a1 -> runForeignMaybe $ txHash_fromBytes a1 - , toBytes: txHash_toBytes - , toBech32: txHash_toBech32 - , fromBech32: \a1 -> runForeignMaybe $ txHash_fromBech32 a1 - , toHex: txHash_toHex - , fromHex: \a1 -> runForeignMaybe $ txHash_fromHex a1 - } - -instance HasFree TxHash where - free = txHash.free - -instance Show TxHash where - show = txHash.toHex - -instance IsHex TxHash where - toHex = txHash.toHex - fromHex = txHash.fromHex - -instance IsBytes TxHash where - toBytes = txHash.toBytes - fromBytes = txHash.fromBytes - -------------------------------------------------------------------------------------- --- Transaction input - -foreign import txIn_free :: TxIn -> Effect Unit -foreign import txIn_toBytes :: TxIn -> Bytes -foreign import txIn_fromBytes :: Bytes -> ForeignErrorable TxIn -foreign import txIn_toHex :: TxIn -> String -foreign import txIn_fromHex :: String -> ForeignErrorable TxIn -foreign import txIn_toJson :: TxIn -> String -foreign import txIn_toJsValue :: TxIn -> TxInJson -foreign import txIn_fromJson :: String -> ForeignErrorable TxIn -foreign import txIn_txId :: TxIn -> TxHash -foreign import txIn_index :: TxIn -> Number -foreign import txIn_new :: TxHash -> Number -> TxIn - --- | Transaction input class -type TxInClass = - { free :: TxIn -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: TxIn -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe TxIn - -- ^ From bytes - -- > fromBytes bytes - , toHex :: TxIn -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe TxIn - -- ^ From hex - -- > fromHex hexStr - , toJson :: TxIn -> String - -- ^ To json - -- > toJson self - , toJsValue :: TxIn -> TxInJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe TxIn - -- ^ From json - -- > fromJson json - , txId :: TxIn -> TxHash - -- ^ Transaction id - -- > txId self - , index :: TxIn -> Number - -- ^ Index - -- > index self - , new :: TxHash -> Number -> TxIn - -- ^ New - -- > new txId index - } - --- | Transaction input class API -txIn :: TxInClass -txIn = - { free: txIn_free - , toBytes: txIn_toBytes - , fromBytes: \a1 -> runForeignMaybe $ txIn_fromBytes a1 - , toHex: txIn_toHex - , fromHex: \a1 -> runForeignMaybe $ txIn_fromHex a1 - , toJson: txIn_toJson - , toJsValue: txIn_toJsValue - , fromJson: \a1 -> runForeignMaybe $ txIn_fromJson a1 - , txId: txIn_txId - , index: txIn_index - , new: txIn_new - } - -instance HasFree TxIn where - free = txIn.free - -instance Show TxIn where - show = txIn.toHex - -instance ToJsValue TxIn where - toJsValue = txIn.toJsValue - -instance IsHex TxIn where - toHex = txIn.toHex - fromHex = txIn.fromHex - -instance IsBytes TxIn where - toBytes = txIn.toBytes - fromBytes = txIn.fromBytes - -instance IsJson TxIn where - toJson = txIn.toJson - fromJson = txIn.fromJson - -------------------------------------------------------------------------------------- --- Transaction inputs - -foreign import txIns_free :: TxIns -> Effect Unit -foreign import txIns_toBytes :: TxIns -> Bytes -foreign import txIns_fromBytes :: Bytes -> ForeignErrorable TxIns -foreign import txIns_toHex :: TxIns -> String -foreign import txIns_fromHex :: String -> ForeignErrorable TxIns -foreign import txIns_toJson :: TxIns -> String -foreign import txIns_toJsValue :: TxIns -> TxInsJson -foreign import txIns_fromJson :: String -> ForeignErrorable TxIns -foreign import txIns_new :: Effect TxIns -foreign import txIns_len :: TxIns -> Effect Int -foreign import txIns_get :: TxIns -> Int -> Effect TxIn -foreign import txIns_add :: TxIns -> TxIn -> Effect Unit -foreign import txIns_toOption :: TxIns -> Nullable TxIns - --- | Transaction inputs class -type TxInsClass = - { free :: TxIns -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: TxIns -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe TxIns - -- ^ From bytes - -- > fromBytes bytes - , toHex :: TxIns -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe TxIns - -- ^ From hex - -- > fromHex hexStr - , toJson :: TxIns -> String - -- ^ To json - -- > toJson self - , toJsValue :: TxIns -> TxInsJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe TxIns - -- ^ From json - -- > fromJson json - , new :: Effect TxIns - -- ^ New - -- > new - , len :: TxIns -> Effect Int - -- ^ Len - -- > len self - , get :: TxIns -> Int -> Effect TxIn - -- ^ Get - -- > get self index - , add :: TxIns -> TxIn -> Effect Unit - -- ^ Add - -- > add self elem - , toOption :: TxIns -> Maybe TxIns - -- ^ To option - -- > toOption self - } - --- | Transaction inputs class API -txIns :: TxInsClass -txIns = - { free: txIns_free - , toBytes: txIns_toBytes - , fromBytes: \a1 -> runForeignMaybe $ txIns_fromBytes a1 - , toHex: txIns_toHex - , fromHex: \a1 -> runForeignMaybe $ txIns_fromHex a1 - , toJson: txIns_toJson - , toJsValue: txIns_toJsValue - , fromJson: \a1 -> runForeignMaybe $ txIns_fromJson a1 - , new: txIns_new - , len: txIns_len - , get: txIns_get - , add: txIns_add - , toOption: \a1 -> Nullable.toMaybe $ txIns_toOption a1 - } - -instance HasFree TxIns where - free = txIns.free - -instance Show TxIns where - show = txIns.toHex - -instance MutableList TxIns TxIn where - addItem = txIns.add - getItem = txIns.get - emptyList = txIns.new - -instance MutableLen TxIns where - getLen = txIns.len - - -instance ToJsValue TxIns where - toJsValue = txIns.toJsValue - -instance IsHex TxIns where - toHex = txIns.toHex - fromHex = txIns.fromHex - -instance IsBytes TxIns where - toBytes = txIns.toBytes - fromBytes = txIns.fromBytes - -instance IsJson TxIns where - toJson = txIns.toJson - fromJson = txIns.fromJson - -------------------------------------------------------------------------------------- --- Transaction metadatum - -foreign import txMetadatum_free :: TxMetadatum -> Effect Unit -foreign import txMetadatum_toBytes :: TxMetadatum -> Bytes -foreign import txMetadatum_fromBytes :: Bytes -> ForeignErrorable TxMetadatum -foreign import txMetadatum_toHex :: TxMetadatum -> String -foreign import txMetadatum_fromHex :: String -> ForeignErrorable TxMetadatum -foreign import txMetadatum_newMap :: MetadataMap -> TxMetadatum -foreign import txMetadatum_newList :: MetadataList -> TxMetadatum -foreign import txMetadatum_newInt :: Int -> TxMetadatum -foreign import txMetadatum_newBytes :: Bytes -> TxMetadatum -foreign import txMetadatum_newText :: String -> TxMetadatum -foreign import txMetadatum_kind :: TxMetadatum -> Number -foreign import txMetadatum_asMap :: TxMetadatum -> MetadataMap -foreign import txMetadatum_asList :: TxMetadatum -> MetadataList -foreign import txMetadatum_asInt :: TxMetadatum -> Int -foreign import txMetadatum_asBytes :: TxMetadatum -> Bytes -foreign import txMetadatum_asText :: TxMetadatum -> String - --- | Transaction metadatum class -type TxMetadatumClass = - { free :: TxMetadatum -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: TxMetadatum -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe TxMetadatum - -- ^ From bytes - -- > fromBytes bytes - , toHex :: TxMetadatum -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe TxMetadatum - -- ^ From hex - -- > fromHex hexStr - , newMap :: MetadataMap -> TxMetadatum - -- ^ New map - -- > newMap map - , newList :: MetadataList -> TxMetadatum - -- ^ New list - -- > newList list - , newInt :: Int -> TxMetadatum - -- ^ New int - -- > newInt int - , newBytes :: Bytes -> TxMetadatum - -- ^ New bytes - -- > newBytes bytes - , newText :: String -> TxMetadatum - -- ^ New text - -- > newText text - , kind :: TxMetadatum -> Number - -- ^ Kind - -- > kind self - , asMap :: TxMetadatum -> MetadataMap - -- ^ As map - -- > asMap self - , asList :: TxMetadatum -> MetadataList - -- ^ As list - -- > asList self - , asInt :: TxMetadatum -> Int - -- ^ As int - -- > asInt self - , asBytes :: TxMetadatum -> Bytes - -- ^ As bytes - -- > asBytes self - , asText :: TxMetadatum -> String - -- ^ As text - -- > asText self - } - --- | Transaction metadatum class API -txMetadatum :: TxMetadatumClass -txMetadatum = - { free: txMetadatum_free - , toBytes: txMetadatum_toBytes - , fromBytes: \a1 -> runForeignMaybe $ txMetadatum_fromBytes a1 - , toHex: txMetadatum_toHex - , fromHex: \a1 -> runForeignMaybe $ txMetadatum_fromHex a1 - , newMap: txMetadatum_newMap - , newList: txMetadatum_newList - , newInt: txMetadatum_newInt - , newBytes: txMetadatum_newBytes - , newText: txMetadatum_newText - , kind: txMetadatum_kind - , asMap: txMetadatum_asMap - , asList: txMetadatum_asList - , asInt: txMetadatum_asInt - , asBytes: txMetadatum_asBytes - , asText: txMetadatum_asText - } - -instance HasFree TxMetadatum where - free = txMetadatum.free - -instance Show TxMetadatum where - show = txMetadatum.toHex - -instance IsHex TxMetadatum where - toHex = txMetadatum.toHex - fromHex = txMetadatum.fromHex - -instance IsBytes TxMetadatum where - toBytes = txMetadatum.toBytes - fromBytes = txMetadatum.fromBytes - -------------------------------------------------------------------------------------- --- Transaction metadatum labels - -foreign import txMetadatumLabels_free :: TxMetadatumLabels -> Effect Unit -foreign import txMetadatumLabels_toBytes :: TxMetadatumLabels -> Bytes -foreign import txMetadatumLabels_fromBytes :: Bytes -> ForeignErrorable TxMetadatumLabels -foreign import txMetadatumLabels_toHex :: TxMetadatumLabels -> String -foreign import txMetadatumLabels_fromHex :: String -> ForeignErrorable TxMetadatumLabels -foreign import txMetadatumLabels_new :: Effect TxMetadatumLabels -foreign import txMetadatumLabels_len :: TxMetadatumLabels -> Effect Int -foreign import txMetadatumLabels_get :: TxMetadatumLabels -> Int -> Effect BigNum -foreign import txMetadatumLabels_add :: TxMetadatumLabels -> BigNum -> Effect Unit - --- | Transaction metadatum labels class -type TxMetadatumLabelsClass = - { free :: TxMetadatumLabels -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: TxMetadatumLabels -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe TxMetadatumLabels - -- ^ From bytes - -- > fromBytes bytes - , toHex :: TxMetadatumLabels -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe TxMetadatumLabels - -- ^ From hex - -- > fromHex hexStr - , new :: Effect TxMetadatumLabels - -- ^ New - -- > new - , len :: TxMetadatumLabels -> Effect Int - -- ^ Len - -- > len self - , get :: TxMetadatumLabels -> Int -> Effect BigNum - -- ^ Get - -- > get self index - , add :: TxMetadatumLabels -> BigNum -> Effect Unit - -- ^ Add - -- > add self elem - } - --- | Transaction metadatum labels class API -txMetadatumLabels :: TxMetadatumLabelsClass -txMetadatumLabels = - { free: txMetadatumLabels_free - , toBytes: txMetadatumLabels_toBytes - , fromBytes: \a1 -> runForeignMaybe $ txMetadatumLabels_fromBytes a1 - , toHex: txMetadatumLabels_toHex - , fromHex: \a1 -> runForeignMaybe $ txMetadatumLabels_fromHex a1 - , new: txMetadatumLabels_new - , len: txMetadatumLabels_len - , get: txMetadatumLabels_get - , add: txMetadatumLabels_add - } - -instance HasFree TxMetadatumLabels where - free = txMetadatumLabels.free - -instance Show TxMetadatumLabels where - show = txMetadatumLabels.toHex - -instance MutableList TxMetadatumLabels BigNum where - addItem = txMetadatumLabels.add - getItem = txMetadatumLabels.get - emptyList = txMetadatumLabels.new - -instance MutableLen TxMetadatumLabels where - getLen = txMetadatumLabels.len - - -instance IsHex TxMetadatumLabels where - toHex = txMetadatumLabels.toHex - fromHex = txMetadatumLabels.fromHex - -instance IsBytes TxMetadatumLabels where - toBytes = txMetadatumLabels.toBytes - fromBytes = txMetadatumLabels.fromBytes - -------------------------------------------------------------------------------------- --- Transaction output - -foreign import txOut_free :: TxOut -> Effect Unit -foreign import txOut_toBytes :: TxOut -> Bytes -foreign import txOut_fromBytes :: Bytes -> ForeignErrorable TxOut -foreign import txOut_toHex :: TxOut -> String -foreign import txOut_fromHex :: String -> ForeignErrorable TxOut -foreign import txOut_toJson :: TxOut -> String -foreign import txOut_toJsValue :: TxOut -> TxOutJson -foreign import txOut_fromJson :: String -> ForeignErrorable TxOut -foreign import txOut_address :: TxOut -> Address -foreign import txOut_amount :: TxOut -> Value -foreign import txOut_dataHash :: TxOut -> Nullable DataHash -foreign import txOut_plutusData :: TxOut -> Nullable PlutusData -foreign import txOut_scriptRef :: TxOut -> Nullable ScriptRef -foreign import txOut_setScriptRef :: TxOut -> ScriptRef -> Effect Unit -foreign import txOut_setPlutusData :: TxOut -> PlutusData -> Effect Unit -foreign import txOut_setDataHash :: TxOut -> DataHash -> Effect Unit -foreign import txOut_hasPlutusData :: TxOut -> Boolean -foreign import txOut_hasDataHash :: TxOut -> Boolean -foreign import txOut_hasScriptRef :: TxOut -> Boolean -foreign import txOut_new :: Address -> Value -> TxOut - --- | Transaction output class -type TxOutClass = - { free :: TxOut -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: TxOut -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe TxOut - -- ^ From bytes - -- > fromBytes bytes - , toHex :: TxOut -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe TxOut - -- ^ From hex - -- > fromHex hexStr - , toJson :: TxOut -> String - -- ^ To json - -- > toJson self - , toJsValue :: TxOut -> TxOutJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe TxOut - -- ^ From json - -- > fromJson json - , address :: TxOut -> Address - -- ^ Address - -- > address self - , amount :: TxOut -> Value - -- ^ Amount - -- > amount self - , dataHash :: TxOut -> Maybe DataHash - -- ^ Data hash - -- > dataHash self - , plutusData :: TxOut -> Maybe PlutusData - -- ^ Plutus data - -- > plutusData self - , scriptRef :: TxOut -> Maybe ScriptRef - -- ^ Script ref - -- > scriptRef self - , setScriptRef :: TxOut -> ScriptRef -> Effect Unit - -- ^ Set script ref - -- > setScriptRef self scriptRef - , setPlutusData :: TxOut -> PlutusData -> Effect Unit - -- ^ Set plutus data - -- > setPlutusData self data - , setDataHash :: TxOut -> DataHash -> Effect Unit - -- ^ Set data hash - -- > setDataHash self dataHash - , hasPlutusData :: TxOut -> Boolean - -- ^ Has plutus data - -- > hasPlutusData self - , hasDataHash :: TxOut -> Boolean - -- ^ Has data hash - -- > hasDataHash self - , hasScriptRef :: TxOut -> Boolean - -- ^ Has script ref - -- > hasScriptRef self - , new :: Address -> Value -> TxOut - -- ^ New - -- > new address amount - } - --- | Transaction output class API -txOut :: TxOutClass -txOut = - { free: txOut_free - , toBytes: txOut_toBytes - , fromBytes: \a1 -> runForeignMaybe $ txOut_fromBytes a1 - , toHex: txOut_toHex - , fromHex: \a1 -> runForeignMaybe $ txOut_fromHex a1 - , toJson: txOut_toJson - , toJsValue: txOut_toJsValue - , fromJson: \a1 -> runForeignMaybe $ txOut_fromJson a1 - , address: txOut_address - , amount: txOut_amount - , dataHash: \a1 -> Nullable.toMaybe $ txOut_dataHash a1 - , plutusData: \a1 -> Nullable.toMaybe $ txOut_plutusData a1 - , scriptRef: \a1 -> Nullable.toMaybe $ txOut_scriptRef a1 - , setScriptRef: txOut_setScriptRef - , setPlutusData: txOut_setPlutusData - , setDataHash: txOut_setDataHash - , hasPlutusData: txOut_hasPlutusData - , hasDataHash: txOut_hasDataHash - , hasScriptRef: txOut_hasScriptRef - , new: txOut_new - } - -instance HasFree TxOut where - free = txOut.free - -instance Show TxOut where - show = txOut.toHex - -instance ToJsValue TxOut where - toJsValue = txOut.toJsValue - -instance IsHex TxOut where - toHex = txOut.toHex - fromHex = txOut.fromHex - -instance IsBytes TxOut where - toBytes = txOut.toBytes - fromBytes = txOut.fromBytes - -instance IsJson TxOut where - toJson = txOut.toJson - fromJson = txOut.fromJson - -------------------------------------------------------------------------------------- --- Transaction output amount builder - -foreign import txOutAmountBuilder_free :: TxOutAmountBuilder -> Effect Unit -foreign import txOutAmountBuilder_withValue :: TxOutAmountBuilder -> Value -> TxOutAmountBuilder -foreign import txOutAmountBuilder_withCoin :: TxOutAmountBuilder -> BigNum -> TxOutAmountBuilder -foreign import txOutAmountBuilder_withCoinAndAsset :: TxOutAmountBuilder -> BigNum -> MultiAsset -> TxOutAmountBuilder -foreign import txOutAmountBuilder_withAssetAndMinRequiredCoin :: TxOutAmountBuilder -> MultiAsset -> BigNum -> TxOutAmountBuilder -foreign import txOutAmountBuilder_withAssetAndMinRequiredCoinByUtxoCost :: TxOutAmountBuilder -> MultiAsset -> DataCost -> TxOutAmountBuilder -foreign import txOutAmountBuilder_build :: TxOutAmountBuilder -> TxOut - --- | Transaction output amount builder class -type TxOutAmountBuilderClass = - { free :: TxOutAmountBuilder -> Effect Unit - -- ^ Free - -- > free self - , withValue :: TxOutAmountBuilder -> Value -> TxOutAmountBuilder - -- ^ With value - -- > withValue self amount - , withCoin :: TxOutAmountBuilder -> BigNum -> TxOutAmountBuilder - -- ^ With coin - -- > withCoin self coin - , withCoinAndAsset :: TxOutAmountBuilder -> BigNum -> MultiAsset -> TxOutAmountBuilder - -- ^ With coin and asset - -- > withCoinAndAsset self coin multiasset - , withAssetAndMinRequiredCoin :: TxOutAmountBuilder -> MultiAsset -> BigNum -> TxOutAmountBuilder - -- ^ With asset and min required coin - -- > withAssetAndMinRequiredCoin self multiasset coinsPerUtxoWord - , withAssetAndMinRequiredCoinByUtxoCost :: TxOutAmountBuilder -> MultiAsset -> DataCost -> TxOutAmountBuilder - -- ^ With asset and min required coin by utxo cost - -- > withAssetAndMinRequiredCoinByUtxoCost self multiasset dataCost - , build :: TxOutAmountBuilder -> TxOut - -- ^ Build - -- > build self - } - --- | Transaction output amount builder class API -txOutAmountBuilder :: TxOutAmountBuilderClass -txOutAmountBuilder = - { free: txOutAmountBuilder_free - , withValue: txOutAmountBuilder_withValue - , withCoin: txOutAmountBuilder_withCoin - , withCoinAndAsset: txOutAmountBuilder_withCoinAndAsset - , withAssetAndMinRequiredCoin: txOutAmountBuilder_withAssetAndMinRequiredCoin - , withAssetAndMinRequiredCoinByUtxoCost: txOutAmountBuilder_withAssetAndMinRequiredCoinByUtxoCost - , build: txOutAmountBuilder_build - } - -instance HasFree TxOutAmountBuilder where - free = txOutAmountBuilder.free - -------------------------------------------------------------------------------------- --- Transaction output builder - -foreign import txOutBuilder_free :: TxOutBuilder -> Effect Unit -foreign import txOutBuilder_new :: TxOutBuilder -foreign import txOutBuilder_withAddress :: TxOutBuilder -> Address -> TxOutBuilder -foreign import txOutBuilder_withDataHash :: TxOutBuilder -> DataHash -> TxOutBuilder -foreign import txOutBuilder_withPlutusData :: TxOutBuilder -> PlutusData -> TxOutBuilder -foreign import txOutBuilder_withScriptRef :: TxOutBuilder -> ScriptRef -> TxOutBuilder -foreign import txOutBuilder_next :: TxOutBuilder -> TxOutAmountBuilder - --- | Transaction output builder class -type TxOutBuilderClass = - { free :: TxOutBuilder -> Effect Unit - -- ^ Free - -- > free self - , new :: TxOutBuilder - -- ^ New - -- > new - , withAddress :: TxOutBuilder -> Address -> TxOutBuilder - -- ^ With address - -- > withAddress self address - , withDataHash :: TxOutBuilder -> DataHash -> TxOutBuilder - -- ^ With data hash - -- > withDataHash self dataHash - , withPlutusData :: TxOutBuilder -> PlutusData -> TxOutBuilder - -- ^ With plutus data - -- > withPlutusData self data - , withScriptRef :: TxOutBuilder -> ScriptRef -> TxOutBuilder - -- ^ With script ref - -- > withScriptRef self scriptRef - , next :: TxOutBuilder -> TxOutAmountBuilder - -- ^ Next - -- > next self - } - --- | Transaction output builder class API -txOutBuilder :: TxOutBuilderClass -txOutBuilder = - { free: txOutBuilder_free - , new: txOutBuilder_new - , withAddress: txOutBuilder_withAddress - , withDataHash: txOutBuilder_withDataHash - , withPlutusData: txOutBuilder_withPlutusData - , withScriptRef: txOutBuilder_withScriptRef - , next: txOutBuilder_next - } - -instance HasFree TxOutBuilder where - free = txOutBuilder.free - -------------------------------------------------------------------------------------- --- Transaction outputs - -foreign import txOuts_free :: TxOuts -> Effect Unit -foreign import txOuts_toBytes :: TxOuts -> Bytes -foreign import txOuts_fromBytes :: Bytes -> ForeignErrorable TxOuts -foreign import txOuts_toHex :: TxOuts -> String -foreign import txOuts_fromHex :: String -> ForeignErrorable TxOuts -foreign import txOuts_toJson :: TxOuts -> String -foreign import txOuts_toJsValue :: TxOuts -> TxOutsJson -foreign import txOuts_fromJson :: String -> ForeignErrorable TxOuts -foreign import txOuts_new :: Effect TxOuts -foreign import txOuts_len :: TxOuts -> Effect Int -foreign import txOuts_get :: TxOuts -> Int -> Effect TxOut -foreign import txOuts_add :: TxOuts -> TxOut -> Effect Unit - --- | Transaction outputs class -type TxOutsClass = - { free :: TxOuts -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: TxOuts -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe TxOuts - -- ^ From bytes - -- > fromBytes bytes - , toHex :: TxOuts -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe TxOuts - -- ^ From hex - -- > fromHex hexStr - , toJson :: TxOuts -> String - -- ^ To json - -- > toJson self - , toJsValue :: TxOuts -> TxOutsJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe TxOuts - -- ^ From json - -- > fromJson json - , new :: Effect TxOuts - -- ^ New - -- > new - , len :: TxOuts -> Effect Int - -- ^ Len - -- > len self - , get :: TxOuts -> Int -> Effect TxOut - -- ^ Get - -- > get self index - , add :: TxOuts -> TxOut -> Effect Unit - -- ^ Add - -- > add self elem - } - --- | Transaction outputs class API -txOuts :: TxOutsClass -txOuts = - { free: txOuts_free - , toBytes: txOuts_toBytes - , fromBytes: \a1 -> runForeignMaybe $ txOuts_fromBytes a1 - , toHex: txOuts_toHex - , fromHex: \a1 -> runForeignMaybe $ txOuts_fromHex a1 - , toJson: txOuts_toJson - , toJsValue: txOuts_toJsValue - , fromJson: \a1 -> runForeignMaybe $ txOuts_fromJson a1 - , new: txOuts_new - , len: txOuts_len - , get: txOuts_get - , add: txOuts_add - } - -instance HasFree TxOuts where - free = txOuts.free - -instance Show TxOuts where - show = txOuts.toHex - -instance MutableList TxOuts TxOut where - addItem = txOuts.add - getItem = txOuts.get - emptyList = txOuts.new - -instance MutableLen TxOuts where - getLen = txOuts.len - - -instance ToJsValue TxOuts where - toJsValue = txOuts.toJsValue - -instance IsHex TxOuts where - toHex = txOuts.toHex - fromHex = txOuts.fromHex - -instance IsBytes TxOuts where - toBytes = txOuts.toBytes - fromBytes = txOuts.fromBytes - -instance IsJson TxOuts where - toJson = txOuts.toJson - fromJson = txOuts.fromJson - -------------------------------------------------------------------------------------- --- Transaction unspent output - -foreign import txUnspentOut_free :: TxUnspentOut -> Effect Unit -foreign import txUnspentOut_toBytes :: TxUnspentOut -> Bytes -foreign import txUnspentOut_fromBytes :: Bytes -> ForeignErrorable TxUnspentOut -foreign import txUnspentOut_toHex :: TxUnspentOut -> String -foreign import txUnspentOut_fromHex :: String -> ForeignErrorable TxUnspentOut -foreign import txUnspentOut_toJson :: TxUnspentOut -> String -foreign import txUnspentOut_toJsValue :: TxUnspentOut -> TxUnspentOutJson -foreign import txUnspentOut_fromJson :: String -> ForeignErrorable TxUnspentOut -foreign import txUnspentOut_new :: TxIn -> TxOut -> TxUnspentOut -foreign import txUnspentOut_in :: TxUnspentOut -> TxIn -foreign import txUnspentOut_out :: TxUnspentOut -> TxOut - --- | Transaction unspent output class -type TxUnspentOutClass = - { free :: TxUnspentOut -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: TxUnspentOut -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe TxUnspentOut - -- ^ From bytes - -- > fromBytes bytes - , toHex :: TxUnspentOut -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe TxUnspentOut - -- ^ From hex - -- > fromHex hexStr - , toJson :: TxUnspentOut -> String - -- ^ To json - -- > toJson self - , toJsValue :: TxUnspentOut -> TxUnspentOutJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe TxUnspentOut - -- ^ From json - -- > fromJson json - , new :: TxIn -> TxOut -> TxUnspentOut - -- ^ New - -- > new in out - , in :: TxUnspentOut -> TxIn - -- ^ Input - -- > in self - , out :: TxUnspentOut -> TxOut - -- ^ Output - -- > out self - } - --- | Transaction unspent output class API -txUnspentOut :: TxUnspentOutClass -txUnspentOut = - { free: txUnspentOut_free - , toBytes: txUnspentOut_toBytes - , fromBytes: \a1 -> runForeignMaybe $ txUnspentOut_fromBytes a1 - , toHex: txUnspentOut_toHex - , fromHex: \a1 -> runForeignMaybe $ txUnspentOut_fromHex a1 - , toJson: txUnspentOut_toJson - , toJsValue: txUnspentOut_toJsValue - , fromJson: \a1 -> runForeignMaybe $ txUnspentOut_fromJson a1 - , new: txUnspentOut_new - , in: txUnspentOut_in - , out: txUnspentOut_out - } - -instance HasFree TxUnspentOut where - free = txUnspentOut.free - -instance Show TxUnspentOut where - show = txUnspentOut.toHex - -instance ToJsValue TxUnspentOut where - toJsValue = txUnspentOut.toJsValue - -instance IsHex TxUnspentOut where - toHex = txUnspentOut.toHex - fromHex = txUnspentOut.fromHex - -instance IsBytes TxUnspentOut where - toBytes = txUnspentOut.toBytes - fromBytes = txUnspentOut.fromBytes - -instance IsJson TxUnspentOut where - toJson = txUnspentOut.toJson - fromJson = txUnspentOut.fromJson - -------------------------------------------------------------------------------------- --- Transaction unspent outputs - -foreign import txUnspentOuts_free :: TxUnspentOuts -> Effect Unit -foreign import txUnspentOuts_toJson :: TxUnspentOuts -> String -foreign import txUnspentOuts_toJsValue :: TxUnspentOuts -> TxUnspentOutsJson -foreign import txUnspentOuts_fromJson :: String -> ForeignErrorable TxUnspentOuts -foreign import txUnspentOuts_new :: Effect TxUnspentOuts -foreign import txUnspentOuts_len :: TxUnspentOuts -> Effect Int -foreign import txUnspentOuts_get :: TxUnspentOuts -> Int -> Effect TxUnspentOut -foreign import txUnspentOuts_add :: TxUnspentOuts -> TxUnspentOut -> Effect Unit - --- | Transaction unspent outputs class -type TxUnspentOutsClass = - { free :: TxUnspentOuts -> Effect Unit - -- ^ Free - -- > free self - , toJson :: TxUnspentOuts -> String - -- ^ To json - -- > toJson self - , toJsValue :: TxUnspentOuts -> TxUnspentOutsJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe TxUnspentOuts - -- ^ From json - -- > fromJson json - , new :: Effect TxUnspentOuts - -- ^ New - -- > new - , len :: TxUnspentOuts -> Effect Int - -- ^ Len - -- > len self - , get :: TxUnspentOuts -> Int -> Effect TxUnspentOut - -- ^ Get - -- > get self index - , add :: TxUnspentOuts -> TxUnspentOut -> Effect Unit - -- ^ Add - -- > add self elem - } - --- | Transaction unspent outputs class API -txUnspentOuts :: TxUnspentOutsClass -txUnspentOuts = - { free: txUnspentOuts_free - , toJson: txUnspentOuts_toJson - , toJsValue: txUnspentOuts_toJsValue - , fromJson: \a1 -> runForeignMaybe $ txUnspentOuts_fromJson a1 - , new: txUnspentOuts_new - , len: txUnspentOuts_len - , get: txUnspentOuts_get - , add: txUnspentOuts_add - } - -instance HasFree TxUnspentOuts where - free = txUnspentOuts.free - -instance MutableList TxUnspentOuts TxUnspentOut where - addItem = txUnspentOuts.add - getItem = txUnspentOuts.get - emptyList = txUnspentOuts.new - -instance MutableLen TxUnspentOuts where - getLen = txUnspentOuts.len - - -instance ToJsValue TxUnspentOuts where - toJsValue = txUnspentOuts.toJsValue - -instance IsJson TxUnspentOuts where - toJson = txUnspentOuts.toJson - fromJson = txUnspentOuts.fromJson - -------------------------------------------------------------------------------------- --- Transaction witness set - -foreign import txWitnessSet_free :: TxWitnessSet -> Effect Unit -foreign import txWitnessSet_toBytes :: TxWitnessSet -> Bytes -foreign import txWitnessSet_fromBytes :: Bytes -> ForeignErrorable TxWitnessSet -foreign import txWitnessSet_toHex :: TxWitnessSet -> String -foreign import txWitnessSet_fromHex :: String -> ForeignErrorable TxWitnessSet -foreign import txWitnessSet_toJson :: TxWitnessSet -> String -foreign import txWitnessSet_toJsValue :: TxWitnessSet -> TxWitnessSetJson -foreign import txWitnessSet_fromJson :: String -> ForeignErrorable TxWitnessSet -foreign import txWitnessSet_setVkeys :: TxWitnessSet -> Vkeywitnesses -> Effect Unit -foreign import txWitnessSet_vkeys :: TxWitnessSet -> Effect ((Nullable Vkeywitnesses)) -foreign import txWitnessSet_setNativeScripts :: TxWitnessSet -> NativeScripts -> Effect Unit -foreign import txWitnessSet_nativeScripts :: TxWitnessSet -> Effect ((Nullable NativeScripts)) -foreign import txWitnessSet_setBootstraps :: TxWitnessSet -> BootstrapWitnesses -> Effect Unit -foreign import txWitnessSet_bootstraps :: TxWitnessSet -> Effect ((Nullable BootstrapWitnesses)) -foreign import txWitnessSet_setPlutusScripts :: TxWitnessSet -> PlutusScripts -> Effect Unit -foreign import txWitnessSet_plutusScripts :: TxWitnessSet -> Effect ((Nullable PlutusScripts)) -foreign import txWitnessSet_setPlutusData :: TxWitnessSet -> PlutusList -> Effect Unit -foreign import txWitnessSet_plutusData :: TxWitnessSet -> Effect ((Nullable PlutusList)) -foreign import txWitnessSet_setRedeemers :: TxWitnessSet -> Redeemers -> Effect Unit -foreign import txWitnessSet_redeemers :: TxWitnessSet -> Effect ((Nullable Redeemers)) -foreign import txWitnessSet_new :: Effect TxWitnessSet - --- | Transaction witness set class -type TxWitnessSetClass = - { free :: TxWitnessSet -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: TxWitnessSet -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe TxWitnessSet - -- ^ From bytes - -- > fromBytes bytes - , toHex :: TxWitnessSet -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe TxWitnessSet - -- ^ From hex - -- > fromHex hexStr - , toJson :: TxWitnessSet -> String - -- ^ To json - -- > toJson self - , toJsValue :: TxWitnessSet -> TxWitnessSetJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe TxWitnessSet - -- ^ From json - -- > fromJson json - , setVkeys :: TxWitnessSet -> Vkeywitnesses -> Effect Unit - -- ^ Set vkeys - -- > setVkeys self vkeys - , vkeys :: TxWitnessSet -> Effect ((Maybe Vkeywitnesses)) - -- ^ Vkeys - -- > vkeys self - , setNativeScripts :: TxWitnessSet -> NativeScripts -> Effect Unit - -- ^ Set native scripts - -- > setNativeScripts self nativeScripts - , nativeScripts :: TxWitnessSet -> Effect ((Maybe NativeScripts)) - -- ^ Native scripts - -- > nativeScripts self - , setBootstraps :: TxWitnessSet -> BootstrapWitnesses -> Effect Unit - -- ^ Set bootstraps - -- > setBootstraps self bootstraps - , bootstraps :: TxWitnessSet -> Effect ((Maybe BootstrapWitnesses)) - -- ^ Bootstraps - -- > bootstraps self - , setPlutusScripts :: TxWitnessSet -> PlutusScripts -> Effect Unit - -- ^ Set plutus scripts - -- > setPlutusScripts self plutusScripts - , plutusScripts :: TxWitnessSet -> Effect ((Maybe PlutusScripts)) - -- ^ Plutus scripts - -- > plutusScripts self - , setPlutusData :: TxWitnessSet -> PlutusList -> Effect Unit - -- ^ Set plutus data - -- > setPlutusData self plutusData - , plutusData :: TxWitnessSet -> Effect ((Maybe PlutusList)) - -- ^ Plutus data - -- > plutusData self - , setRedeemers :: TxWitnessSet -> Redeemers -> Effect Unit - -- ^ Set redeemers - -- > setRedeemers self redeemers - , redeemers :: TxWitnessSet -> Effect ((Maybe Redeemers)) - -- ^ Redeemers - -- > redeemers self - , new :: Effect TxWitnessSet - -- ^ New - -- > new - } - --- | Transaction witness set class API -txWitnessSet :: TxWitnessSetClass -txWitnessSet = - { free: txWitnessSet_free - , toBytes: txWitnessSet_toBytes - , fromBytes: \a1 -> runForeignMaybe $ txWitnessSet_fromBytes a1 - , toHex: txWitnessSet_toHex - , fromHex: \a1 -> runForeignMaybe $ txWitnessSet_fromHex a1 - , toJson: txWitnessSet_toJson - , toJsValue: txWitnessSet_toJsValue - , fromJson: \a1 -> runForeignMaybe $ txWitnessSet_fromJson a1 - , setVkeys: txWitnessSet_setVkeys - , vkeys: \a1 -> Nullable.toMaybe <$> txWitnessSet_vkeys a1 - , setNativeScripts: txWitnessSet_setNativeScripts - , nativeScripts: \a1 -> Nullable.toMaybe <$> txWitnessSet_nativeScripts a1 - , setBootstraps: txWitnessSet_setBootstraps - , bootstraps: \a1 -> Nullable.toMaybe <$> txWitnessSet_bootstraps a1 - , setPlutusScripts: txWitnessSet_setPlutusScripts - , plutusScripts: \a1 -> Nullable.toMaybe <$> txWitnessSet_plutusScripts a1 - , setPlutusData: txWitnessSet_setPlutusData - , plutusData: \a1 -> Nullable.toMaybe <$> txWitnessSet_plutusData a1 - , setRedeemers: txWitnessSet_setRedeemers - , redeemers: \a1 -> Nullable.toMaybe <$> txWitnessSet_redeemers a1 - , new: txWitnessSet_new - } - -instance HasFree TxWitnessSet where - free = txWitnessSet.free - -instance Show TxWitnessSet where - show = txWitnessSet.toHex - -instance ToJsValue TxWitnessSet where - toJsValue = txWitnessSet.toJsValue - -instance IsHex TxWitnessSet where - toHex = txWitnessSet.toHex - fromHex = txWitnessSet.fromHex - -instance IsBytes TxWitnessSet where - toBytes = txWitnessSet.toBytes - fromBytes = txWitnessSet.fromBytes - -instance IsJson TxWitnessSet where - toJson = txWitnessSet.toJson - fromJson = txWitnessSet.fromJson - -------------------------------------------------------------------------------------- --- Transaction witness sets - -foreign import txWitnessSets_free :: TxWitnessSets -> Effect Unit -foreign import txWitnessSets_toBytes :: TxWitnessSets -> Bytes -foreign import txWitnessSets_fromBytes :: Bytes -> ForeignErrorable TxWitnessSets -foreign import txWitnessSets_toHex :: TxWitnessSets -> String -foreign import txWitnessSets_fromHex :: String -> ForeignErrorable TxWitnessSets -foreign import txWitnessSets_toJson :: TxWitnessSets -> String -foreign import txWitnessSets_toJsValue :: TxWitnessSets -> TxWitnessSetsJson -foreign import txWitnessSets_fromJson :: String -> ForeignErrorable TxWitnessSets -foreign import txWitnessSets_new :: Effect TxWitnessSets -foreign import txWitnessSets_len :: TxWitnessSets -> Effect Number -foreign import txWitnessSets_get :: TxWitnessSets -> Number -> Effect TxWitnessSet -foreign import txWitnessSets_add :: TxWitnessSets -> TxWitnessSet -> Effect Unit - --- | Transaction witness sets class -type TxWitnessSetsClass = - { free :: TxWitnessSets -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: TxWitnessSets -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe TxWitnessSets - -- ^ From bytes - -- > fromBytes bytes - , toHex :: TxWitnessSets -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe TxWitnessSets - -- ^ From hex - -- > fromHex hexStr - , toJson :: TxWitnessSets -> String - -- ^ To json - -- > toJson self - , toJsValue :: TxWitnessSets -> TxWitnessSetsJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe TxWitnessSets - -- ^ From json - -- > fromJson json - , new :: Effect TxWitnessSets - -- ^ New - -- > new - , len :: TxWitnessSets -> Effect Number - -- ^ Len - -- > len self - , get :: TxWitnessSets -> Number -> Effect TxWitnessSet - -- ^ Get - -- > get self index - , add :: TxWitnessSets -> TxWitnessSet -> Effect Unit - -- ^ Add - -- > add self elem - } - --- | Transaction witness sets class API -txWitnessSets :: TxWitnessSetsClass -txWitnessSets = - { free: txWitnessSets_free - , toBytes: txWitnessSets_toBytes - , fromBytes: \a1 -> runForeignMaybe $ txWitnessSets_fromBytes a1 - , toHex: txWitnessSets_toHex - , fromHex: \a1 -> runForeignMaybe $ txWitnessSets_fromHex a1 - , toJson: txWitnessSets_toJson - , toJsValue: txWitnessSets_toJsValue - , fromJson: \a1 -> runForeignMaybe $ txWitnessSets_fromJson a1 - , new: txWitnessSets_new - , len: txWitnessSets_len - , get: txWitnessSets_get - , add: txWitnessSets_add - } - -instance HasFree TxWitnessSets where - free = txWitnessSets.free - -instance Show TxWitnessSets where - show = txWitnessSets.toHex - -instance ToJsValue TxWitnessSets where - toJsValue = txWitnessSets.toJsValue - -instance IsHex TxWitnessSets where - toHex = txWitnessSets.toHex - fromHex = txWitnessSets.fromHex - -instance IsBytes TxWitnessSets where - toBytes = txWitnessSets.toBytes - fromBytes = txWitnessSets.fromBytes - -instance IsJson TxWitnessSets where - toJson = txWitnessSets.toJson - fromJson = txWitnessSets.fromJson - -------------------------------------------------------------------------------------- --- Tx builder constants - -foreign import txBuilderConstants_free :: TxBuilderConstants -> Effect Unit -foreign import txBuilderConstants_plutusDefaultCostModels :: Costmdls -foreign import txBuilderConstants_plutusAlonzoCostModels :: Costmdls -foreign import txBuilderConstants_plutusVasilCostModels :: Costmdls - --- | Tx builder constants class -type TxBuilderConstantsClass = - { free :: TxBuilderConstants -> Effect Unit - -- ^ Free - -- > free self - , plutusDefaultCostModels :: Costmdls - -- ^ Plutus default cost models - -- > plutusDefaultCostModels - , plutusAlonzoCostModels :: Costmdls - -- ^ Plutus alonzo cost models - -- > plutusAlonzoCostModels - , plutusVasilCostModels :: Costmdls - -- ^ Plutus vasil cost models - -- > plutusVasilCostModels - } - --- | Tx builder constants class API -txBuilderConstants :: TxBuilderConstantsClass -txBuilderConstants = - { free: txBuilderConstants_free - , plutusDefaultCostModels: txBuilderConstants_plutusDefaultCostModels - , plutusAlonzoCostModels: txBuilderConstants_plutusAlonzoCostModels - , plutusVasilCostModels: txBuilderConstants_plutusVasilCostModels - } - -instance HasFree TxBuilderConstants where - free = txBuilderConstants.free - -------------------------------------------------------------------------------------- --- Tx inputs builder - -foreign import txInsBuilder_free :: TxInsBuilder -> Effect Unit -foreign import txInsBuilder_new :: Effect TxInsBuilder -foreign import txInsBuilder_addKeyIn :: TxInsBuilder -> Ed25519KeyHash -> TxIn -> Value -> Effect Unit -foreign import txInsBuilder_addScriptIn :: TxInsBuilder -> ScriptHash -> TxIn -> Value -> Effect Unit -foreign import txInsBuilder_addNativeScriptIn :: TxInsBuilder -> NativeScript -> TxIn -> Value -> Effect Unit -foreign import txInsBuilder_addPlutusScriptIn :: TxInsBuilder -> PlutusWitness -> TxIn -> Value -> Effect Unit -foreign import txInsBuilder_addBootstrapIn :: TxInsBuilder -> ByronAddress -> TxIn -> Value -> Effect Unit -foreign import txInsBuilder_addIn :: TxInsBuilder -> Address -> TxIn -> Value -> Effect Unit -foreign import txInsBuilder_countMissingInScripts :: TxInsBuilder -> Effect Number -foreign import txInsBuilder_addRequiredNativeInScripts :: TxInsBuilder -> NativeScripts -> Effect Number -foreign import txInsBuilder_addRequiredPlutusInScripts :: TxInsBuilder -> PlutusWitnesses -> Effect Number -foreign import txInsBuilder_getRefIns :: TxInsBuilder -> Effect TxIns -foreign import txInsBuilder_getNativeInScripts :: TxInsBuilder -> Effect ((Nullable NativeScripts)) -foreign import txInsBuilder_getPlutusInScripts :: TxInsBuilder -> Effect ((Nullable PlutusWitnesses)) -foreign import txInsBuilder_len :: TxInsBuilder -> Effect Number -foreign import txInsBuilder_addRequiredSigner :: TxInsBuilder -> Ed25519KeyHash -> Effect Unit -foreign import txInsBuilder_addRequiredSigners :: TxInsBuilder -> Ed25519KeyHashes -> Effect Unit -foreign import txInsBuilder_totalValue :: TxInsBuilder -> Effect Value -foreign import txInsBuilder_ins :: TxInsBuilder -> Effect TxIns -foreign import txInsBuilder_insOption :: TxInsBuilder -> Effect ((Nullable TxIns)) - --- | Tx inputs builder class -type TxInsBuilderClass = - { free :: TxInsBuilder -> Effect Unit - -- ^ Free - -- > free self - , new :: Effect TxInsBuilder - -- ^ New - -- > new - , addKeyIn :: TxInsBuilder -> Ed25519KeyHash -> TxIn -> Value -> Effect Unit - -- ^ Add key input - -- > addKeyIn self hash in amount - , addScriptIn :: TxInsBuilder -> ScriptHash -> TxIn -> Value -> Effect Unit - -- ^ Add script input - -- > addScriptIn self hash in amount - , addNativeScriptIn :: TxInsBuilder -> NativeScript -> TxIn -> Value -> Effect Unit - -- ^ Add native script input - -- > addNativeScriptIn self script in amount - , addPlutusScriptIn :: TxInsBuilder -> PlutusWitness -> TxIn -> Value -> Effect Unit - -- ^ Add plutus script input - -- > addPlutusScriptIn self witness in amount - , addBootstrapIn :: TxInsBuilder -> ByronAddress -> TxIn -> Value -> Effect Unit - -- ^ Add bootstrap input - -- > addBootstrapIn self hash in amount - , addIn :: TxInsBuilder -> Address -> TxIn -> Value -> Effect Unit - -- ^ Add input - -- > addIn self address in amount - , countMissingInScripts :: TxInsBuilder -> Effect Number - -- ^ Count missing input scripts - -- > countMissingInScripts self - , addRequiredNativeInScripts :: TxInsBuilder -> NativeScripts -> Effect Number - -- ^ Add required native input scripts - -- > addRequiredNativeInScripts self scripts - , addRequiredPlutusInScripts :: TxInsBuilder -> PlutusWitnesses -> Effect Number - -- ^ Add required plutus input scripts - -- > addRequiredPlutusInScripts self scripts - , getRefIns :: TxInsBuilder -> Effect TxIns - -- ^ Get ref inputs - -- > getRefIns self - , getNativeInScripts :: TxInsBuilder -> Effect ((Maybe NativeScripts)) - -- ^ Get native input scripts - -- > getNativeInScripts self - , getPlutusInScripts :: TxInsBuilder -> Effect ((Maybe PlutusWitnesses)) - -- ^ Get plutus input scripts - -- > getPlutusInScripts self - , len :: TxInsBuilder -> Effect Number - -- ^ Len - -- > len self - , addRequiredSigner :: TxInsBuilder -> Ed25519KeyHash -> Effect Unit - -- ^ Add required signer - -- > addRequiredSigner self key - , addRequiredSigners :: TxInsBuilder -> Ed25519KeyHashes -> Effect Unit - -- ^ Add required signers - -- > addRequiredSigners self keys - , totalValue :: TxInsBuilder -> Effect Value - -- ^ Total value - -- > totalValue self - , ins :: TxInsBuilder -> Effect TxIns - -- ^ Inputs - -- > ins self - , insOption :: TxInsBuilder -> Effect ((Maybe TxIns)) - -- ^ Inputs option - -- > insOption self - } - --- | Tx inputs builder class API -txInsBuilder :: TxInsBuilderClass -txInsBuilder = - { free: txInsBuilder_free - , new: txInsBuilder_new - , addKeyIn: txInsBuilder_addKeyIn - , addScriptIn: txInsBuilder_addScriptIn - , addNativeScriptIn: txInsBuilder_addNativeScriptIn - , addPlutusScriptIn: txInsBuilder_addPlutusScriptIn - , addBootstrapIn: txInsBuilder_addBootstrapIn - , addIn: txInsBuilder_addIn - , countMissingInScripts: txInsBuilder_countMissingInScripts - , addRequiredNativeInScripts: txInsBuilder_addRequiredNativeInScripts - , addRequiredPlutusInScripts: txInsBuilder_addRequiredPlutusInScripts - , getRefIns: txInsBuilder_getRefIns - , getNativeInScripts: \a1 -> Nullable.toMaybe <$> txInsBuilder_getNativeInScripts a1 - , getPlutusInScripts: \a1 -> Nullable.toMaybe <$> txInsBuilder_getPlutusInScripts a1 - , len: txInsBuilder_len - , addRequiredSigner: txInsBuilder_addRequiredSigner - , addRequiredSigners: txInsBuilder_addRequiredSigners - , totalValue: txInsBuilder_totalValue - , ins: txInsBuilder_ins - , insOption: \a1 -> Nullable.toMaybe <$> txInsBuilder_insOption a1 - } - -instance HasFree TxInsBuilder where - free = txInsBuilder.free - -------------------------------------------------------------------------------------- --- URL - -foreign import url_free :: URL -> Effect Unit -foreign import url_toBytes :: URL -> Bytes -foreign import url_fromBytes :: Bytes -> ForeignErrorable URL -foreign import url_toHex :: URL -> String -foreign import url_fromHex :: String -> ForeignErrorable URL -foreign import url_toJson :: URL -> String -foreign import url_toJsValue :: URL -> URLJson -foreign import url_fromJson :: String -> ForeignErrorable URL -foreign import url_new :: String -> URL -foreign import url_url :: URL -> String - --- | URL class -type URLClass = - { free :: URL -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: URL -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe URL - -- ^ From bytes - -- > fromBytes bytes - , toHex :: URL -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe URL - -- ^ From hex - -- > fromHex hexStr - , toJson :: URL -> String - -- ^ To json - -- > toJson self - , toJsValue :: URL -> URLJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe URL - -- ^ From json - -- > fromJson json - , new :: String -> URL - -- ^ New - -- > new url - , url :: URL -> String - -- ^ Url - -- > url self - } - --- | URL class API -url :: URLClass -url = - { free: url_free - , toBytes: url_toBytes - , fromBytes: \a1 -> runForeignMaybe $ url_fromBytes a1 - , toHex: url_toHex - , fromHex: \a1 -> runForeignMaybe $ url_fromHex a1 - , toJson: url_toJson - , toJsValue: url_toJsValue - , fromJson: \a1 -> runForeignMaybe $ url_fromJson a1 - , new: url_new - , url: url_url - } - -instance HasFree URL where - free = url.free - -instance Show URL where - show = url.toHex - -instance ToJsValue URL where - toJsValue = url.toJsValue - -instance IsHex URL where - toHex = url.toHex - fromHex = url.fromHex - -instance IsBytes URL where - toBytes = url.toBytes - fromBytes = url.fromBytes - -instance IsJson URL where - toJson = url.toJson - fromJson = url.fromJson - -------------------------------------------------------------------------------------- --- Unit interval - -foreign import unitInterval_free :: UnitInterval -> Effect Unit -foreign import unitInterval_toBytes :: UnitInterval -> Bytes -foreign import unitInterval_fromBytes :: Bytes -> ForeignErrorable UnitInterval -foreign import unitInterval_toHex :: UnitInterval -> String -foreign import unitInterval_fromHex :: String -> ForeignErrorable UnitInterval -foreign import unitInterval_toJson :: UnitInterval -> String -foreign import unitInterval_toJsValue :: UnitInterval -> UnitIntervalJson -foreign import unitInterval_fromJson :: String -> ForeignErrorable UnitInterval -foreign import unitInterval_numerator :: UnitInterval -> BigNum -foreign import unitInterval_denominator :: UnitInterval -> BigNum -foreign import unitInterval_new :: BigNum -> BigNum -> UnitInterval - --- | Unit interval class -type UnitIntervalClass = - { free :: UnitInterval -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: UnitInterval -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe UnitInterval - -- ^ From bytes - -- > fromBytes bytes - , toHex :: UnitInterval -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe UnitInterval - -- ^ From hex - -- > fromHex hexStr - , toJson :: UnitInterval -> String - -- ^ To json - -- > toJson self - , toJsValue :: UnitInterval -> UnitIntervalJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe UnitInterval - -- ^ From json - -- > fromJson json - , numerator :: UnitInterval -> BigNum - -- ^ Numerator - -- > numerator self - , denominator :: UnitInterval -> BigNum - -- ^ Denominator - -- > denominator self - , new :: BigNum -> BigNum -> UnitInterval - -- ^ New - -- > new numerator denominator - } - --- | Unit interval class API -unitInterval :: UnitIntervalClass -unitInterval = - { free: unitInterval_free - , toBytes: unitInterval_toBytes - , fromBytes: \a1 -> runForeignMaybe $ unitInterval_fromBytes a1 - , toHex: unitInterval_toHex - , fromHex: \a1 -> runForeignMaybe $ unitInterval_fromHex a1 - , toJson: unitInterval_toJson - , toJsValue: unitInterval_toJsValue - , fromJson: \a1 -> runForeignMaybe $ unitInterval_fromJson a1 - , numerator: unitInterval_numerator - , denominator: unitInterval_denominator - , new: unitInterval_new - } - -instance HasFree UnitInterval where - free = unitInterval.free - -instance Show UnitInterval where - show = unitInterval.toHex - -instance ToJsValue UnitInterval where - toJsValue = unitInterval.toJsValue - -instance IsHex UnitInterval where - toHex = unitInterval.toHex - fromHex = unitInterval.fromHex - -instance IsBytes UnitInterval where - toBytes = unitInterval.toBytes - fromBytes = unitInterval.fromBytes - -instance IsJson UnitInterval where - toJson = unitInterval.toJson - fromJson = unitInterval.fromJson - -------------------------------------------------------------------------------------- --- Update - -foreign import update_free :: Update -> Effect Unit -foreign import update_toBytes :: Update -> Bytes -foreign import update_fromBytes :: Bytes -> ForeignErrorable Update -foreign import update_toHex :: Update -> String -foreign import update_fromHex :: String -> ForeignErrorable Update -foreign import update_toJson :: Update -> String -foreign import update_toJsValue :: Update -> UpdateJson -foreign import update_fromJson :: String -> ForeignErrorable Update -foreign import update_proposedProtocolParameterUpdates :: Update -> ProposedProtocolParameterUpdates -foreign import update_epoch :: Update -> Number -foreign import update_new :: ProposedProtocolParameterUpdates -> Number -> Update - --- | Update class -type UpdateClass = - { free :: Update -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: Update -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe Update - -- ^ From bytes - -- > fromBytes bytes - , toHex :: Update -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe Update - -- ^ From hex - -- > fromHex hexStr - , toJson :: Update -> String - -- ^ To json - -- > toJson self - , toJsValue :: Update -> UpdateJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe Update - -- ^ From json - -- > fromJson json - , proposedProtocolParameterUpdates :: Update -> ProposedProtocolParameterUpdates - -- ^ Proposed protocol parameter updates - -- > proposedProtocolParameterUpdates self - , epoch :: Update -> Number - -- ^ Epoch - -- > epoch self - , new :: ProposedProtocolParameterUpdates -> Number -> Update - -- ^ New - -- > new proposedProtocolParameterUpdates epoch - } - --- | Update class API -update :: UpdateClass -update = - { free: update_free - , toBytes: update_toBytes - , fromBytes: \a1 -> runForeignMaybe $ update_fromBytes a1 - , toHex: update_toHex - , fromHex: \a1 -> runForeignMaybe $ update_fromHex a1 - , toJson: update_toJson - , toJsValue: update_toJsValue - , fromJson: \a1 -> runForeignMaybe $ update_fromJson a1 - , proposedProtocolParameterUpdates: update_proposedProtocolParameterUpdates - , epoch: update_epoch - , new: update_new - } - -instance HasFree Update where - free = update.free - -instance Show Update where - show = update.toHex - -instance ToJsValue Update where - toJsValue = update.toJsValue - -instance IsHex Update where - toHex = update.toHex - fromHex = update.fromHex - -instance IsBytes Update where - toBytes = update.toBytes - fromBytes = update.fromBytes - -instance IsJson Update where - toJson = update.toJson - fromJson = update.fromJson - -------------------------------------------------------------------------------------- --- VRFCert - -foreign import vrfCert_free :: VRFCert -> Effect Unit -foreign import vrfCert_toBytes :: VRFCert -> Bytes -foreign import vrfCert_fromBytes :: Bytes -> ForeignErrorable VRFCert -foreign import vrfCert_toHex :: VRFCert -> String -foreign import vrfCert_fromHex :: String -> ForeignErrorable VRFCert -foreign import vrfCert_toJson :: VRFCert -> String -foreign import vrfCert_toJsValue :: VRFCert -> VRFCertJson -foreign import vrfCert_fromJson :: String -> ForeignErrorable VRFCert -foreign import vrfCert_out :: VRFCert -> Bytes -foreign import vrfCert_proof :: VRFCert -> Bytes -foreign import vrfCert_new :: Bytes -> Bytes -> VRFCert - --- | VRFCert class -type VRFCertClass = - { free :: VRFCert -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: VRFCert -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe VRFCert - -- ^ From bytes - -- > fromBytes bytes - , toHex :: VRFCert -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe VRFCert - -- ^ From hex - -- > fromHex hexStr - , toJson :: VRFCert -> String - -- ^ To json - -- > toJson self - , toJsValue :: VRFCert -> VRFCertJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe VRFCert - -- ^ From json - -- > fromJson json - , out :: VRFCert -> Bytes - -- ^ Output - -- > out self - , proof :: VRFCert -> Bytes - -- ^ Proof - -- > proof self - , new :: Bytes -> Bytes -> VRFCert - -- ^ New - -- > new out proof - } - --- | VRFCert class API -vrfCert :: VRFCertClass -vrfCert = - { free: vrfCert_free - , toBytes: vrfCert_toBytes - , fromBytes: \a1 -> runForeignMaybe $ vrfCert_fromBytes a1 - , toHex: vrfCert_toHex - , fromHex: \a1 -> runForeignMaybe $ vrfCert_fromHex a1 - , toJson: vrfCert_toJson - , toJsValue: vrfCert_toJsValue - , fromJson: \a1 -> runForeignMaybe $ vrfCert_fromJson a1 - , out: vrfCert_out - , proof: vrfCert_proof - , new: vrfCert_new - } - -instance HasFree VRFCert where - free = vrfCert.free - -instance Show VRFCert where - show = vrfCert.toHex - -instance ToJsValue VRFCert where - toJsValue = vrfCert.toJsValue - -instance IsHex VRFCert where - toHex = vrfCert.toHex - fromHex = vrfCert.fromHex - -instance IsBytes VRFCert where - toBytes = vrfCert.toBytes - fromBytes = vrfCert.fromBytes - -instance IsJson VRFCert where - toJson = vrfCert.toJson - fromJson = vrfCert.fromJson - -------------------------------------------------------------------------------------- --- VRFKey hash - -foreign import vrfKeyHash_free :: VRFKeyHash -> Effect Unit -foreign import vrfKeyHash_fromBytes :: Bytes -> ForeignErrorable VRFKeyHash -foreign import vrfKeyHash_toBytes :: VRFKeyHash -> Bytes -foreign import vrfKeyHash_toBech32 :: VRFKeyHash -> String -> String -foreign import vrfKeyHash_fromBech32 :: String -> ForeignErrorable VRFKeyHash -foreign import vrfKeyHash_toHex :: VRFKeyHash -> String -foreign import vrfKeyHash_fromHex :: String -> ForeignErrorable VRFKeyHash - --- | VRFKey hash class -type VRFKeyHashClass = - { free :: VRFKeyHash -> Effect Unit - -- ^ Free - -- > free self - , fromBytes :: Bytes -> Maybe VRFKeyHash - -- ^ From bytes - -- > fromBytes bytes - , toBytes :: VRFKeyHash -> Bytes - -- ^ To bytes - -- > toBytes self - , toBech32 :: VRFKeyHash -> String -> String - -- ^ To bech32 - -- > toBech32 self prefix - , fromBech32 :: String -> Maybe VRFKeyHash - -- ^ From bech32 - -- > fromBech32 bechStr - , toHex :: VRFKeyHash -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe VRFKeyHash - -- ^ From hex - -- > fromHex hex - } - --- | VRFKey hash class API -vrfKeyHash :: VRFKeyHashClass -vrfKeyHash = - { free: vrfKeyHash_free - , fromBytes: \a1 -> runForeignMaybe $ vrfKeyHash_fromBytes a1 - , toBytes: vrfKeyHash_toBytes - , toBech32: vrfKeyHash_toBech32 - , fromBech32: \a1 -> runForeignMaybe $ vrfKeyHash_fromBech32 a1 - , toHex: vrfKeyHash_toHex - , fromHex: \a1 -> runForeignMaybe $ vrfKeyHash_fromHex a1 - } - -instance HasFree VRFKeyHash where - free = vrfKeyHash.free - -instance Show VRFKeyHash where - show = vrfKeyHash.toHex - -instance IsHex VRFKeyHash where - toHex = vrfKeyHash.toHex - fromHex = vrfKeyHash.fromHex - -instance IsBytes VRFKeyHash where - toBytes = vrfKeyHash.toBytes - fromBytes = vrfKeyHash.fromBytes - -------------------------------------------------------------------------------------- --- VRFVKey - -foreign import vrfvKey_free :: VRFVKey -> Effect Unit -foreign import vrfvKey_fromBytes :: Bytes -> ForeignErrorable VRFVKey -foreign import vrfvKey_toBytes :: VRFVKey -> Bytes -foreign import vrfvKey_toBech32 :: VRFVKey -> String -> String -foreign import vrfvKey_fromBech32 :: String -> ForeignErrorable VRFVKey -foreign import vrfvKey_toHex :: VRFVKey -> String -foreign import vrfvKey_fromHex :: String -> ForeignErrorable VRFVKey - --- | VRFVKey class -type VRFVKeyClass = - { free :: VRFVKey -> Effect Unit - -- ^ Free - -- > free self - , fromBytes :: Bytes -> Maybe VRFVKey - -- ^ From bytes - -- > fromBytes bytes - , toBytes :: VRFVKey -> Bytes - -- ^ To bytes - -- > toBytes self - , toBech32 :: VRFVKey -> String -> String - -- ^ To bech32 - -- > toBech32 self prefix - , fromBech32 :: String -> Maybe VRFVKey - -- ^ From bech32 - -- > fromBech32 bechStr - , toHex :: VRFVKey -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe VRFVKey - -- ^ From hex - -- > fromHex hex - } - --- | VRFVKey class API -vrfvKey :: VRFVKeyClass -vrfvKey = - { free: vrfvKey_free - , fromBytes: \a1 -> runForeignMaybe $ vrfvKey_fromBytes a1 - , toBytes: vrfvKey_toBytes - , toBech32: vrfvKey_toBech32 - , fromBech32: \a1 -> runForeignMaybe $ vrfvKey_fromBech32 a1 - , toHex: vrfvKey_toHex - , fromHex: \a1 -> runForeignMaybe $ vrfvKey_fromHex a1 - } - -instance HasFree VRFVKey where - free = vrfvKey.free - -instance Show VRFVKey where - show = vrfvKey.toHex - -instance IsHex VRFVKey where - toHex = vrfvKey.toHex - fromHex = vrfvKey.fromHex - -instance IsBytes VRFVKey where - toBytes = vrfvKey.toBytes - fromBytes = vrfvKey.fromBytes - -------------------------------------------------------------------------------------- --- Value - -foreign import value_free :: Value -> Effect Unit -foreign import value_toBytes :: Value -> Bytes -foreign import value_fromBytes :: Bytes -> ForeignErrorable Value -foreign import value_toHex :: Value -> String -foreign import value_fromHex :: String -> ForeignErrorable Value -foreign import value_toJson :: Value -> String -foreign import value_toJsValue :: Value -> ValueJson -foreign import value_fromJson :: String -> ForeignErrorable Value -foreign import value_new :: BigNum -> Value -foreign import value_newFromAssets :: MultiAsset -> Value -foreign import value_newWithAssets :: BigNum -> MultiAsset -> Value -foreign import value_zero :: Value -foreign import value_isZero :: Value -> Boolean -foreign import value_coin :: Value -> BigNum -foreign import value_setCoin :: Value -> BigNum -> Effect Unit -foreign import value_multiasset :: Value -> Nullable MultiAsset -foreign import value_setMultiasset :: Value -> MultiAsset -> Effect Unit -foreign import value_checkedAdd :: Value -> Value -> Value -foreign import value_checkedSub :: Value -> Value -> Value -foreign import value_clampedSub :: Value -> Value -> Value -foreign import value_compare :: Value -> Value -> Nullable Int - --- | Value class -type ValueClass = - { free :: Value -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: Value -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe Value - -- ^ From bytes - -- > fromBytes bytes - , toHex :: Value -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe Value - -- ^ From hex - -- > fromHex hexStr - , toJson :: Value -> String - -- ^ To json - -- > toJson self - , toJsValue :: Value -> ValueJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe Value - -- ^ From json - -- > fromJson json - , new :: BigNum -> Value - -- ^ New - -- > new coin - , newFromAssets :: MultiAsset -> Value - -- ^ New from assets - -- > newFromAssets multiasset - , newWithAssets :: BigNum -> MultiAsset -> Value - -- ^ New with assets - -- > newWithAssets coin multiasset - , zero :: Value - -- ^ Zero - -- > zero - , isZero :: Value -> Boolean - -- ^ Is zero - -- > isZero self - , coin :: Value -> BigNum - -- ^ Coin - -- > coin self - , setCoin :: Value -> BigNum -> Effect Unit - -- ^ Set coin - -- > setCoin self coin - , multiasset :: Value -> Maybe MultiAsset - -- ^ Multiasset - -- > multiasset self - , setMultiasset :: Value -> MultiAsset -> Effect Unit - -- ^ Set multiasset - -- > setMultiasset self multiasset - , checkedAdd :: Value -> Value -> Value - -- ^ Checked add - -- > checkedAdd self rhs - , checkedSub :: Value -> Value -> Value - -- ^ Checked sub - -- > checkedSub self rhsValue - , clampedSub :: Value -> Value -> Value - -- ^ Clamped sub - -- > clampedSub self rhsValue - , compare :: Value -> Value -> Maybe Int - -- ^ Compare - -- > compare self rhsValue - } - --- | Value class API -value :: ValueClass -value = - { free: value_free - , toBytes: value_toBytes - , fromBytes: \a1 -> runForeignMaybe $ value_fromBytes a1 - , toHex: value_toHex - , fromHex: \a1 -> runForeignMaybe $ value_fromHex a1 - , toJson: value_toJson - , toJsValue: value_toJsValue - , fromJson: \a1 -> runForeignMaybe $ value_fromJson a1 - , new: value_new - , newFromAssets: value_newFromAssets - , newWithAssets: value_newWithAssets - , zero: value_zero - , isZero: value_isZero - , coin: value_coin - , setCoin: value_setCoin - , multiasset: \a1 -> Nullable.toMaybe $ value_multiasset a1 - , setMultiasset: value_setMultiasset - , checkedAdd: value_checkedAdd - , checkedSub: value_checkedSub - , clampedSub: value_clampedSub - , compare: \a1 a2 -> Nullable.toMaybe $ value_compare a1 a2 - } - -instance HasFree Value where - free = value.free - -instance Show Value where - show = value.toHex - -instance ToJsValue Value where - toJsValue = value.toJsValue - -instance IsHex Value where - toHex = value.toHex - fromHex = value.fromHex - -instance IsBytes Value where - toBytes = value.toBytes - fromBytes = value.fromBytes - -instance IsJson Value where - toJson = value.toJson - fromJson = value.fromJson - -------------------------------------------------------------------------------------- --- Vkey - -foreign import vkey_free :: Vkey -> Effect Unit -foreign import vkey_toBytes :: Vkey -> Bytes -foreign import vkey_fromBytes :: Bytes -> ForeignErrorable Vkey -foreign import vkey_toHex :: Vkey -> String -foreign import vkey_fromHex :: String -> ForeignErrorable Vkey -foreign import vkey_toJson :: Vkey -> String -foreign import vkey_toJsValue :: Vkey -> VkeyJson -foreign import vkey_fromJson :: String -> ForeignErrorable Vkey -foreign import vkey_new :: PublicKey -> Vkey -foreign import vkey_publicKey :: Vkey -> PublicKey - --- | Vkey class -type VkeyClass = - { free :: Vkey -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: Vkey -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe Vkey - -- ^ From bytes - -- > fromBytes bytes - , toHex :: Vkey -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe Vkey - -- ^ From hex - -- > fromHex hexStr - , toJson :: Vkey -> String - -- ^ To json - -- > toJson self - , toJsValue :: Vkey -> VkeyJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe Vkey - -- ^ From json - -- > fromJson json - , new :: PublicKey -> Vkey - -- ^ New - -- > new pk - , publicKey :: Vkey -> PublicKey - -- ^ Public key - -- > publicKey self - } - --- | Vkey class API -vkey :: VkeyClass -vkey = - { free: vkey_free - , toBytes: vkey_toBytes - , fromBytes: \a1 -> runForeignMaybe $ vkey_fromBytes a1 - , toHex: vkey_toHex - , fromHex: \a1 -> runForeignMaybe $ vkey_fromHex a1 - , toJson: vkey_toJson - , toJsValue: vkey_toJsValue - , fromJson: \a1 -> runForeignMaybe $ vkey_fromJson a1 - , new: vkey_new - , publicKey: vkey_publicKey - } - -instance HasFree Vkey where - free = vkey.free - -instance Show Vkey where - show = vkey.toHex - -instance ToJsValue Vkey where - toJsValue = vkey.toJsValue - -instance IsHex Vkey where - toHex = vkey.toHex - fromHex = vkey.fromHex - -instance IsBytes Vkey where - toBytes = vkey.toBytes - fromBytes = vkey.fromBytes - -instance IsJson Vkey where - toJson = vkey.toJson - fromJson = vkey.fromJson - -------------------------------------------------------------------------------------- --- Vkeys - -foreign import vkeys_free :: Vkeys -> Effect Unit -foreign import vkeys_new :: Effect Vkeys -foreign import vkeys_len :: Vkeys -> Effect Int -foreign import vkeys_get :: Vkeys -> Int -> Effect Vkey -foreign import vkeys_add :: Vkeys -> Vkey -> Effect Unit - --- | Vkeys class -type VkeysClass = - { free :: Vkeys -> Effect Unit - -- ^ Free - -- > free self - , new :: Effect Vkeys - -- ^ New - -- > new - , len :: Vkeys -> Effect Int - -- ^ Len - -- > len self - , get :: Vkeys -> Int -> Effect Vkey - -- ^ Get - -- > get self index - , add :: Vkeys -> Vkey -> Effect Unit - -- ^ Add - -- > add self elem - } - --- | Vkeys class API -vkeys :: VkeysClass -vkeys = - { free: vkeys_free - , new: vkeys_new - , len: vkeys_len - , get: vkeys_get - , add: vkeys_add - } - -instance HasFree Vkeys where - free = vkeys.free - -instance MutableList Vkeys Vkey where - addItem = vkeys.add - getItem = vkeys.get - emptyList = vkeys.new - -instance MutableLen Vkeys where - getLen = vkeys.len - -------------------------------------------------------------------------------------- --- Vkeywitness - -foreign import vkeywitness_free :: Vkeywitness -> Effect Unit -foreign import vkeywitness_toBytes :: Vkeywitness -> Bytes -foreign import vkeywitness_fromBytes :: Bytes -> ForeignErrorable Vkeywitness -foreign import vkeywitness_toHex :: Vkeywitness -> String -foreign import vkeywitness_fromHex :: String -> ForeignErrorable Vkeywitness -foreign import vkeywitness_toJson :: Vkeywitness -> String -foreign import vkeywitness_toJsValue :: Vkeywitness -> VkeywitnessJson -foreign import vkeywitness_fromJson :: String -> ForeignErrorable Vkeywitness -foreign import vkeywitness_new :: Vkey -> Ed25519Signature -> Vkeywitness -foreign import vkeywitness_vkey :: Vkeywitness -> Vkey -foreign import vkeywitness_signature :: Vkeywitness -> Ed25519Signature - --- | Vkeywitness class -type VkeywitnessClass = - { free :: Vkeywitness -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: Vkeywitness -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe Vkeywitness - -- ^ From bytes - -- > fromBytes bytes - , toHex :: Vkeywitness -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe Vkeywitness - -- ^ From hex - -- > fromHex hexStr - , toJson :: Vkeywitness -> String - -- ^ To json - -- > toJson self - , toJsValue :: Vkeywitness -> VkeywitnessJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe Vkeywitness - -- ^ From json - -- > fromJson json - , new :: Vkey -> Ed25519Signature -> Vkeywitness - -- ^ New - -- > new vkey signature - , vkey :: Vkeywitness -> Vkey - -- ^ Vkey - -- > vkey self - , signature :: Vkeywitness -> Ed25519Signature - -- ^ Signature - -- > signature self - } - --- | Vkeywitness class API -vkeywitness :: VkeywitnessClass -vkeywitness = - { free: vkeywitness_free - , toBytes: vkeywitness_toBytes - , fromBytes: \a1 -> runForeignMaybe $ vkeywitness_fromBytes a1 - , toHex: vkeywitness_toHex - , fromHex: \a1 -> runForeignMaybe $ vkeywitness_fromHex a1 - , toJson: vkeywitness_toJson - , toJsValue: vkeywitness_toJsValue - , fromJson: \a1 -> runForeignMaybe $ vkeywitness_fromJson a1 - , new: vkeywitness_new - , vkey: vkeywitness_vkey - , signature: vkeywitness_signature - } - -instance HasFree Vkeywitness where - free = vkeywitness.free - -instance Show Vkeywitness where - show = vkeywitness.toHex - -instance ToJsValue Vkeywitness where - toJsValue = vkeywitness.toJsValue - -instance IsHex Vkeywitness where - toHex = vkeywitness.toHex - fromHex = vkeywitness.fromHex - -instance IsBytes Vkeywitness where - toBytes = vkeywitness.toBytes - fromBytes = vkeywitness.fromBytes - -instance IsJson Vkeywitness where - toJson = vkeywitness.toJson - fromJson = vkeywitness.fromJson - -------------------------------------------------------------------------------------- --- Vkeywitnesses - -foreign import vkeywitnesses_free :: Vkeywitnesses -> Effect Unit -foreign import vkeywitnesses_new :: Effect Vkeywitnesses -foreign import vkeywitnesses_len :: Vkeywitnesses -> Effect Int -foreign import vkeywitnesses_get :: Vkeywitnesses -> Int -> Effect Vkeywitness -foreign import vkeywitnesses_add :: Vkeywitnesses -> Vkeywitness -> Effect Unit - --- | Vkeywitnesses class -type VkeywitnessesClass = - { free :: Vkeywitnesses -> Effect Unit - -- ^ Free - -- > free self - , new :: Effect Vkeywitnesses - -- ^ New - -- > new - , len :: Vkeywitnesses -> Effect Int - -- ^ Len - -- > len self - , get :: Vkeywitnesses -> Int -> Effect Vkeywitness - -- ^ Get - -- > get self index - , add :: Vkeywitnesses -> Vkeywitness -> Effect Unit - -- ^ Add - -- > add self elem - } - --- | Vkeywitnesses class API -vkeywitnesses :: VkeywitnessesClass -vkeywitnesses = - { free: vkeywitnesses_free - , new: vkeywitnesses_new - , len: vkeywitnesses_len - , get: vkeywitnesses_get - , add: vkeywitnesses_add - } - -instance HasFree Vkeywitnesses where - free = vkeywitnesses.free - -instance MutableList Vkeywitnesses Vkeywitness where - addItem = vkeywitnesses.add - getItem = vkeywitnesses.get - emptyList = vkeywitnesses.new - -instance MutableLen Vkeywitnesses where - getLen = vkeywitnesses.len - -------------------------------------------------------------------------------------- --- Withdrawals - -foreign import withdrawals_free :: Withdrawals -> Effect Unit -foreign import withdrawals_toBytes :: Withdrawals -> Bytes -foreign import withdrawals_fromBytes :: Bytes -> ForeignErrorable Withdrawals -foreign import withdrawals_toHex :: Withdrawals -> String -foreign import withdrawals_fromHex :: String -> ForeignErrorable Withdrawals -foreign import withdrawals_toJson :: Withdrawals -> String -foreign import withdrawals_toJsValue :: Withdrawals -> WithdrawalsJson -foreign import withdrawals_fromJson :: String -> ForeignErrorable Withdrawals -foreign import withdrawals_new :: Effect Withdrawals -foreign import withdrawals_len :: Withdrawals -> Effect Int -foreign import withdrawals_insert :: Withdrawals -> RewardAddress -> BigNum -> Effect ((Nullable BigNum)) -foreign import withdrawals_get :: Withdrawals -> RewardAddress -> Effect ((Nullable BigNum)) -foreign import withdrawals_keys :: Withdrawals -> Effect RewardAddresses - --- | Withdrawals class -type WithdrawalsClass = - { free :: Withdrawals -> Effect Unit - -- ^ Free - -- > free self - , toBytes :: Withdrawals -> Bytes - -- ^ To bytes - -- > toBytes self - , fromBytes :: Bytes -> Maybe Withdrawals - -- ^ From bytes - -- > fromBytes bytes - , toHex :: Withdrawals -> String - -- ^ To hex - -- > toHex self - , fromHex :: String -> Maybe Withdrawals - -- ^ From hex - -- > fromHex hexStr - , toJson :: Withdrawals -> String - -- ^ To json - -- > toJson self - , toJsValue :: Withdrawals -> WithdrawalsJson - -- ^ To js value - -- > toJsValue self - , fromJson :: String -> Maybe Withdrawals - -- ^ From json - -- > fromJson json - , new :: Effect Withdrawals - -- ^ New - -- > new - , len :: Withdrawals -> Effect Int - -- ^ Len - -- > len self - , insert :: Withdrawals -> RewardAddress -> BigNum -> Effect ((Maybe BigNum)) - -- ^ Insert - -- > insert self key value - , get :: Withdrawals -> RewardAddress -> Effect ((Maybe BigNum)) - -- ^ Get - -- > get self key - , keys :: Withdrawals -> Effect RewardAddresses - -- ^ Keys - -- > keys self - } - --- | Withdrawals class API -withdrawals :: WithdrawalsClass -withdrawals = - { free: withdrawals_free - , toBytes: withdrawals_toBytes - , fromBytes: \a1 -> runForeignMaybe $ withdrawals_fromBytes a1 - , toHex: withdrawals_toHex - , fromHex: \a1 -> runForeignMaybe $ withdrawals_fromHex a1 - , toJson: withdrawals_toJson - , toJsValue: withdrawals_toJsValue - , fromJson: \a1 -> runForeignMaybe $ withdrawals_fromJson a1 - , new: withdrawals_new - , len: withdrawals_len - , insert: \a1 a2 a3 -> Nullable.toMaybe <$> withdrawals_insert a1 a2 a3 - , get: \a1 a2 -> Nullable.toMaybe <$> withdrawals_get a1 a2 - , keys: withdrawals_keys - } - -instance HasFree Withdrawals where - free = withdrawals.free - -instance Show Withdrawals where - show = withdrawals.toHex - -instance ToJsValue Withdrawals where - toJsValue = withdrawals.toJsValue - -instance IsHex Withdrawals where - toHex = withdrawals.toHex - fromHex = withdrawals.fromHex - -instance IsBytes Withdrawals where - toBytes = withdrawals.toBytes - fromBytes = withdrawals.fromBytes - -instance IsJson Withdrawals where - toJson = withdrawals.toJson - fromJson = withdrawals.fromJson diff --git a/test/Main.purs b/test/Main.purs new file mode 100644 index 0000000..f45a412 --- /dev/null +++ b/test/Main.purs @@ -0,0 +1,8 @@ +module Test.Main where + +import Prelude + +import Effect (Effect) + +main :: Effect Unit +main = pure unit From cbbf436e1ce3d8f6d170930e96021f1e015233ff Mon Sep 17 00:00:00 2001 From: Vladimir Kalnitsky Date: Wed, 24 Jan 2024 20:09:32 +0400 Subject: [PATCH 05/18] Add .spago2nix to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 0eccf64..38a441f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.spago2nix/ .spago/ output/ demo/dist/ From d39c707235bf60416153257e01c4d456d3644dde Mon Sep 17 00:00:00 2001 From: Vladimir Kalnitsky Date: Thu, 25 Jan 2024 01:40:49 +0400 Subject: [PATCH 06/18] Handle mutating functions properly --- code-gen/parse-csl/src/Csl.hs | 1 + code-gen/parse-csl/src/Csl/Gen.hs | 7 +- spago.dhall | 2 +- src/Cardano/Serialization/Lib.js | 105 ++++++++++------------- src/Cardano/Serialization/Lib.purs | 130 ++++++++++------------------- 5 files changed, 97 insertions(+), 148 deletions(-) diff --git a/code-gen/parse-csl/src/Csl.hs b/code-gen/parse-csl/src/Csl.hs index b31a35a..67e8130 100644 --- a/code-gen/parse-csl/src/Csl.hs +++ b/code-gen/parse-csl/src/Csl.hs @@ -37,6 +37,7 @@ unneededClasses = , "TransactionWitnessSets" , "Strings" , "PublicKeys" + , "FixedTransaction" ] neededFunctions = diff --git a/code-gen/parse-csl/src/Csl/Gen.hs b/code-gen/parse-csl/src/Csl/Gen.hs index c7c1d35..a7bb276 100644 --- a/code-gen/parse-csl/src/Csl/Gen.hs +++ b/code-gen/parse-csl/src/Csl/Gen.hs @@ -501,8 +501,10 @@ data Pureness = Pure | Mutating | Throwing getPureness :: String -> Fun -> Pureness getPureness className Fun{..} | isConvertor fun'name = Pure - | (fun'res /= "void" && not isMutating && not isThrowing) = Pure + | take 4 fun'name == "set_" = Mutating + | fun'res == "void" = Throwing | isMutating && not isThrowing = Mutating + | not isMutating && not isThrowing = Pure | otherwise = Throwing where isMutating = dirtyClass className || mutatingMethods (className, fun'name) @@ -585,7 +587,8 @@ mutating = mconcat $ [ keys "Assets" , inClass "TransactionBuilder" ["new"] - , inClass "AuxiliaryData" ["new", "native_scripts", "plutus_scripts"] + , inClass "AuxiliaryData" + [ "new", "set_native_scripts", "set_plutus_scripts", "set_metadata", "set_prefer_alonzo_format" ] , inClass "AuxiliaryDataSet" ["new", "insert", "get", "indices"] , newSetGet "CostModel" , keys "Costmdls" diff --git a/spago.dhall b/spago.dhall index 8f751eb..e720fc2 100644 --- a/spago.dhall +++ b/spago.dhall @@ -10,7 +10,7 @@ When creating a new Spago project, you can use `spago init --no-comments` or `spago init -C` to generate this file without the comments in this block. -} -{ name = "my-project" +{ name = "cardano-serialization-lib" , dependencies = [ "aeson" , "argonaut" diff --git a/src/Cardano/Serialization/Lib.js b/src/Cardano/Serialization/Lib.js index d45e729..f595ebe 100644 --- a/src/Cardano/Serialization/Lib.js +++ b/src/Cardano/Serialization/Lib.js @@ -30,13 +30,13 @@ export const assets_new = () => CSL.Assets.new(); // AuxiliaryData export const auxiliaryData_new = () => CSL.AuxiliaryData.new(); export const auxiliaryData_metadata = self => self.metadata.bind(self)(); -export const auxiliaryData_setMetadata = self => metadata => errorableToPurs(self.set_metadata.bind(self), metadata); -export const auxiliaryData_nativeScripts = self => () => self.native_scripts.bind(self)(); -export const auxiliaryData_setNativeScripts = self => native_scripts => errorableToPurs(self.set_native_scripts.bind(self), native_scripts); -export const auxiliaryData_plutusScripts = self => () => self.plutus_scripts.bind(self)(); -export const auxiliaryData_setPlutusScripts = self => plutus_scripts => errorableToPurs(self.set_plutus_scripts.bind(self), plutus_scripts); +export const auxiliaryData_setMetadata = self => metadata => () => self.set_metadata.bind(self)(metadata); +export const auxiliaryData_nativeScripts = self => self.native_scripts.bind(self)(); +export const auxiliaryData_setNativeScripts = self => native_scripts => () => self.set_native_scripts.bind(self)(native_scripts); +export const auxiliaryData_plutusScripts = self => self.plutus_scripts.bind(self)(); +export const auxiliaryData_setPlutusScripts = self => plutus_scripts => () => self.set_plutus_scripts.bind(self)(plutus_scripts); export const auxiliaryData_preferAlonzoFormat = self => self.prefer_alonzo_format.bind(self)(); -export const auxiliaryData_setPreferAlonzoFormat = self => prefer => errorableToPurs(self.set_prefer_alonzo_format.bind(self), prefer); +export const auxiliaryData_setPreferAlonzoFormat = self => prefer => () => self.set_prefer_alonzo_format.bind(self)(prefer); // AuxiliaryDataHash export const auxiliaryDataHash_toBech32 = self => prefix => self.to_bech32.bind(self)(prefix); @@ -204,21 +204,6 @@ export const exUnits_mem = self => self.mem.bind(self)(); export const exUnits_steps = self => self.steps.bind(self)(); export const exUnits_new = mem => steps => CSL.ExUnits.new(mem, steps); -// FixedTransaction -export const fixedTransaction_new = raw_body => raw_witness_set => is_valid => CSL.FixedTransaction.new(raw_body, raw_witness_set, is_valid); -export const fixedTransaction_newWithAuxiliary = raw_body => raw_witness_set => raw_auxiliary_data => is_valid => CSL.FixedTransaction.new_with_auxiliary(raw_body, raw_witness_set, raw_auxiliary_data, is_valid); -export const fixedTransaction_body = self => self.body.bind(self)(); -export const fixedTransaction_rawBody = self => self.raw_body.bind(self)(); -export const fixedTransaction_setBody = self => raw_body => errorableToPurs(self.set_body.bind(self), raw_body); -export const fixedTransaction_setWitnessSet = self => raw_witness_set => errorableToPurs(self.set_witness_set.bind(self), raw_witness_set); -export const fixedTransaction_witnessSet = self => self.witness_set.bind(self)(); -export const fixedTransaction_rawWitnessSet = self => self.raw_witness_set.bind(self)(); -export const fixedTransaction_setIsValid = self => valid => errorableToPurs(self.set_is_valid.bind(self), valid); -export const fixedTransaction_isValid = self => self.is_valid.bind(self)(); -export const fixedTransaction_setAuxiliaryData = self => raw_auxiliary_data => errorableToPurs(self.set_auxiliary_data.bind(self), raw_auxiliary_data); -export const fixedTransaction_auxiliaryData = self => self.auxiliary_data.bind(self)(); -export const fixedTransaction_rawAuxiliaryData = self => self.raw_auxiliary_data.bind(self)(); - // GeneralTransactionMetadata export const generalTransactionMetadata_new = () => CSL.GeneralTransactionMetadata.new(); @@ -515,51 +500,51 @@ export const privateKey_fromHex = hex_str => errorableToPurs(CSL.PrivateKey.from export const proposedProtocolParameterUpdates_new = () => CSL.ProposedProtocolParameterUpdates.new(); // ProtocolParamUpdate -export const protocolParamUpdate_setMinfeeA = self => minfee_a => errorableToPurs(self.set_minfee_a.bind(self), minfee_a); +export const protocolParamUpdate_setMinfeeA = self => minfee_a => () => self.set_minfee_a.bind(self)(minfee_a); export const protocolParamUpdate_minfeeA = self => self.minfee_a.bind(self)(); -export const protocolParamUpdate_setMinfeeB = self => minfee_b => errorableToPurs(self.set_minfee_b.bind(self), minfee_b); +export const protocolParamUpdate_setMinfeeB = self => minfee_b => () => self.set_minfee_b.bind(self)(minfee_b); export const protocolParamUpdate_minfeeB = self => self.minfee_b.bind(self)(); -export const protocolParamUpdate_setMaxBlockBodySize = self => max_block_body_size => errorableToPurs(self.set_max_block_body_size.bind(self), max_block_body_size); +export const protocolParamUpdate_setMaxBlockBodySize = self => max_block_body_size => () => self.set_max_block_body_size.bind(self)(max_block_body_size); export const protocolParamUpdate_maxBlockBodySize = self => self.max_block_body_size.bind(self)(); -export const protocolParamUpdate_setMaxTxSize = self => max_tx_size => errorableToPurs(self.set_max_tx_size.bind(self), max_tx_size); +export const protocolParamUpdate_setMaxTxSize = self => max_tx_size => () => self.set_max_tx_size.bind(self)(max_tx_size); export const protocolParamUpdate_maxTxSize = self => self.max_tx_size.bind(self)(); -export const protocolParamUpdate_setMaxBlockHeaderSize = self => max_block_header_size => errorableToPurs(self.set_max_block_header_size.bind(self), max_block_header_size); +export const protocolParamUpdate_setMaxBlockHeaderSize = self => max_block_header_size => () => self.set_max_block_header_size.bind(self)(max_block_header_size); export const protocolParamUpdate_maxBlockHeaderSize = self => self.max_block_header_size.bind(self)(); -export const protocolParamUpdate_setKeyDeposit = self => key_deposit => errorableToPurs(self.set_key_deposit.bind(self), key_deposit); +export const protocolParamUpdate_setKeyDeposit = self => key_deposit => () => self.set_key_deposit.bind(self)(key_deposit); export const protocolParamUpdate_keyDeposit = self => self.key_deposit.bind(self)(); -export const protocolParamUpdate_setPoolDeposit = self => pool_deposit => errorableToPurs(self.set_pool_deposit.bind(self), pool_deposit); +export const protocolParamUpdate_setPoolDeposit = self => pool_deposit => () => self.set_pool_deposit.bind(self)(pool_deposit); export const protocolParamUpdate_poolDeposit = self => self.pool_deposit.bind(self)(); -export const protocolParamUpdate_setMaxEpoch = self => max_epoch => errorableToPurs(self.set_max_epoch.bind(self), max_epoch); +export const protocolParamUpdate_setMaxEpoch = self => max_epoch => () => self.set_max_epoch.bind(self)(max_epoch); export const protocolParamUpdate_maxEpoch = self => self.max_epoch.bind(self)(); -export const protocolParamUpdate_setNOpt = self => n_opt => errorableToPurs(self.set_n_opt.bind(self), n_opt); +export const protocolParamUpdate_setNOpt = self => n_opt => () => self.set_n_opt.bind(self)(n_opt); export const protocolParamUpdate_nOpt = self => self.n_opt.bind(self)(); -export const protocolParamUpdate_setPoolPledgeInfluence = self => pool_pledge_influence => errorableToPurs(self.set_pool_pledge_influence.bind(self), pool_pledge_influence); +export const protocolParamUpdate_setPoolPledgeInfluence = self => pool_pledge_influence => () => self.set_pool_pledge_influence.bind(self)(pool_pledge_influence); export const protocolParamUpdate_poolPledgeInfluence = self => self.pool_pledge_influence.bind(self)(); -export const protocolParamUpdate_setExpansionRate = self => expansion_rate => errorableToPurs(self.set_expansion_rate.bind(self), expansion_rate); +export const protocolParamUpdate_setExpansionRate = self => expansion_rate => () => self.set_expansion_rate.bind(self)(expansion_rate); export const protocolParamUpdate_expansionRate = self => self.expansion_rate.bind(self)(); -export const protocolParamUpdate_setTreasuryGrowthRate = self => treasury_growth_rate => errorableToPurs(self.set_treasury_growth_rate.bind(self), treasury_growth_rate); +export const protocolParamUpdate_setTreasuryGrowthRate = self => treasury_growth_rate => () => self.set_treasury_growth_rate.bind(self)(treasury_growth_rate); export const protocolParamUpdate_treasuryGrowthRate = self => self.treasury_growth_rate.bind(self)(); export const protocolParamUpdate_d = self => self.d.bind(self)(); export const protocolParamUpdate_extraEntropy = self => self.extra_entropy.bind(self)(); -export const protocolParamUpdate_setProtocolVersion = self => protocol_version => errorableToPurs(self.set_protocol_version.bind(self), protocol_version); +export const protocolParamUpdate_setProtocolVersion = self => protocol_version => () => self.set_protocol_version.bind(self)(protocol_version); export const protocolParamUpdate_protocolVersion = self => self.protocol_version.bind(self)(); -export const protocolParamUpdate_setMinPoolCost = self => min_pool_cost => errorableToPurs(self.set_min_pool_cost.bind(self), min_pool_cost); +export const protocolParamUpdate_setMinPoolCost = self => min_pool_cost => () => self.set_min_pool_cost.bind(self)(min_pool_cost); export const protocolParamUpdate_minPoolCost = self => self.min_pool_cost.bind(self)(); -export const protocolParamUpdate_setAdaPerUtxoByte = self => ada_per_utxo_byte => errorableToPurs(self.set_ada_per_utxo_byte.bind(self), ada_per_utxo_byte); +export const protocolParamUpdate_setAdaPerUtxoByte = self => ada_per_utxo_byte => () => self.set_ada_per_utxo_byte.bind(self)(ada_per_utxo_byte); export const protocolParamUpdate_adaPerUtxoByte = self => self.ada_per_utxo_byte.bind(self)(); -export const protocolParamUpdate_setCostModels = self => cost_models => errorableToPurs(self.set_cost_models.bind(self), cost_models); +export const protocolParamUpdate_setCostModels = self => cost_models => () => self.set_cost_models.bind(self)(cost_models); export const protocolParamUpdate_costModels = self => self.cost_models.bind(self)(); -export const protocolParamUpdate_setExecutionCosts = self => execution_costs => errorableToPurs(self.set_execution_costs.bind(self), execution_costs); +export const protocolParamUpdate_setExecutionCosts = self => execution_costs => () => self.set_execution_costs.bind(self)(execution_costs); export const protocolParamUpdate_executionCosts = self => self.execution_costs.bind(self)(); -export const protocolParamUpdate_setMaxTxExUnits = self => max_tx_ex_units => errorableToPurs(self.set_max_tx_ex_units.bind(self), max_tx_ex_units); +export const protocolParamUpdate_setMaxTxExUnits = self => max_tx_ex_units => () => self.set_max_tx_ex_units.bind(self)(max_tx_ex_units); export const protocolParamUpdate_maxTxExUnits = self => self.max_tx_ex_units.bind(self)(); -export const protocolParamUpdate_setMaxBlockExUnits = self => max_block_ex_units => errorableToPurs(self.set_max_block_ex_units.bind(self), max_block_ex_units); +export const protocolParamUpdate_setMaxBlockExUnits = self => max_block_ex_units => () => self.set_max_block_ex_units.bind(self)(max_block_ex_units); export const protocolParamUpdate_maxBlockExUnits = self => self.max_block_ex_units.bind(self)(); -export const protocolParamUpdate_setMaxValueSize = self => max_value_size => errorableToPurs(self.set_max_value_size.bind(self), max_value_size); +export const protocolParamUpdate_setMaxValueSize = self => max_value_size => () => self.set_max_value_size.bind(self)(max_value_size); export const protocolParamUpdate_maxValueSize = self => self.max_value_size.bind(self)(); -export const protocolParamUpdate_setCollateralPercentage = self => collateral_percentage => errorableToPurs(self.set_collateral_percentage.bind(self), collateral_percentage); +export const protocolParamUpdate_setCollateralPercentage = self => collateral_percentage => () => self.set_collateral_percentage.bind(self)(collateral_percentage); export const protocolParamUpdate_collateralPercentage = self => self.collateral_percentage.bind(self)(); -export const protocolParamUpdate_setMaxCollateralInputs = self => max_collateral_inputs => errorableToPurs(self.set_max_collateral_inputs.bind(self), max_collateral_inputs); +export const protocolParamUpdate_setMaxCollateralInputs = self => max_collateral_inputs => () => self.set_max_collateral_inputs.bind(self)(max_collateral_inputs); export const protocolParamUpdate_maxCollateralInputs = self => self.max_collateral_inputs.bind(self)(); export const protocolParamUpdate_new = CSL.ProtocolParamUpdate.new(); @@ -705,7 +690,7 @@ export const transaction_body = self => self.body.bind(self)(); export const transaction_witnessSet = self => self.witness_set.bind(self)(); export const transaction_isValid = self => self.is_valid.bind(self)(); export const transaction_auxiliaryData = self => self.auxiliary_data.bind(self)(); -export const transaction_setIsValid = self => valid => errorableToPurs(self.set_is_valid.bind(self), valid); +export const transaction_setIsValid = self => valid => () => self.set_is_valid.bind(self)(valid); export const transaction_new = body => witness_set => auxiliary_data => CSL.Transaction.new(body, witness_set, auxiliary_data); // TransactionBatch @@ -718,36 +703,36 @@ export const transactionBody_outputs = self => self.outputs.bind(self)(); export const transactionBody_fee = self => self.fee.bind(self)(); export const transactionBody_ttl = self => self.ttl.bind(self)(); export const transactionBody_ttlBignum = self => self.ttl_bignum.bind(self)(); -export const transactionBody_setTtl = self => ttl => errorableToPurs(self.set_ttl.bind(self), ttl); +export const transactionBody_setTtl = self => ttl => () => self.set_ttl.bind(self)(ttl); export const transactionBody_removeTtl = self => errorableToPurs(self.remove_ttl.bind(self), ); -export const transactionBody_setCerts = self => certs => errorableToPurs(self.set_certs.bind(self), certs); +export const transactionBody_setCerts = self => certs => () => self.set_certs.bind(self)(certs); export const transactionBody_certs = self => self.certs.bind(self)(); -export const transactionBody_setWithdrawals = self => withdrawals => errorableToPurs(self.set_withdrawals.bind(self), withdrawals); +export const transactionBody_setWithdrawals = self => withdrawals => () => self.set_withdrawals.bind(self)(withdrawals); export const transactionBody_withdrawals = self => self.withdrawals.bind(self)(); -export const transactionBody_setUpdate = self => update => errorableToPurs(self.set_update.bind(self), update); +export const transactionBody_setUpdate = self => update => () => self.set_update.bind(self)(update); export const transactionBody_update = self => self.update.bind(self)(); -export const transactionBody_setAuxiliaryDataHash = self => auxiliary_data_hash => errorableToPurs(self.set_auxiliary_data_hash.bind(self), auxiliary_data_hash); +export const transactionBody_setAuxiliaryDataHash = self => auxiliary_data_hash => () => self.set_auxiliary_data_hash.bind(self)(auxiliary_data_hash); export const transactionBody_auxiliaryDataHash = self => self.auxiliary_data_hash.bind(self)(); -export const transactionBody_setValidityStartInterval = self => validity_start_interval => errorableToPurs(self.set_validity_start_interval.bind(self), validity_start_interval); -export const transactionBody_setValidityStartIntervalBignum = self => validity_start_interval => errorableToPurs(self.set_validity_start_interval_bignum.bind(self), validity_start_interval); +export const transactionBody_setValidityStartInterval = self => validity_start_interval => () => self.set_validity_start_interval.bind(self)(validity_start_interval); +export const transactionBody_setValidityStartIntervalBignum = self => validity_start_interval => () => self.set_validity_start_interval_bignum.bind(self)(validity_start_interval); export const transactionBody_validityStartIntervalBignum = self => self.validity_start_interval_bignum.bind(self)(); export const transactionBody_validityStartInterval = self => self.validity_start_interval.bind(self)(); -export const transactionBody_setMint = self => mint => errorableToPurs(self.set_mint.bind(self), mint); +export const transactionBody_setMint = self => mint => () => self.set_mint.bind(self)(mint); export const transactionBody_mint = self => self.mint.bind(self)(); export const transactionBody_multiassets = self => self.multiassets.bind(self)(); -export const transactionBody_setReferenceInputs = self => reference_inputs => errorableToPurs(self.set_reference_inputs.bind(self), reference_inputs); +export const transactionBody_setReferenceInputs = self => reference_inputs => () => self.set_reference_inputs.bind(self)(reference_inputs); export const transactionBody_referenceInputs = self => self.reference_inputs.bind(self)(); -export const transactionBody_setScriptDataHash = self => script_data_hash => errorableToPurs(self.set_script_data_hash.bind(self), script_data_hash); +export const transactionBody_setScriptDataHash = self => script_data_hash => () => self.set_script_data_hash.bind(self)(script_data_hash); export const transactionBody_scriptDataHash = self => self.script_data_hash.bind(self)(); -export const transactionBody_setCollateral = self => collateral => errorableToPurs(self.set_collateral.bind(self), collateral); +export const transactionBody_setCollateral = self => collateral => () => self.set_collateral.bind(self)(collateral); export const transactionBody_collateral = self => self.collateral.bind(self)(); -export const transactionBody_setRequiredSigners = self => required_signers => errorableToPurs(self.set_required_signers.bind(self), required_signers); +export const transactionBody_setRequiredSigners = self => required_signers => () => self.set_required_signers.bind(self)(required_signers); export const transactionBody_requiredSigners = self => self.required_signers.bind(self)(); -export const transactionBody_setNetworkId = self => network_id => errorableToPurs(self.set_network_id.bind(self), network_id); +export const transactionBody_setNetworkId = self => network_id => () => self.set_network_id.bind(self)(network_id); export const transactionBody_networkId = self => self.network_id.bind(self)(); -export const transactionBody_setCollateralReturn = self => collateral_return => errorableToPurs(self.set_collateral_return.bind(self), collateral_return); +export const transactionBody_setCollateralReturn = self => collateral_return => () => self.set_collateral_return.bind(self)(collateral_return); export const transactionBody_collateralReturn = self => self.collateral_return.bind(self)(); -export const transactionBody_setTotalCollateral = self => total_collateral => errorableToPurs(self.set_total_collateral.bind(self), total_collateral); +export const transactionBody_setTotalCollateral = self => total_collateral => () => self.set_total_collateral.bind(self)(total_collateral); export const transactionBody_totalCollateral = self => self.total_collateral.bind(self)(); export const transactionBody_new = inputs => outputs => fee => ttl => CSL.TransactionBody.new(inputs, outputs, fee, ttl); export const transactionBody_newTxBody = inputs => outputs => fee => CSL.TransactionBody.new_tx_body(inputs, outputs, fee); @@ -856,7 +841,7 @@ export const value_newWithAssets = coin => multiasset => CSL.Value.new_with_asse export const value_zero = CSL.Value.zero(); export const value_isZero = self => self.is_zero.bind(self)(); export const value_coin = self => self.coin.bind(self)(); -export const value_setCoin = self => coin => errorableToPurs(self.set_coin.bind(self), coin); +export const value_setCoin = self => coin => () => self.set_coin.bind(self)(coin); export const value_multiasset = self => self.multiasset.bind(self)(); export const value_setMultiasset = self => multiasset => () => self.set_multiasset.bind(self)(multiasset); export const value_checkedAdd = self => rhs => errorableToPurs(self.checked_add.bind(self), rhs); diff --git a/src/Cardano/Serialization/Lib.purs b/src/Cardano/Serialization/Lib.purs index 9ecbfa1..c801502 100644 --- a/src/Cardano/Serialization/Lib.purs +++ b/src/Cardano/Serialization/Lib.purs @@ -131,19 +131,6 @@ module Cardano.Serialization.Lib , exUnits_mem , exUnits_steps , exUnits_new - , fixedTransaction_new - , fixedTransaction_newWithAuxiliary - , fixedTransaction_body - , fixedTransaction_rawBody - , fixedTransaction_setBody - , fixedTransaction_setWitnessSet - , fixedTransaction_witnessSet - , fixedTransaction_rawWitnessSet - , fixedTransaction_setIsValid - , fixedTransaction_isValid - , fixedTransaction_setAuxiliaryData - , fixedTransaction_auxiliaryData - , fixedTransaction_rawAuxiliaryData , generalTransactionMetadata_new , genesisDelegateHash_toBech32 , genesisDelegateHash_fromBech32 @@ -633,7 +620,6 @@ module Cardano.Serialization.Lib , EnterpriseAddress , ExUnitPrices , ExUnits - , FixedTransaction , GeneralTransactionMetadata , GenesisDelegateHash , GenesisHash @@ -876,13 +862,13 @@ foreign import data AuxiliaryData :: Type foreign import auxiliaryData_new :: Effect AuxiliaryData foreign import auxiliaryData_metadata :: AuxiliaryData -> Nullable GeneralTransactionMetadata -foreign import auxiliaryData_setMetadata :: AuxiliaryData -> GeneralTransactionMetadata -> Nullable Unit -foreign import auxiliaryData_nativeScripts :: AuxiliaryData -> Effect ((Nullable NativeScripts)) -foreign import auxiliaryData_setNativeScripts :: AuxiliaryData -> NativeScripts -> Nullable Unit -foreign import auxiliaryData_plutusScripts :: AuxiliaryData -> Effect ((Nullable PlutusScripts)) -foreign import auxiliaryData_setPlutusScripts :: AuxiliaryData -> PlutusScripts -> Nullable Unit +foreign import auxiliaryData_setMetadata :: AuxiliaryData -> GeneralTransactionMetadata -> Effect Unit +foreign import auxiliaryData_nativeScripts :: AuxiliaryData -> Nullable NativeScripts +foreign import auxiliaryData_setNativeScripts :: AuxiliaryData -> NativeScripts -> Effect Unit +foreign import auxiliaryData_plutusScripts :: AuxiliaryData -> Nullable PlutusScripts +foreign import auxiliaryData_setPlutusScripts :: AuxiliaryData -> PlutusScripts -> Effect Unit foreign import auxiliaryData_preferAlonzoFormat :: AuxiliaryData -> Boolean -foreign import auxiliaryData_setPreferAlonzoFormat :: AuxiliaryData -> Boolean -> Nullable Unit +foreign import auxiliaryData_setPreferAlonzoFormat :: AuxiliaryData -> Boolean -> Effect Unit instance IsCsl AuxiliaryData where className _ = "AuxiliaryData" @@ -1336,32 +1322,6 @@ instance EncodeAeson ExUnits where encodeAeson = cslToAeson instance DecodeAeson ExUnits where decodeAeson = cslFromAeson instance Show ExUnits where show = showViaJson -------------------------------------------------------------------------------------- --- Fixed transaction - -foreign import data FixedTransaction :: Type - -foreign import fixedTransaction_new :: ByteArray -> ByteArray -> Boolean -> FixedTransaction -foreign import fixedTransaction_newWithAuxiliary :: ByteArray -> ByteArray -> ByteArray -> Boolean -> FixedTransaction -foreign import fixedTransaction_body :: FixedTransaction -> TransactionBody -foreign import fixedTransaction_rawBody :: FixedTransaction -> ByteArray -foreign import fixedTransaction_setBody :: FixedTransaction -> ByteArray -> Nullable Unit -foreign import fixedTransaction_setWitnessSet :: FixedTransaction -> ByteArray -> Nullable Unit -foreign import fixedTransaction_witnessSet :: FixedTransaction -> TransactionWitnessSet -foreign import fixedTransaction_rawWitnessSet :: FixedTransaction -> ByteArray -foreign import fixedTransaction_setIsValid :: FixedTransaction -> Boolean -> Nullable Unit -foreign import fixedTransaction_isValid :: FixedTransaction -> Boolean -foreign import fixedTransaction_setAuxiliaryData :: FixedTransaction -> ByteArray -> Nullable Unit -foreign import fixedTransaction_auxiliaryData :: FixedTransaction -> Nullable AuxiliaryData -foreign import fixedTransaction_rawAuxiliaryData :: FixedTransaction -> Nullable ByteArray - -instance IsCsl FixedTransaction where - className _ = "FixedTransaction" -instance IsBytes FixedTransaction -instance EncodeAeson FixedTransaction where encodeAeson = cslToAesonViaBytes -instance DecodeAeson FixedTransaction where decodeAeson = cslFromAesonViaBytes -instance Show FixedTransaction where show = showViaBytes - ------------------------------------------------------------------------------------- -- General transaction metadata @@ -2213,51 +2173,51 @@ instance IsMapContainer ProposedProtocolParameterUpdates GenesisHash ProtocolPar foreign import data ProtocolParamUpdate :: Type -foreign import protocolParamUpdate_setMinfeeA :: ProtocolParamUpdate -> BigNum -> Nullable Unit +foreign import protocolParamUpdate_setMinfeeA :: ProtocolParamUpdate -> BigNum -> Effect Unit foreign import protocolParamUpdate_minfeeA :: ProtocolParamUpdate -> Nullable BigNum -foreign import protocolParamUpdate_setMinfeeB :: ProtocolParamUpdate -> BigNum -> Nullable Unit +foreign import protocolParamUpdate_setMinfeeB :: ProtocolParamUpdate -> BigNum -> Effect Unit foreign import protocolParamUpdate_minfeeB :: ProtocolParamUpdate -> Nullable BigNum -foreign import protocolParamUpdate_setMaxBlockBodySize :: ProtocolParamUpdate -> Number -> Nullable Unit +foreign import protocolParamUpdate_setMaxBlockBodySize :: ProtocolParamUpdate -> Number -> Effect Unit foreign import protocolParamUpdate_maxBlockBodySize :: ProtocolParamUpdate -> Nullable Number -foreign import protocolParamUpdate_setMaxTxSize :: ProtocolParamUpdate -> Number -> Nullable Unit +foreign import protocolParamUpdate_setMaxTxSize :: ProtocolParamUpdate -> Number -> Effect Unit foreign import protocolParamUpdate_maxTxSize :: ProtocolParamUpdate -> Nullable Number -foreign import protocolParamUpdate_setMaxBlockHeaderSize :: ProtocolParamUpdate -> Number -> Nullable Unit +foreign import protocolParamUpdate_setMaxBlockHeaderSize :: ProtocolParamUpdate -> Number -> Effect Unit foreign import protocolParamUpdate_maxBlockHeaderSize :: ProtocolParamUpdate -> Nullable Number -foreign import protocolParamUpdate_setKeyDeposit :: ProtocolParamUpdate -> BigNum -> Nullable Unit +foreign import protocolParamUpdate_setKeyDeposit :: ProtocolParamUpdate -> BigNum -> Effect Unit foreign import protocolParamUpdate_keyDeposit :: ProtocolParamUpdate -> Nullable BigNum -foreign import protocolParamUpdate_setPoolDeposit :: ProtocolParamUpdate -> BigNum -> Nullable Unit +foreign import protocolParamUpdate_setPoolDeposit :: ProtocolParamUpdate -> BigNum -> Effect Unit foreign import protocolParamUpdate_poolDeposit :: ProtocolParamUpdate -> Nullable BigNum -foreign import protocolParamUpdate_setMaxEpoch :: ProtocolParamUpdate -> Number -> Nullable Unit +foreign import protocolParamUpdate_setMaxEpoch :: ProtocolParamUpdate -> Number -> Effect Unit foreign import protocolParamUpdate_maxEpoch :: ProtocolParamUpdate -> Nullable Number -foreign import protocolParamUpdate_setNOpt :: ProtocolParamUpdate -> Number -> Nullable Unit +foreign import protocolParamUpdate_setNOpt :: ProtocolParamUpdate -> Number -> Effect Unit foreign import protocolParamUpdate_nOpt :: ProtocolParamUpdate -> Nullable Number -foreign import protocolParamUpdate_setPoolPledgeInfluence :: ProtocolParamUpdate -> UnitInterval -> Nullable Unit +foreign import protocolParamUpdate_setPoolPledgeInfluence :: ProtocolParamUpdate -> UnitInterval -> Effect Unit foreign import protocolParamUpdate_poolPledgeInfluence :: ProtocolParamUpdate -> Nullable UnitInterval -foreign import protocolParamUpdate_setExpansionRate :: ProtocolParamUpdate -> UnitInterval -> Nullable Unit +foreign import protocolParamUpdate_setExpansionRate :: ProtocolParamUpdate -> UnitInterval -> Effect Unit foreign import protocolParamUpdate_expansionRate :: ProtocolParamUpdate -> Nullable UnitInterval -foreign import protocolParamUpdate_setTreasuryGrowthRate :: ProtocolParamUpdate -> UnitInterval -> Nullable Unit +foreign import protocolParamUpdate_setTreasuryGrowthRate :: ProtocolParamUpdate -> UnitInterval -> Effect Unit foreign import protocolParamUpdate_treasuryGrowthRate :: ProtocolParamUpdate -> Nullable UnitInterval foreign import protocolParamUpdate_d :: ProtocolParamUpdate -> Nullable UnitInterval foreign import protocolParamUpdate_extraEntropy :: ProtocolParamUpdate -> Nullable Nonce -foreign import protocolParamUpdate_setProtocolVersion :: ProtocolParamUpdate -> ProtocolVersion -> Nullable Unit +foreign import protocolParamUpdate_setProtocolVersion :: ProtocolParamUpdate -> ProtocolVersion -> Effect Unit foreign import protocolParamUpdate_protocolVersion :: ProtocolParamUpdate -> Nullable ProtocolVersion -foreign import protocolParamUpdate_setMinPoolCost :: ProtocolParamUpdate -> BigNum -> Nullable Unit +foreign import protocolParamUpdate_setMinPoolCost :: ProtocolParamUpdate -> BigNum -> Effect Unit foreign import protocolParamUpdate_minPoolCost :: ProtocolParamUpdate -> Nullable BigNum -foreign import protocolParamUpdate_setAdaPerUtxoByte :: ProtocolParamUpdate -> BigNum -> Nullable Unit +foreign import protocolParamUpdate_setAdaPerUtxoByte :: ProtocolParamUpdate -> BigNum -> Effect Unit foreign import protocolParamUpdate_adaPerUtxoByte :: ProtocolParamUpdate -> Nullable BigNum -foreign import protocolParamUpdate_setCostModels :: ProtocolParamUpdate -> Costmdls -> Nullable Unit +foreign import protocolParamUpdate_setCostModels :: ProtocolParamUpdate -> Costmdls -> Effect Unit foreign import protocolParamUpdate_costModels :: ProtocolParamUpdate -> Nullable Costmdls -foreign import protocolParamUpdate_setExecutionCosts :: ProtocolParamUpdate -> ExUnitPrices -> Nullable Unit +foreign import protocolParamUpdate_setExecutionCosts :: ProtocolParamUpdate -> ExUnitPrices -> Effect Unit foreign import protocolParamUpdate_executionCosts :: ProtocolParamUpdate -> Nullable ExUnitPrices -foreign import protocolParamUpdate_setMaxTxExUnits :: ProtocolParamUpdate -> ExUnits -> Nullable Unit +foreign import protocolParamUpdate_setMaxTxExUnits :: ProtocolParamUpdate -> ExUnits -> Effect Unit foreign import protocolParamUpdate_maxTxExUnits :: ProtocolParamUpdate -> Nullable ExUnits -foreign import protocolParamUpdate_setMaxBlockExUnits :: ProtocolParamUpdate -> ExUnits -> Nullable Unit +foreign import protocolParamUpdate_setMaxBlockExUnits :: ProtocolParamUpdate -> ExUnits -> Effect Unit foreign import protocolParamUpdate_maxBlockExUnits :: ProtocolParamUpdate -> Nullable ExUnits -foreign import protocolParamUpdate_setMaxValueSize :: ProtocolParamUpdate -> Number -> Nullable Unit +foreign import protocolParamUpdate_setMaxValueSize :: ProtocolParamUpdate -> Number -> Effect Unit foreign import protocolParamUpdate_maxValueSize :: ProtocolParamUpdate -> Nullable Number -foreign import protocolParamUpdate_setCollateralPercentage :: ProtocolParamUpdate -> Number -> Nullable Unit +foreign import protocolParamUpdate_setCollateralPercentage :: ProtocolParamUpdate -> Number -> Effect Unit foreign import protocolParamUpdate_collateralPercentage :: ProtocolParamUpdate -> Nullable Number -foreign import protocolParamUpdate_setMaxCollateralInputs :: ProtocolParamUpdate -> Number -> Nullable Unit +foreign import protocolParamUpdate_setMaxCollateralInputs :: ProtocolParamUpdate -> Number -> Effect Unit foreign import protocolParamUpdate_maxCollateralInputs :: ProtocolParamUpdate -> Nullable Number foreign import protocolParamUpdate_new :: ProtocolParamUpdate @@ -2725,7 +2685,7 @@ foreign import transaction_body :: Transaction -> TransactionBody foreign import transaction_witnessSet :: Transaction -> TransactionWitnessSet foreign import transaction_isValid :: Transaction -> Boolean foreign import transaction_auxiliaryData :: Transaction -> Nullable AuxiliaryData -foreign import transaction_setIsValid :: Transaction -> Boolean -> Nullable Unit +foreign import transaction_setIsValid :: Transaction -> Boolean -> Effect Unit foreign import transaction_new :: TransactionBody -> TransactionWitnessSet -> AuxiliaryData -> Transaction instance IsCsl Transaction where @@ -2766,36 +2726,36 @@ foreign import transactionBody_outputs :: TransactionBody -> TransactionOutputs foreign import transactionBody_fee :: TransactionBody -> BigNum foreign import transactionBody_ttl :: TransactionBody -> Nullable Number foreign import transactionBody_ttlBignum :: TransactionBody -> Nullable BigNum -foreign import transactionBody_setTtl :: TransactionBody -> BigNum -> Nullable Unit +foreign import transactionBody_setTtl :: TransactionBody -> BigNum -> Effect Unit foreign import transactionBody_removeTtl :: TransactionBody -> Nullable Unit -foreign import transactionBody_setCerts :: TransactionBody -> Certificates -> Nullable Unit +foreign import transactionBody_setCerts :: TransactionBody -> Certificates -> Effect Unit foreign import transactionBody_certs :: TransactionBody -> Nullable Certificates -foreign import transactionBody_setWithdrawals :: TransactionBody -> Withdrawals -> Nullable Unit +foreign import transactionBody_setWithdrawals :: TransactionBody -> Withdrawals -> Effect Unit foreign import transactionBody_withdrawals :: TransactionBody -> Nullable Withdrawals -foreign import transactionBody_setUpdate :: TransactionBody -> Update -> Nullable Unit +foreign import transactionBody_setUpdate :: TransactionBody -> Update -> Effect Unit foreign import transactionBody_update :: TransactionBody -> Nullable Update -foreign import transactionBody_setAuxiliaryDataHash :: TransactionBody -> AuxiliaryDataHash -> Nullable Unit +foreign import transactionBody_setAuxiliaryDataHash :: TransactionBody -> AuxiliaryDataHash -> Effect Unit foreign import transactionBody_auxiliaryDataHash :: TransactionBody -> Nullable AuxiliaryDataHash -foreign import transactionBody_setValidityStartInterval :: TransactionBody -> Number -> Nullable Unit -foreign import transactionBody_setValidityStartIntervalBignum :: TransactionBody -> BigNum -> Nullable Unit +foreign import transactionBody_setValidityStartInterval :: TransactionBody -> Number -> Effect Unit +foreign import transactionBody_setValidityStartIntervalBignum :: TransactionBody -> BigNum -> Effect Unit foreign import transactionBody_validityStartIntervalBignum :: TransactionBody -> Nullable BigNum foreign import transactionBody_validityStartInterval :: TransactionBody -> Nullable Number -foreign import transactionBody_setMint :: TransactionBody -> Mint -> Nullable Unit +foreign import transactionBody_setMint :: TransactionBody -> Mint -> Effect Unit foreign import transactionBody_mint :: TransactionBody -> Nullable Mint foreign import transactionBody_multiassets :: TransactionBody -> Nullable Mint -foreign import transactionBody_setReferenceInputs :: TransactionBody -> TransactionInputs -> Nullable Unit +foreign import transactionBody_setReferenceInputs :: TransactionBody -> TransactionInputs -> Effect Unit foreign import transactionBody_referenceInputs :: TransactionBody -> Nullable TransactionInputs -foreign import transactionBody_setScriptDataHash :: TransactionBody -> ScriptDataHash -> Nullable Unit +foreign import transactionBody_setScriptDataHash :: TransactionBody -> ScriptDataHash -> Effect Unit foreign import transactionBody_scriptDataHash :: TransactionBody -> Nullable ScriptDataHash -foreign import transactionBody_setCollateral :: TransactionBody -> TransactionInputs -> Nullable Unit +foreign import transactionBody_setCollateral :: TransactionBody -> TransactionInputs -> Effect Unit foreign import transactionBody_collateral :: TransactionBody -> Nullable TransactionInputs -foreign import transactionBody_setRequiredSigners :: TransactionBody -> Ed25519KeyHashes -> Nullable Unit +foreign import transactionBody_setRequiredSigners :: TransactionBody -> Ed25519KeyHashes -> Effect Unit foreign import transactionBody_requiredSigners :: TransactionBody -> Nullable Ed25519KeyHashes -foreign import transactionBody_setNetworkId :: TransactionBody -> NetworkId -> Nullable Unit +foreign import transactionBody_setNetworkId :: TransactionBody -> NetworkId -> Effect Unit foreign import transactionBody_networkId :: TransactionBody -> Nullable NetworkId -foreign import transactionBody_setCollateralReturn :: TransactionBody -> TransactionOutput -> Nullable Unit +foreign import transactionBody_setCollateralReturn :: TransactionBody -> TransactionOutput -> Effect Unit foreign import transactionBody_collateralReturn :: TransactionBody -> Nullable TransactionOutput -foreign import transactionBody_setTotalCollateral :: TransactionBody -> BigNum -> Nullable Unit +foreign import transactionBody_setTotalCollateral :: TransactionBody -> BigNum -> Effect Unit foreign import transactionBody_totalCollateral :: TransactionBody -> Nullable BigNum foreign import transactionBody_new :: TransactionInputs -> TransactionOutputs -> BigNum -> Number -> TransactionBody foreign import transactionBody_newTxBody :: TransactionInputs -> TransactionOutputs -> BigNum -> TransactionBody @@ -3110,7 +3070,7 @@ foreign import value_newWithAssets :: BigNum -> MultiAsset -> Value foreign import value_zero :: Value foreign import value_isZero :: Value -> Boolean foreign import value_coin :: Value -> BigNum -foreign import value_setCoin :: Value -> BigNum -> Nullable Unit +foreign import value_setCoin :: Value -> BigNum -> Effect Unit foreign import value_multiasset :: Value -> Nullable MultiAsset foreign import value_setMultiasset :: Value -> MultiAsset -> Effect Unit foreign import value_checkedAdd :: Value -> Value -> Nullable Value From fcb9d143a6b9a67f1c6781c3d2aa514772661a6e Mon Sep 17 00:00:00 2001 From: Vladimir Kalnitsky Date: Thu, 25 Jan 2024 01:58:56 +0400 Subject: [PATCH 07/18] Add pureness annotations for TransactionMetadatum methods --- code-gen/parse-csl/src/Csl/Gen.hs | 3 ++- src/Cardano/Serialization/Lib.js | 10 +++++----- src/Cardano/Serialization/Lib.purs | 10 +++++----- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/code-gen/parse-csl/src/Csl/Gen.hs b/code-gen/parse-csl/src/Csl/Gen.hs index a7bb276..ce1b60b 100644 --- a/code-gen/parse-csl/src/Csl/Gen.hs +++ b/code-gen/parse-csl/src/Csl/Gen.hs @@ -267,7 +267,6 @@ classPurs cls@(Class name ms) = mappend "\n" $ where filteredMethods = filterMethods cls filteredClass = Class name filteredMethods - isNullType ty = elem '?' ty || isSuffixOf "| void" ty intro = unlines [ replicate 85 '-' @@ -578,6 +577,8 @@ throwingSet = mconcat $ [ "from_normal_bytes" ] , inClass "ByronAddress" [ "from_base58" ] + , inClass "TransactionMetadatum" + [ "as_map", "as_list", "as_int", "as_bytes", "as_text" ] ] where inClass name ms = Set.fromList $ fmap (name, ) ms diff --git a/src/Cardano/Serialization/Lib.js b/src/Cardano/Serialization/Lib.js index f595ebe..ec4f801 100644 --- a/src/Cardano/Serialization/Lib.js +++ b/src/Cardano/Serialization/Lib.js @@ -757,11 +757,11 @@ export const transactionMetadatum_newInt = int => CSL.TransactionMetadatum.new_i export const transactionMetadatum_newBytes = bytes => CSL.TransactionMetadatum.new_bytes(bytes); export const transactionMetadatum_newText = text => CSL.TransactionMetadatum.new_text(text); export const transactionMetadatum_kind = self => self.kind.bind(self)(); -export const transactionMetadatum_asMap = self => self.as_map.bind(self)(); -export const transactionMetadatum_asList = self => self.as_list.bind(self)(); -export const transactionMetadatum_asInt = self => self.as_int.bind(self)(); -export const transactionMetadatum_asBytes = self => self.as_bytes.bind(self)(); -export const transactionMetadatum_asText = self => self.as_text.bind(self)(); +export const transactionMetadatum_asMap = self => errorableToPurs(self.as_map.bind(self), ); +export const transactionMetadatum_asList = self => errorableToPurs(self.as_list.bind(self), ); +export const transactionMetadatum_asInt = self => errorableToPurs(self.as_int.bind(self), ); +export const transactionMetadatum_asBytes = self => errorableToPurs(self.as_bytes.bind(self), ); +export const transactionMetadatum_asText = self => errorableToPurs(self.as_text.bind(self), ); // TransactionMetadatumLabels export const transactionMetadatumLabels_new = () => CSL.TransactionMetadatumLabels.new(); diff --git a/src/Cardano/Serialization/Lib.purs b/src/Cardano/Serialization/Lib.purs index c801502..e118cdc 100644 --- a/src/Cardano/Serialization/Lib.purs +++ b/src/Cardano/Serialization/Lib.purs @@ -2829,11 +2829,11 @@ foreign import transactionMetadatum_newInt :: Int -> TransactionMetadatum foreign import transactionMetadatum_newBytes :: ByteArray -> TransactionMetadatum foreign import transactionMetadatum_newText :: String -> TransactionMetadatum foreign import transactionMetadatum_kind :: TransactionMetadatum -> Number -foreign import transactionMetadatum_asMap :: TransactionMetadatum -> MetadataMap -foreign import transactionMetadatum_asList :: TransactionMetadatum -> MetadataList -foreign import transactionMetadatum_asInt :: TransactionMetadatum -> Int -foreign import transactionMetadatum_asBytes :: TransactionMetadatum -> ByteArray -foreign import transactionMetadatum_asText :: TransactionMetadatum -> String +foreign import transactionMetadatum_asMap :: TransactionMetadatum -> Nullable MetadataMap +foreign import transactionMetadatum_asList :: TransactionMetadatum -> Nullable MetadataList +foreign import transactionMetadatum_asInt :: TransactionMetadatum -> Nullable Int +foreign import transactionMetadatum_asBytes :: TransactionMetadatum -> Nullable ByteArray +foreign import transactionMetadatum_asText :: TransactionMetadatum -> Nullable String instance IsCsl TransactionMetadatum where className _ = "TransactionMetadatum" From 9368a0f4140c6931163e432069eccef6d2eb8bcf Mon Sep 17 00:00:00 2001 From: Vladimir Kalnitsky Date: Wed, 31 Jan 2024 00:16:55 +0400 Subject: [PATCH 08/18] Clean up codegen code --- code-gen/parse-csl/app/Main.hs | 3 - code-gen/parse-csl/src/Csl.hs | 11 +- code-gen/parse-csl/src/Csl/Gen.hs | 192 +++++++++--------------------- 3 files changed, 67 insertions(+), 139 deletions(-) diff --git a/code-gen/parse-csl/app/Main.hs b/code-gen/parse-csl/app/Main.hs index 0a19686..14d5636 100644 --- a/code-gen/parse-csl/app/Main.hs +++ b/code-gen/parse-csl/app/Main.hs @@ -1,12 +1,9 @@ module Main (main) where import Csl -import Data.Functor ((<&>)) -import Data.Maybe (mapMaybe) import System.Directory (createDirectoryIfMissing) import System.Environment (getArgs) import System.FilePath (takeDirectory) -import System.IO (IOMode (..), withFile) main :: IO () main = do diff --git a/code-gen/parse-csl/src/Csl.hs b/code-gen/parse-csl/src/Csl.hs index 67e8130..0edf3cc 100644 --- a/code-gen/parse-csl/src/Csl.hs +++ b/code-gen/parse-csl/src/Csl.hs @@ -10,16 +10,20 @@ import Csl.Types as X ------------------------------------------------------------------------------------- -- read parts +getFuns :: IO [Fun] getFuns = filter (flip elem neededFunctions . fun'name) . funs <$> readFile file + +getClasses :: IO [Class] getClasses = filter (not . flip elem unneededClasses . class'name) . fmap parseClass . toClassParts <$> readFile file +unneededClasses :: [String] unneededClasses = - [ -- builder classes, not used by us + [ -- builder classes, not used by `ps-cardano-types` "TransactionBuilder" , "TransactionBuilderConfigBuilder" , "TransactionBuilderConfig" @@ -28,18 +32,21 @@ unneededClasses = , "TxBuilderConstants" , "TxInputsBuilder" , "MintBuilder" - -- block data, not needed for us + -- block data, not needed for `ps-cardano-types` , "Block" , "Header" , "HeaderBody" , "TransactionBodies" , "AuxiliaryDataSet" , "TransactionWitnessSets" + -- Types that are not parts of a Transaction and are not needed , "Strings" , "PublicKeys" , "FixedTransaction" ] + +neededFunctions :: [String] neededFunctions = [ "hash_transaction" , "hash_plutus_data" diff --git a/code-gen/parse-csl/src/Csl/Gen.hs b/code-gen/parse-csl/src/Csl/Gen.hs index ce1b60b..48b7e6b 100644 --- a/code-gen/parse-csl/src/Csl/Gen.hs +++ b/code-gen/parse-csl/src/Csl/Gen.hs @@ -1,40 +1,28 @@ -module Csl.Gen where +module Csl.Gen + ( exportListPurs + , classJs + , classPurs + , funPurs + , isCommon + , funJs + ) where import Control.Monad (guard) -import Data.Char (isAlphaNum, isUpper, toLower) +import Data.Char (isUpper, toLower) import Data.Map (Map) import Data.Map qualified as Map import Data.Set (Set) import Data.Set qualified as Set import Data.Functor ((<&>)) -import Data.List as L +import Data.List qualified as L (intercalate, sort, nub, null, foldl', isPrefixOf, isSuffixOf) import Data.List.Split (splitOn) -import Data.Maybe (mapMaybe, Maybe(Just, Nothing), listToMaybe, catMaybes) +import Data.Maybe (mapMaybe, listToMaybe, catMaybes) import Data.Text qualified as T (pack, unpack, replace) -import Data.Text.Manipulate qualified as T (toCamel, upperHead, lowerHead, toTitle, toTrain) +import Data.Text (Text) +import Data.Text.Manipulate qualified as T (toCamel, upperHead, lowerHead, toTitle) import Data.List.Extra (trim) - -import Csl.Parse import Csl.Types -standardTypes :: Set String -standardTypes = Set.fromList - [ "String" - , "Boolean" - , "Effect" - , "Number" - , "Unit" - , "ByteArray" - , "Uint32Array" - , "This" - ] - -extraExport :: [String] -extraExport = - [ "ForeignErrorable" - , "module X" - ] - exportListPurs :: [Fun] -> [Class] -> String exportListPurs funs cls = L.intercalate "\n , " $ @@ -44,19 +32,33 @@ exportListPurs funs cls = (fromType =<< classTypes cls) where fromType ty = [ty] - classMethods :: Class -> [String] - classMethods cls@(Class name ms) = - map (mappend (toTypePrefix name <> "_") . toName . fun'name . method'fun) - $ filterMethods cls - hasNoClass = flip Set.member hasNoClassSet - hasNoClassSet = Set.fromList ["This", "Uint32Array"] + + extraExport :: [String] + extraExport = + [ "ForeignErrorable" + , "module X" + ] + +classMethods :: Class -> [String] +classMethods cls@(Class name _ms) = + map (mappend (toTypePrefix name <> "_") . toName . fun'name . method'fun) + $ filterMethods cls -- Remove standard types and transform case postProcTypes :: [String] -> [String] postProcTypes = filter (not . flip Set.member standardTypes) . fmap toType . L.sort . L.nub - -funsTypes :: [Fun] -> [String] -funsTypes fs = (\Fun{..} -> filter (all isAlphaNum) $ fun'res : (arg'type <$> fun'args)) =<< fs + where + standardTypes :: Set String + standardTypes = Set.fromList + [ "String" + , "Boolean" + , "Effect" + , "Number" + , "Unit" + , "ByteArray" + , "Uint32Array" + , "This" + ] classTypes :: [Class] -> [String] classTypes xs = postProcTypes $ fromClass =<< xs @@ -75,7 +77,7 @@ typeDefPurs ty | otherwise = unwords [ "foreign import data", ty, ":: Type" ] isJsonType :: String -> Bool -isJsonType ty = isSuffixOf "Json" ty +isJsonType ty = L.isSuffixOf "Json" ty funPurs :: Fun -> String funPurs fun@(Fun name args res) = @@ -93,19 +95,18 @@ funPurs fun@(Fun name args res) = where funName = toName name argTypeNames = toType . arg'type <$> args + preFunComment = funCommentBy preComment -preFunComment = funCommentBy preComment - -funCommentBy title f = - L.intercalate "\n" - [ title (funTitleComment f) - , codeComment (funCodeComment f) - ] + funCommentBy title f = + L.intercalate "\n" + [ title (funTitleComment f) + , codeComment (funCodeComment f) + ] -funTitleComment Fun{..} = toTitle fun'name -funCodeComment Fun{..} = unwords [toName fun'name, unwords argNames] - where - argNames = toName . arg'name <$> fun'args + funTitleComment Fun{..} = toTitle fun'name + funCodeComment Fun{..} = unwords [toName fun'name, unwords argNames] + where + argNames = toName . arg'name <$> fun'args codeComment :: String -> String codeComment str = "-- > " <> str @@ -113,10 +114,6 @@ codeComment str = "-- > " <> str preComment :: String -> String preComment str = "-- | " <> str -postComment :: String -> String -postComment str = "-- ^ " <> str - - data FunSpec = FunSpec { funSpec'parent :: String , funSpec'skipFirst :: Bool @@ -150,7 +147,7 @@ funJs :: Fun -> String funJs f = funJsBy (FunSpec "CSL" False "" (getPureness "" f)) f funJsBy :: FunSpec -> Fun -> String -funJsBy (FunSpec parent isSkipFirst prefix pureness) (Fun name args res) = +funJsBy (FunSpec parent isSkipFirst prefix pureness) (Fun name args _res) = unwords [ "export const" , prefix <> toName name @@ -216,7 +213,7 @@ commonInstances (Class name methods) = unlines $ else [] ) where - hasBytes = hasInstanceMethod "to_bytes" && hasInstanceMethod "from_bytes" + hasBytes = hasInstanceMethod "to_bytes" && hasInstanceMethod "from_bytes" hasJson = hasInstanceMethod "to_json" && hasInstanceMethod "from_json" hasInstanceMethod str = Set.member str methodNameSet methodNameSet = Set.fromList $ fun'name . method'fun <$> methods @@ -257,7 +254,7 @@ isCommon (Fun "keys" _ _) = True isCommon (Fun _ _ _) = False classPurs :: Class -> String -classPurs cls@(Class name ms) = mappend "\n" $ +classPurs cls@(Class name _ms) = mappend "\n" $ L.intercalate "\n\n" $ fmap trim [ intro , typePurs name @@ -266,39 +263,18 @@ classPurs cls@(Class name ms) = mappend "\n" $ ] where filteredMethods = filterMethods cls - filteredClass = Class name filteredMethods intro = unlines [ replicate 85 '-' , "-- " <> toTitle name ] - recordDef = \case - [] -> "{}" - a:as -> unlines [indent $ "{ " <> a, unlines (fmap (indent . (", " <>)) as) <> indent "}" ] - methodDefs = unlines $ fmap toDef $ filteredMethods where toDef m = unwords ["foreign import", jsMethodName m, "::", psSig UseNullable m] jsMethodName Method{..} = methodName name (fun'name method'fun) - jsThrowMethodName m@Method{..} = toLam (toArgName <$> args) res - where - toArgName (n, _) = 'a' : show n - args = zip [1..] $ addOnObj $ fun'args method'fun - - addOnObj - | isObj m = (Arg (toName name) (toType name) :) - | otherwise = id - - res = fromThrowRes (fun'res method'fun) $ unwords $ jsMethodName m : fmap toArgName args - isPureMethod = isPure name method'fun - - fromThrowRes resTy - | isPureMethod = mappend "runForeignMaybe $ " - | otherwise = mappend "runForeignMaybe <$> " - psSig nullType m@Method{..} = trim $ unwords [ if L.null argTys then "" else (L.intercalate " -> " argTys <> " ->"), resTy] where addTypePrefix pref x @@ -319,7 +295,7 @@ classPurs cls@(Class name ms) = mappend "\n" $ UseMaybe -> "Maybe" handleVoid pureFun str - | isSuffixOf "| void" str = (if pureFun then id else \a -> "(" <> a <> ")") $ fromNullType nullType <> " " <> (toType $ head $ splitOn "|" str) + | L.isSuffixOf "| void" str = (if pureFun then id else \a -> "(" <> a <> ")") $ fromNullType nullType <> " " <> (toType $ head $ splitOn "|" str) | otherwise = toType str handleNumArgs = @@ -336,52 +312,11 @@ classPurs cls@(Class name ms) = mappend "\n" $ ObjectMethod -> True _ -> False - valName = toTypePrefix name - instances = unlines $ catMaybes $ [ Just $ commonInstances cls , containerInstances cls ] - proxyMethod str = unwords [str, "=", valName <> "." <> str] - - hasInstanceMethod str = Set.member str methodNameSet - - mutListInst :: Maybe String - mutListInst = fmap go $ Map.lookup name listTypeMap - where - go key = - unlines - [ toInst2 "MutableList" (toType key) - [ instMethod "addItem" "add" - , instMethod "getItem" "get" - , instMethod "emptyList" "new" - ] - , toInst "MutableLen" [ instMethod "getLen" "len" ] - ] - - instMethod :: String -> String -> String - instMethod name1 name2 = unwords [toName name1, "=", valName <> "_" <> toName name2] - - toJsValueInst - | hasInstanceMethod "to_js_value" = Just $ toInst "ToJsValue" [proxyMethod $ toName "to_js_value"] - | otherwise = Nothing - - getArgNum name = fmap (length . fun'args) $ L.find ((== name) . fun'name) $ method'fun <$> ms - - - methodNameSet = Set.fromList $ fun'name . method'fun <$> ms - - toInst cls funs = unlines $ - (unwords ["instance", cls, toType name, "where"]) : fmap indent funs - - toInst2 cls name2 funs = unlines $ - (unwords ["instance", cls, toType name, toType name2, "where"]) : fmap indent funs - - -toLam :: [String] -> String -> String -toLam args res = "\\" <> unwords args <> " -> " <> res - -- | We assume that subst and args are sorted substIntArgs :: [SigPos] -> [(Int, String)] -> [String] substIntArgs ps args = @@ -404,18 +339,13 @@ substIntRes = \case substInt :: String -> String substInt = replace "Number" "Int" . replace "number" "int" -mapLines f = unlines . map f . lines - -indent :: String -> String -indent str = " " <> str - filterMethods :: Class -> [Method] filterMethods (Class name ms) | name `elem` ["PublicKey", "PrivateKey"] = ms -- these types need special handling | otherwise = filter (not . isCommon . method'fun) ms classJs :: Class -> String -classJs cls@(Class name ms) = +classJs cls@(Class name _ms) = unlines $ pre : (methodJs name <$> filterMethods cls) where pre = "// " <> name @@ -430,11 +360,7 @@ methodJs className m = toFun m funJsBy (FunSpec "self" True pre (getPureness className f)) (f { fun'args = Arg "self" className : fun'args f }) pre = toTypePrefix className <> "_" -withSelf :: String -> Method -> Fun -withSelf className Method{..} = case method'type of - StaticMethod -> method'fun - ObjectMethod -> method'fun { fun'args = Arg "self" className : fun'args method'fun } - +methodName :: String -> String -> String methodName className name = toTypePrefix className <> "_" <> toName name toTypePrefix :: String -> String @@ -469,8 +395,10 @@ replacesBy repl = L.foldl' (\res a -> res . uncurry repl a) id replace :: String -> String -> String -> String replace from to = T.unpack . T.replace (T.pack from) (T.pack to) . T.pack +wrapText :: (Text -> Text) -> (String -> String) wrapText f = T.unpack . f . T.pack +toTitle :: String -> String toTitle = unwords . go . words . wrapText T.toTitle where go = \case @@ -514,12 +442,14 @@ isPure :: String -> Fun -> Bool isPure className fun = getPureness className fun == Pure +convertorSet :: Set String convertorSet = Set.fromList $ (\x -> fmap (<> x ) ["to_"]) =<< ["hex", "string", "bytes", "bech32", "json", "js_value"] mutatingMethods :: (String, String) -> Bool mutatingMethods a = Set.member a mutating +dirtyClass :: String -> Bool dirtyClass a = Set.member a mutatingClassSet mutatingClassSet :: Set String @@ -530,9 +460,6 @@ mutatingClassSet = Set.fromList , "TxInputsBuilder" ] -listTypeMap :: Map String String -listTypeMap = Map.fromList listTypes - listTypes :: [(String, String)] listTypes = [ ("AssetNames", "AssetName") @@ -614,9 +541,6 @@ mutating = -- | Position of the type in the signature data SigPos = ResPos | ArgPos Int -instance Num SigPos where - fromInteger = ArgPos . fromInteger - -- | Which numbers should be treated as Int's. -- Position is in the Purs signature (with extended object methods) intPos :: Map (String, String) [SigPos] @@ -625,7 +549,7 @@ intPos = mempty -- | Is function pure and can throw (in this case we can catch it to Maybe on purs side) -- if it's global function use empty name for class isCommonThrowingMethod :: String -> Bool -isCommonThrowingMethod methodName = Set.member methodName froms +isCommonThrowingMethod method = Set.member method froms where froms = Set.fromList [ "from_hex" From ff43326e48654f3f8653d0915636dcc8ab460fa7 Mon Sep 17 00:00:00 2001 From: Vladimir Kalnitsky Date: Wed, 14 Feb 2024 17:25:46 +0400 Subject: [PATCH 09/18] Update codegen to handle CostModel special case --- code-gen/parse-csl/src/Csl/Gen.hs | 9 ++++++++- src/Cardano/Serialization/Lib.js | 9 +++++++++ src/Cardano/Serialization/Lib.purs | 18 ++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/code-gen/parse-csl/src/Csl/Gen.hs b/code-gen/parse-csl/src/Csl/Gen.hs index 48b7e6b..5a0a97a 100644 --- a/code-gen/parse-csl/src/Csl/Gen.hs +++ b/code-gen/parse-csl/src/Csl/Gen.hs @@ -341,8 +341,15 @@ substInt = replace "Number" "Int" . replace "number" "int" filterMethods :: Class -> [Method] filterMethods (Class name ms) - | name `elem` ["PublicKey", "PrivateKey"] = ms -- these types need special handling + -- CostModel is a special case: it looks like a mapping type, but isn't + | name `elem` ["PublicKey", "PrivateKey", "CostModel"] = + filter (not . isIgnored . method'fun) ms -- these types need special handling | otherwise = filter (not . isCommon . method'fun) ms + where + -- we still need to remove `to_js_value`, because its return type is unknown + isIgnored :: Fun -> Bool + isIgnored (Fun "to_js_value" _ _) = True + isIgnored _ = False classJs :: Class -> String classJs cls@(Class name _ms) = diff --git a/src/Cardano/Serialization/Lib.js b/src/Cardano/Serialization/Lib.js index ec4f801..7d60229 100644 --- a/src/Cardano/Serialization/Lib.js +++ b/src/Cardano/Serialization/Lib.js @@ -148,8 +148,17 @@ export const constrPlutusData_data = self => self.data.bind(self)(); export const constrPlutusData_new = alternative => data => CSL.ConstrPlutusData.new(alternative, data); // CostModel +export const costModel_free = self => errorableToPurs(self.free.bind(self), ); +export const costModel_toBytes = self => self.to_bytes.bind(self)(); +export const costModel_fromBytes = bytes => errorableToPurs(CSL.CostModel.from_bytes, bytes); +export const costModel_toHex = self => self.to_hex.bind(self)(); +export const costModel_fromHex = hex_str => errorableToPurs(CSL.CostModel.from_hex, hex_str); +export const costModel_toJson = self => self.to_json.bind(self)(); +export const costModel_fromJson = json => errorableToPurs(CSL.CostModel.from_json, json); export const costModel_new = () => CSL.CostModel.new(); export const costModel_set = self => operation => cost => () => self.set.bind(self)(operation, cost); +export const costModel_get = self => operation => () => self.get.bind(self)(operation); +export const costModel_len = self => () => self.len.bind(self)(); // Costmdls export const costmdls_new = () => CSL.Costmdls.new(); diff --git a/src/Cardano/Serialization/Lib.purs b/src/Cardano/Serialization/Lib.purs index e118cdc..1329365 100644 --- a/src/Cardano/Serialization/Lib.purs +++ b/src/Cardano/Serialization/Lib.purs @@ -100,8 +100,17 @@ module Cardano.Serialization.Lib , constrPlutusData_alternative , constrPlutusData_data , constrPlutusData_new + , costModel_free + , costModel_toBytes + , costModel_fromBytes + , costModel_toHex + , costModel_fromHex + , costModel_toJson + , costModel_fromJson , costModel_new , costModel_set + , costModel_get + , costModel_len , costmdls_new , costmdls_retainLanguageVersions , dnsRecordAorAAAA_new @@ -1128,8 +1137,17 @@ instance Show ConstrPlutusData where show = showViaBytes foreign import data CostModel :: Type +foreign import costModel_free :: CostModel -> Nullable Unit +foreign import costModel_toBytes :: CostModel -> ByteArray +foreign import costModel_fromBytes :: ByteArray -> Nullable CostModel +foreign import costModel_toHex :: CostModel -> String +foreign import costModel_fromHex :: String -> Nullable CostModel +foreign import costModel_toJson :: CostModel -> String +foreign import costModel_fromJson :: String -> Nullable CostModel foreign import costModel_new :: Effect CostModel foreign import costModel_set :: CostModel -> Number -> Int -> Effect Int +foreign import costModel_get :: CostModel -> Number -> Effect Int +foreign import costModel_len :: CostModel -> Effect Number instance IsCsl CostModel where className _ = "CostModel" From bdf3133ca08290c9c7e6c9e65c46096354c74898 Mon Sep 17 00:00:00 2001 From: Vladimir Kalnitsky Date: Wed, 14 Feb 2024 23:36:52 +0400 Subject: [PATCH 10/18] Remove dirtyClass --- code-gen/parse-csl/src/Csl/Gen.hs | 15 +++------------ src/Cardano/Serialization/Lib.js | 12 ++++++------ src/Cardano/Serialization/Lib.purs | 12 ++++++------ 3 files changed, 15 insertions(+), 24 deletions(-) diff --git a/code-gen/parse-csl/src/Csl/Gen.hs b/code-gen/parse-csl/src/Csl/Gen.hs index 5a0a97a..290eccf 100644 --- a/code-gen/parse-csl/src/Csl/Gen.hs +++ b/code-gen/parse-csl/src/Csl/Gen.hs @@ -5,6 +5,7 @@ module Csl.Gen , funPurs , isCommon , funJs + , getPureness ) where import Control.Monad (guard) @@ -441,7 +442,7 @@ getPureness className Fun{..} | not isMutating && not isThrowing = Pure | otherwise = Throwing where - isMutating = dirtyClass className || mutatingMethods (className, fun'name) + isMutating = mutatingMethods (className, fun'name) isThrowing = Set.member (className, fun'name) throwingSet || isCommonThrowingMethod fun'name isConvertor a = Set.member a convertorSet @@ -456,17 +457,6 @@ convertorSet = Set.fromList $ (\x -> fmap (<> x ) ["to_"]) =<< mutatingMethods :: (String, String) -> Bool mutatingMethods a = Set.member a mutating -dirtyClass :: String -> Bool -dirtyClass a = Set.member a mutatingClassSet - -mutatingClassSet :: Set String -mutatingClassSet = Set.fromList - [ "TransactionBuilder" - , "TransactionWitnessSet" - , "TransactionWitnessSets" - , "TxInputsBuilder" - ] - listTypes :: [(String, String)] listTypes = [ ("AssetNames", "AssetName") @@ -522,6 +512,7 @@ mutating = mconcat $ [ keys "Assets" , inClass "TransactionBuilder" ["new"] + , inClass "TransactionWitnessSet" ["new"] , inClass "AuxiliaryData" [ "new", "set_native_scripts", "set_plutus_scripts", "set_metadata", "set_prefer_alonzo_format" ] , inClass "AuxiliaryDataSet" ["new", "insert", "get", "indices"] diff --git a/src/Cardano/Serialization/Lib.js b/src/Cardano/Serialization/Lib.js index 7d60229..cbafc84 100644 --- a/src/Cardano/Serialization/Lib.js +++ b/src/Cardano/Serialization/Lib.js @@ -803,17 +803,17 @@ export const transactionUnspentOutputs_new = () => CSL.TransactionUnspentOutputs // TransactionWitnessSet export const transactionWitnessSet_setVkeys = self => vkeys => () => self.set_vkeys.bind(self)(vkeys); -export const transactionWitnessSet_vkeys = self => () => self.vkeys.bind(self)(); +export const transactionWitnessSet_vkeys = self => self.vkeys.bind(self)(); export const transactionWitnessSet_setNativeScripts = self => native_scripts => () => self.set_native_scripts.bind(self)(native_scripts); -export const transactionWitnessSet_nativeScripts = self => () => self.native_scripts.bind(self)(); +export const transactionWitnessSet_nativeScripts = self => self.native_scripts.bind(self)(); export const transactionWitnessSet_setBootstraps = self => bootstraps => () => self.set_bootstraps.bind(self)(bootstraps); -export const transactionWitnessSet_bootstraps = self => () => self.bootstraps.bind(self)(); +export const transactionWitnessSet_bootstraps = self => self.bootstraps.bind(self)(); export const transactionWitnessSet_setPlutusScripts = self => plutus_scripts => () => self.set_plutus_scripts.bind(self)(plutus_scripts); -export const transactionWitnessSet_plutusScripts = self => () => self.plutus_scripts.bind(self)(); +export const transactionWitnessSet_plutusScripts = self => self.plutus_scripts.bind(self)(); export const transactionWitnessSet_setPlutusData = self => plutus_data => () => self.set_plutus_data.bind(self)(plutus_data); -export const transactionWitnessSet_plutusData = self => () => self.plutus_data.bind(self)(); +export const transactionWitnessSet_plutusData = self => self.plutus_data.bind(self)(); export const transactionWitnessSet_setRedeemers = self => redeemers => () => self.set_redeemers.bind(self)(redeemers); -export const transactionWitnessSet_redeemers = self => () => self.redeemers.bind(self)(); +export const transactionWitnessSet_redeemers = self => self.redeemers.bind(self)(); export const transactionWitnessSet_new = () => CSL.TransactionWitnessSet.new(); // URL diff --git a/src/Cardano/Serialization/Lib.purs b/src/Cardano/Serialization/Lib.purs index 1329365..db047a3 100644 --- a/src/Cardano/Serialization/Lib.purs +++ b/src/Cardano/Serialization/Lib.purs @@ -2959,17 +2959,17 @@ instance IsListContainer TransactionUnspentOutputs TransactionUnspentOutput foreign import data TransactionWitnessSet :: Type foreign import transactionWitnessSet_setVkeys :: TransactionWitnessSet -> Vkeywitnesses -> Effect Unit -foreign import transactionWitnessSet_vkeys :: TransactionWitnessSet -> Effect ((Nullable Vkeywitnesses)) +foreign import transactionWitnessSet_vkeys :: TransactionWitnessSet -> Nullable Vkeywitnesses foreign import transactionWitnessSet_setNativeScripts :: TransactionWitnessSet -> NativeScripts -> Effect Unit -foreign import transactionWitnessSet_nativeScripts :: TransactionWitnessSet -> Effect ((Nullable NativeScripts)) +foreign import transactionWitnessSet_nativeScripts :: TransactionWitnessSet -> Nullable NativeScripts foreign import transactionWitnessSet_setBootstraps :: TransactionWitnessSet -> BootstrapWitnesses -> Effect Unit -foreign import transactionWitnessSet_bootstraps :: TransactionWitnessSet -> Effect ((Nullable BootstrapWitnesses)) +foreign import transactionWitnessSet_bootstraps :: TransactionWitnessSet -> Nullable BootstrapWitnesses foreign import transactionWitnessSet_setPlutusScripts :: TransactionWitnessSet -> PlutusScripts -> Effect Unit -foreign import transactionWitnessSet_plutusScripts :: TransactionWitnessSet -> Effect ((Nullable PlutusScripts)) +foreign import transactionWitnessSet_plutusScripts :: TransactionWitnessSet -> Nullable PlutusScripts foreign import transactionWitnessSet_setPlutusData :: TransactionWitnessSet -> PlutusList -> Effect Unit -foreign import transactionWitnessSet_plutusData :: TransactionWitnessSet -> Effect ((Nullable PlutusList)) +foreign import transactionWitnessSet_plutusData :: TransactionWitnessSet -> Nullable PlutusList foreign import transactionWitnessSet_setRedeemers :: TransactionWitnessSet -> Redeemers -> Effect Unit -foreign import transactionWitnessSet_redeemers :: TransactionWitnessSet -> Effect ((Nullable Redeemers)) +foreign import transactionWitnessSet_redeemers :: TransactionWitnessSet -> Nullable Redeemers foreign import transactionWitnessSet_new :: Effect TransactionWitnessSet instance IsCsl TransactionWitnessSet where From fcc1af0e69619e9911d284fc79ca26a50b686ff9 Mon Sep 17 00:00:00 2001 From: Vladimir Kalnitsky Date: Thu, 15 Feb 2024 03:24:10 +0400 Subject: [PATCH 11/18] Add hash_auxiliary_data --- code-gen/parse-csl/src/Csl.hs | 3 ++- src/Cardano/Serialization/Lib.js | 1 + src/Cardano/Serialization/Lib.purs | 5 +++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/code-gen/parse-csl/src/Csl.hs b/code-gen/parse-csl/src/Csl.hs index 0edf3cc..53b8e8f 100644 --- a/code-gen/parse-csl/src/Csl.hs +++ b/code-gen/parse-csl/src/Csl.hs @@ -48,7 +48,8 @@ unneededClasses = neededFunctions :: [String] neededFunctions = - [ "hash_transaction" + [ "hash_auxiliary_data" + , "hash_transaction" , "hash_plutus_data" , "min_ada_for_output" ] diff --git a/src/Cardano/Serialization/Lib.js b/src/Cardano/Serialization/Lib.js index cbafc84..82f09a9 100644 --- a/src/Cardano/Serialization/Lib.js +++ b/src/Cardano/Serialization/Lib.js @@ -877,6 +877,7 @@ export const vkeywitnesses_new = () => CSL.Vkeywitnesses.new(); export const withdrawals_new = () => CSL.Withdrawals.new(); +export const hashAuxiliaryData = auxiliary_data => CSL.hash_auxiliary_data(auxiliary_data); export const hashTransaction = tx_body => CSL.hash_transaction(tx_body); export const hashPlutusData = plutus_data => CSL.hash_plutus_data(plutus_data); export const minAdaForOutput = output => data_cost => CSL.min_ada_for_output(output, data_cost); diff --git a/src/Cardano/Serialization/Lib.purs b/src/Cardano/Serialization/Lib.purs index db047a3..0ad42fd 100644 --- a/src/Cardano/Serialization/Lib.purs +++ b/src/Cardano/Serialization/Lib.purs @@ -595,6 +595,7 @@ module Cardano.Serialization.Lib , vkeywitness_signature , vkeywitnesses_new , withdrawals_new + , hashAuxiliaryData , hashTransaction , hashPlutusData , minAdaForOutput @@ -780,6 +781,10 @@ class IsStr a where -- functions +-- | Hash auxiliary data +-- > hashAuxiliaryData auxiliaryData +foreign import hashAuxiliaryData :: AuxiliaryData -> AuxiliaryDataHash + -- | Hash transaction -- > hashTransaction txBody foreign import hashTransaction :: TransactionBody -> TransactionHash From d457a1634641e9f615132ddb86723504be5e4d76 Mon Sep 17 00:00:00 2001 From: Vladimir Kalnitsky Date: Fri, 1 Mar 2024 18:51:59 +0400 Subject: [PATCH 12/18] Add hashScriptData --- code-gen/parse-csl/src/Csl.hs | 1 + src/Cardano/Serialization/Lib.js | 1 + src/Cardano/Serialization/Lib.purs | 5 +++++ 3 files changed, 7 insertions(+) diff --git a/code-gen/parse-csl/src/Csl.hs b/code-gen/parse-csl/src/Csl.hs index 53b8e8f..2bbe351 100644 --- a/code-gen/parse-csl/src/Csl.hs +++ b/code-gen/parse-csl/src/Csl.hs @@ -52,6 +52,7 @@ neededFunctions = , "hash_transaction" , "hash_plutus_data" , "min_ada_for_output" + , "hash_script_data" ] ------------------------------------------------------------------------------------- diff --git a/src/Cardano/Serialization/Lib.js b/src/Cardano/Serialization/Lib.js index 82f09a9..7853918 100644 --- a/src/Cardano/Serialization/Lib.js +++ b/src/Cardano/Serialization/Lib.js @@ -880,5 +880,6 @@ export const withdrawals_new = () => CSL.Withdrawals.new(); export const hashAuxiliaryData = auxiliary_data => CSL.hash_auxiliary_data(auxiliary_data); export const hashTransaction = tx_body => CSL.hash_transaction(tx_body); export const hashPlutusData = plutus_data => CSL.hash_plutus_data(plutus_data); +export const hashScriptData = redeemers => cost_models => datums => CSL.hash_script_data(redeemers, cost_models, datums); export const minAdaForOutput = output => data_cost => CSL.min_ada_for_output(output, data_cost); diff --git a/src/Cardano/Serialization/Lib.purs b/src/Cardano/Serialization/Lib.purs index 0ad42fd..5b408eb 100644 --- a/src/Cardano/Serialization/Lib.purs +++ b/src/Cardano/Serialization/Lib.purs @@ -598,6 +598,7 @@ module Cardano.Serialization.Lib , hashAuxiliaryData , hashTransaction , hashPlutusData + , hashScriptData , minAdaForOutput , Address , AssetName @@ -793,6 +794,10 @@ foreign import hashTransaction :: TransactionBody -> TransactionHash -- > hashPlutusData plutusData foreign import hashPlutusData :: PlutusData -> DataHash +-- | Hash script data +-- > hashScriptData redeemers costModels datums +foreign import hashScriptData :: Redeemers -> Costmdls -> PlutusList -> ScriptDataHash + -- | Min ada for output -- > minAdaForOutput output dataCost foreign import minAdaForOutput :: TransactionOutput -> DataCost -> BigNum From 596a54711c3841a5851371056e1376a9f7bf70b4 Mon Sep 17 00:00:00 2001 From: Vladimir Kalnitsky Date: Fri, 1 Mar 2024 22:17:39 +0400 Subject: [PATCH 13/18] Add minFee and minScriptFee functions --- code-gen/parse-csl/src/Csl.hs | 2 ++ src/Cardano/Serialization/Lib.js | 2 ++ src/Cardano/Serialization/Lib.purs | 10 ++++++++++ 3 files changed, 14 insertions(+) diff --git a/code-gen/parse-csl/src/Csl.hs b/code-gen/parse-csl/src/Csl.hs index 2bbe351..c3c66f5 100644 --- a/code-gen/parse-csl/src/Csl.hs +++ b/code-gen/parse-csl/src/Csl.hs @@ -53,6 +53,8 @@ neededFunctions = , "hash_plutus_data" , "min_ada_for_output" , "hash_script_data" + , "min_script_fee" + , "min_fee" ] ------------------------------------------------------------------------------------- diff --git a/src/Cardano/Serialization/Lib.js b/src/Cardano/Serialization/Lib.js index 7853918..94dd31a 100644 --- a/src/Cardano/Serialization/Lib.js +++ b/src/Cardano/Serialization/Lib.js @@ -882,4 +882,6 @@ export const hashTransaction = tx_body => CSL.hash_transaction(tx_body); export const hashPlutusData = plutus_data => CSL.hash_plutus_data(plutus_data); export const hashScriptData = redeemers => cost_models => datums => CSL.hash_script_data(redeemers, cost_models, datums); export const minAdaForOutput = output => data_cost => CSL.min_ada_for_output(output, data_cost); +export const minFee = tx => linear_fee => CSL.min_fee(tx, linear_fee); +export const minScriptFee = tx => ex_unit_prices => CSL.min_script_fee(tx, ex_unit_prices); diff --git a/src/Cardano/Serialization/Lib.purs b/src/Cardano/Serialization/Lib.purs index 5b408eb..6b3e29d 100644 --- a/src/Cardano/Serialization/Lib.purs +++ b/src/Cardano/Serialization/Lib.purs @@ -600,6 +600,8 @@ module Cardano.Serialization.Lib , hashPlutusData , hashScriptData , minAdaForOutput + , minFee + , minScriptFee , Address , AssetName , AssetNames @@ -802,6 +804,14 @@ foreign import hashScriptData :: Redeemers -> Costmdls -> PlutusList -> ScriptDa -- > minAdaForOutput output dataCost foreign import minAdaForOutput :: TransactionOutput -> DataCost -> BigNum +-- | Min fee +-- > minFee tx linearFee +foreign import minFee :: Transaction -> LinearFee -> BigNum + +-- | Min script fee +-- > minScriptFee tx exUnitPrices +foreign import minScriptFee :: Transaction -> ExUnitPrices -> BigNum + -- classes From c15a6e2f63e50812d15c195ce035a06027c57001 Mon Sep 17 00:00:00 2001 From: Vladimir Kalnitsky Date: Sat, 2 Mar 2024 03:30:20 +0400 Subject: [PATCH 14/18] Add makeVkeyWitness --- code-gen/parse-csl/src/Csl.hs | 1 + src/Cardano/Serialization/Lib.js | 1 + src/Cardano/Serialization/Lib.purs | 5 +++++ 3 files changed, 7 insertions(+) diff --git a/code-gen/parse-csl/src/Csl.hs b/code-gen/parse-csl/src/Csl.hs index c3c66f5..3b2b012 100644 --- a/code-gen/parse-csl/src/Csl.hs +++ b/code-gen/parse-csl/src/Csl.hs @@ -55,6 +55,7 @@ neededFunctions = , "hash_script_data" , "min_script_fee" , "min_fee" + , "make_vkey_witness" ] ------------------------------------------------------------------------------------- diff --git a/src/Cardano/Serialization/Lib.js b/src/Cardano/Serialization/Lib.js index 94dd31a..70f5987 100644 --- a/src/Cardano/Serialization/Lib.js +++ b/src/Cardano/Serialization/Lib.js @@ -877,6 +877,7 @@ export const vkeywitnesses_new = () => CSL.Vkeywitnesses.new(); export const withdrawals_new = () => CSL.Withdrawals.new(); +export const makeVkeyWitness = tx_body_hash => sk => CSL.make_vkey_witness(tx_body_hash, sk); export const hashAuxiliaryData = auxiliary_data => CSL.hash_auxiliary_data(auxiliary_data); export const hashTransaction = tx_body => CSL.hash_transaction(tx_body); export const hashPlutusData = plutus_data => CSL.hash_plutus_data(plutus_data); diff --git a/src/Cardano/Serialization/Lib.purs b/src/Cardano/Serialization/Lib.purs index 6b3e29d..1107938 100644 --- a/src/Cardano/Serialization/Lib.purs +++ b/src/Cardano/Serialization/Lib.purs @@ -595,6 +595,7 @@ module Cardano.Serialization.Lib , vkeywitness_signature , vkeywitnesses_new , withdrawals_new + , makeVkeyWitness , hashAuxiliaryData , hashTransaction , hashPlutusData @@ -784,6 +785,10 @@ class IsStr a where -- functions +-- | Make vkey witness +-- > makeVkeyWitness txBodyHash sk +foreign import makeVkeyWitness :: TransactionHash -> PrivateKey -> Vkeywitness + -- | Hash auxiliary data -- > hashAuxiliaryData auxiliaryData foreign import hashAuxiliaryData :: AuxiliaryData -> AuxiliaryDataHash From 793503bc88dbdeccea7602d4ae34ccc360112b3a Mon Sep 17 00:00:00 2001 From: Vladimir Kalnitsky Date: Fri, 8 Mar 2024 04:12:57 +0400 Subject: [PATCH 15/18] Fix PrivateKey.generate_ed25519 --- code-gen/parse-csl/src/Csl/Gen.hs | 1 + src/Cardano/Serialization/Lib.js | 2 +- src/Cardano/Serialization/Lib.purs | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/code-gen/parse-csl/src/Csl/Gen.hs b/code-gen/parse-csl/src/Csl/Gen.hs index 290eccf..95af20e 100644 --- a/code-gen/parse-csl/src/Csl/Gen.hs +++ b/code-gen/parse-csl/src/Csl/Gen.hs @@ -527,6 +527,7 @@ mutating = , inClass "Value" ["set_multiasset"] , inClass "TransactionOutput" ["set_data_hash", "set_plutus_data", "set_script_ref"] , keys "PlutusMap" + , inClass "PrivateKey" ["generate_ed25519"] , keys "ProposedProtocolParameterUpdates" , keys "Withdrawals" ] ++ map (list . fst) listTypes diff --git a/src/Cardano/Serialization/Lib.js b/src/Cardano/Serialization/Lib.js index 70f5987..fbb0ef5 100644 --- a/src/Cardano/Serialization/Lib.js +++ b/src/Cardano/Serialization/Lib.js @@ -494,7 +494,7 @@ export const poolRetirement_new = pool_keyhash => epoch => CSL.PoolRetirement.ne // PrivateKey export const privateKey_free = self => errorableToPurs(self.free.bind(self), ); export const privateKey_toPublic = self => self.to_public.bind(self)(); -export const privateKey_generateEd25519 = CSL.PrivateKey.generate_ed25519(); +export const privateKey_generateEd25519 = () => CSL.PrivateKey.generate_ed25519(); export const privateKey_generateEd25519extended = CSL.PrivateKey.generate_ed25519extended(); export const privateKey_fromBech32 = bech32_str => errorableToPurs(CSL.PrivateKey.from_bech32, bech32_str); export const privateKey_toBech32 = self => self.to_bech32.bind(self)(); diff --git a/src/Cardano/Serialization/Lib.purs b/src/Cardano/Serialization/Lib.purs index 1107938..b19d929 100644 --- a/src/Cardano/Serialization/Lib.purs +++ b/src/Cardano/Serialization/Lib.purs @@ -2180,7 +2180,7 @@ foreign import data PrivateKey :: Type foreign import privateKey_free :: PrivateKey -> Nullable Unit foreign import privateKey_toPublic :: PrivateKey -> PublicKey -foreign import privateKey_generateEd25519 :: PrivateKey +foreign import privateKey_generateEd25519 :: Effect PrivateKey foreign import privateKey_generateEd25519extended :: PrivateKey foreign import privateKey_fromBech32 :: String -> Nullable PrivateKey foreign import privateKey_toBech32 :: PrivateKey -> String From e3c0891b377fc07d9f11833add2e6ff872ab119c Mon Sep 17 00:00:00 2001 From: Vladimir Kalnitsky Date: Thu, 14 Mar 2024 03:17:11 +0400 Subject: [PATCH 16/18] Add PrivateKey.generate_ed25519extended --- code-gen/parse-csl/src/Csl/Gen.hs | 2 +- src/Cardano/Serialization/Lib.js | 2 +- src/Cardano/Serialization/Lib.purs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/code-gen/parse-csl/src/Csl/Gen.hs b/code-gen/parse-csl/src/Csl/Gen.hs index 95af20e..6cf3d24 100644 --- a/code-gen/parse-csl/src/Csl/Gen.hs +++ b/code-gen/parse-csl/src/Csl/Gen.hs @@ -527,7 +527,7 @@ mutating = , inClass "Value" ["set_multiasset"] , inClass "TransactionOutput" ["set_data_hash", "set_plutus_data", "set_script_ref"] , keys "PlutusMap" - , inClass "PrivateKey" ["generate_ed25519"] + , inClass "PrivateKey" ["generate_ed25519", "generate_ed25519extended"] , keys "ProposedProtocolParameterUpdates" , keys "Withdrawals" ] ++ map (list . fst) listTypes diff --git a/src/Cardano/Serialization/Lib.js b/src/Cardano/Serialization/Lib.js index fbb0ef5..6e00517 100644 --- a/src/Cardano/Serialization/Lib.js +++ b/src/Cardano/Serialization/Lib.js @@ -495,7 +495,7 @@ export const poolRetirement_new = pool_keyhash => epoch => CSL.PoolRetirement.ne export const privateKey_free = self => errorableToPurs(self.free.bind(self), ); export const privateKey_toPublic = self => self.to_public.bind(self)(); export const privateKey_generateEd25519 = () => CSL.PrivateKey.generate_ed25519(); -export const privateKey_generateEd25519extended = CSL.PrivateKey.generate_ed25519extended(); +export const privateKey_generateEd25519extended = () => CSL.PrivateKey.generate_ed25519extended(); export const privateKey_fromBech32 = bech32_str => errorableToPurs(CSL.PrivateKey.from_bech32, bech32_str); export const privateKey_toBech32 = self => self.to_bech32.bind(self)(); export const privateKey_asBytes = self => self.as_bytes.bind(self)(); diff --git a/src/Cardano/Serialization/Lib.purs b/src/Cardano/Serialization/Lib.purs index b19d929..fde597e 100644 --- a/src/Cardano/Serialization/Lib.purs +++ b/src/Cardano/Serialization/Lib.purs @@ -2181,7 +2181,7 @@ foreign import data PrivateKey :: Type foreign import privateKey_free :: PrivateKey -> Nullable Unit foreign import privateKey_toPublic :: PrivateKey -> PublicKey foreign import privateKey_generateEd25519 :: Effect PrivateKey -foreign import privateKey_generateEd25519extended :: PrivateKey +foreign import privateKey_generateEd25519extended :: Effect PrivateKey foreign import privateKey_fromBech32 :: String -> Nullable PrivateKey foreign import privateKey_toBech32 :: PrivateKey -> String foreign import privateKey_asBytes :: PrivateKey -> ByteArray From 640a429eb0e57c3bfc8de5e3fdafa86491df0e7c Mon Sep 17 00:00:00 2001 From: Vladimir Kalnitsky Date: Sat, 16 Mar 2024 23:09:51 +0400 Subject: [PATCH 17/18] Fix the FFI --- code-gen/parse-csl/app/Main.hs | 2 +- src/Cardano/Serialization/Lib/Internal.js | 230 ++++++---------------- 2 files changed, 58 insertions(+), 174 deletions(-) diff --git a/code-gen/parse-csl/app/Main.hs b/code-gen/parse-csl/app/Main.hs index 14d5636..2b61aa0 100644 --- a/code-gen/parse-csl/app/Main.hs +++ b/code-gen/parse-csl/app/Main.hs @@ -11,7 +11,7 @@ main = do jsLibHeader <- readFile "./fixtures/Lib.js" importsCode <- readFile "./fixtures/imports.purs" pursInternalLib <- readFile "./fixtures/Internal.purs" - jsInternalLib <- readFile "./fixtures/Internal.purs" + jsInternalLib <- readFile "./fixtures/Internal.js" funs <- getFuns classes <- getClasses print funs diff --git a/src/Cardano/Serialization/Lib/Internal.js b/src/Cardano/Serialization/Lib/Internal.js index 4ecde41..c7b0178 100644 --- a/src/Cardano/Serialization/Lib/Internal.js +++ b/src/Cardano/Serialization/Lib/Internal.js @@ -1,173 +1,57 @@ -module Cardano.Serialization.Lib.Internal where - -import Prelude - -import Aeson (Aeson, decodeAeson, encodeAeson, jsonToAeson, stringifyAeson) -import Data.Argonaut (Json, JsonDecodeError(TypeMismatch), jsonParser, stringify) -import Data.Bifunctor (lmap) -import Data.ByteArray (ByteArray) -import Data.Either (Either, note) -import Data.Map (Map) -import Data.Map as Map -import Data.Maybe (Maybe(Nothing, Just)) -import Data.Profunctor.Strong ((***)) -import Data.Tuple (Tuple(Tuple)) -import Data.Tuple.Nested (type (/\), (/\)) -import Type.Proxy (Proxy(Proxy)) - --- all types - -class IsCsl (a :: Type) where - className :: Proxy a -> String - --- byte-representable types - -class IsCsl a <= IsBytes (a :: Type) - -toBytes :: forall a. IsCsl a => IsBytes a => a -> ByteArray -toBytes = _toBytes - -fromBytes :: forall a. IsCsl a => IsBytes a => ByteArray -> Maybe a -fromBytes = _fromBytes (className (Proxy :: Proxy a)) Nothing Just - -foreign import _toBytes :: forall a. a -> ByteArray - -foreign import _fromBytes - :: forall b - . String - -> (forall a. Maybe a) - -> (forall a. a -> Maybe a) - -> ByteArray - -> Maybe b - --- json - -class IsCsl a <= IsJson (a :: Type) - --- containers - -class IsListContainer (c :: Type) (e :: Type) | c -> e - -packListContainer :: forall c e. IsCsl c => IsListContainer c e => Array e -> c -packListContainer = _packListContainer (className (Proxy :: Proxy c)) - -unpackListContainer :: forall c e. IsListContainer c e => c -> Array e -unpackListContainer = _unpackListContainer - -foreign import _packListContainer :: forall c e. String -> Array e -> c -foreign import _unpackListContainer :: forall c e. c -> Array e - -class IsMapContainer (c :: Type) (k :: Type) (v :: Type) | c -> k, c -> v - -packMapContainer - :: forall c k v - . IsMapContainer c k v - => IsCsl c - => Array (k /\ v) - -> c -packMapContainer = map toKeyValues >>> _packMapContainer (className (Proxy :: Proxy c)) - where - toKeyValues (Tuple key value) = { key, value } - -packMapContainerFromMap - :: forall c k v - . IsMapContainer c k v - => IsCsl c - => IsCsl k - => IsCsl v - => Map k v - -> c -packMapContainerFromMap = packMapContainer <<< Map.toUnfoldable - -unpackMapContainer - :: forall c k v - . IsMapContainer c k v - => c - -> Array (k /\ v) -unpackMapContainer = _unpackMapContainer >>> map fromKV - where fromKV { key, value } = key /\ value - -unpackMapContainerToMapWith - :: forall c k v k1 v1 - . IsMapContainer c k v - => Ord k1 - => (k -> k1) - -> (v -> v1) - -> c - -> Map k1 v1 -unpackMapContainerToMapWith mapKey mapValue container = - unpackMapContainer container - # map (mapKey *** mapValue) >>> Map.fromFoldable - -foreign import _packMapContainer - :: forall c k v - . String - -> Array { key :: k, value :: v } - -> c - -foreign import _unpackMapContainer - :: forall c k v - . c - -> Array { key :: k, value :: v } - --- Aeson - -cslFromAeson - :: forall a - . IsJson a - => Aeson - -> Either JsonDecodeError a -cslFromAeson aeson = - (lmap (const $ TypeMismatch "JSON") $ jsonParser $ stringifyAeson aeson) - >>= cslFromJson >>> note (TypeMismatch $ className (Proxy :: Proxy a)) - -cslToAeson - :: forall a - . IsJson a - => a -> Aeson -cslToAeson = _cslToJson >>> jsonToAeson - -cslToAesonViaBytes - :: forall a - . IsBytes a - => a -> Aeson -cslToAesonViaBytes = toBytes >>> encodeAeson - -cslFromAesonViaBytes - :: forall a - . IsBytes a - => Aeson -> Either JsonDecodeError a -cslFromAesonViaBytes aeson = do - bytes <- decodeAeson aeson - note (TypeMismatch $ className (Proxy :: Proxy a)) $ fromBytes bytes - --- Show - -showViaBytes - :: forall a - . IsBytes a - => a - -> String -showViaBytes a = "(unsafePartial $ fromJust $ fromBytes " <> show (toBytes a) <> ")" - -showViaJson - :: forall a - . IsJson a - => a - -> String -showViaJson a = "(unsafePartial $ fromJust $ cslFromJson $ jsonParser " <> show (stringify (_cslToJson a)) <> ")" - ---- Json - -cslFromJson :: forall a. IsCsl a => IsJson a => Json -> Maybe a -cslFromJson = _cslFromJson (className (Proxy :: Proxy a)) Nothing Just - -foreign import _cslFromJson - :: forall b - . String - -> (forall a. Maybe a) - -> (forall a. a -> Maybe a) - -> Json - -> Maybe b - -foreign import _cslToJson :: forall a. a -> Json +import * as csl from "@mlabs-haskell/cardano-serialization-lib-gc"; + +export const _toBytes = x => x.to_bytes(); +export const _fromBytes = key => nothing => just => bytes => { + try { + return just(csl[key].from_bytes(bytes)); + } catch (_) { + return nothing; + } +}; + +export const _packListContainer = containerClass => elems => { + const container = csl[containerClass].new(); + for (let elem of elems) { + container.add(elem); + } + return container; +}; + +export const _unpackListContainer = container => { + const res = []; + const len = container.len(); + for (let i = 0; i < len; i++) { + res.push(container.get(i)); + } + return res; +}; + +export const _packMapContainer = containerClass => elems => { + const container = csl[containerClass].new(); + for (let elem of elems) { + container.insert(elem.key, elem.value); + } + console.log(container.to_json()); + return container; +}; + +export const _unpackMapContainer = container => { + const keys = _unpackListContainer(container.keys()); + console.log("keys", keys); + const res = []; + for (let key of keys) { + res.push({ key, value: container.get(key) }); + } + console.log("unpack", res); + return res; +}; + +export const _cslFromJson = className => nothing => just => json => { + try { + return just(csl[className].from_json(json)); + } catch (e) { + return nothing; + } +}; + +export const _cslToJson = x => x.to_json(); From a0a89427d8bfae45b1e507c54552cd17b59af411 Mon Sep 17 00:00:00 2001 From: Vladimir Kalnitsky Date: Wed, 20 Mar 2024 01:33:15 +0400 Subject: [PATCH 18/18] Remove logging --- code-gen/parse-csl/fixtures/Internal.js | 3 --- src/Cardano/Serialization/Lib/Internal.js | 3 --- 2 files changed, 6 deletions(-) diff --git a/code-gen/parse-csl/fixtures/Internal.js b/code-gen/parse-csl/fixtures/Internal.js index c7b0178..01d4466 100644 --- a/code-gen/parse-csl/fixtures/Internal.js +++ b/code-gen/parse-csl/fixtures/Internal.js @@ -31,18 +31,15 @@ export const _packMapContainer = containerClass => elems => { for (let elem of elems) { container.insert(elem.key, elem.value); } - console.log(container.to_json()); return container; }; export const _unpackMapContainer = container => { const keys = _unpackListContainer(container.keys()); - console.log("keys", keys); const res = []; for (let key of keys) { res.push({ key, value: container.get(key) }); } - console.log("unpack", res); return res; }; diff --git a/src/Cardano/Serialization/Lib/Internal.js b/src/Cardano/Serialization/Lib/Internal.js index c7b0178..01d4466 100644 --- a/src/Cardano/Serialization/Lib/Internal.js +++ b/src/Cardano/Serialization/Lib/Internal.js @@ -31,18 +31,15 @@ export const _packMapContainer = containerClass => elems => { for (let elem of elems) { container.insert(elem.key, elem.value); } - console.log(container.to_json()); return container; }; export const _unpackMapContainer = container => { const keys = _unpackListContainer(container.keys()); - console.log("keys", keys); const res = []; for (let key of keys) { res.push({ key, value: container.get(key) }); } - console.log("unpack", res); return res; };