From 4422baa9813e252cff734c8d0eeae9f607b43e12 Mon Sep 17 00:00:00 2001 From: tony Date: Mon, 30 Jun 2025 17:15:34 +0700 Subject: [PATCH 1/7] Revert "roll back uplc | to version CSL 24" This reverts commit 5fb4c0eae61a46298e696e641294a36d7e713b1c. --- rust/Cargo.lock | 311 +++++++++++++++++++++++++---------------- rust/Cargo.toml | 2 +- rust/src/tx_builder.rs | 2 +- 3 files changed, 191 insertions(+), 124 deletions(-) diff --git a/rust/Cargo.lock b/rust/Cargo.lock index 2352009..dd86f5b 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -23,14 +23,14 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0dde43e75fd43e8a1bf86103336bc699aa8d17ad1be60c76c0bdfd4828e19b78" dependencies = [ - "autocfg 1.4.0", + "autocfg 1.3.0", ] [[package]] name = "autocfg" -version = "1.4.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "base16ct" @@ -46,9 +46,9 @@ checksum = "6107fe1be6682a68940da878d9e9f5e90ca5745b3dec9fd1bb393c8777d4f581" [[package]] name = "base64ct" -version = "1.7.3" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89e25b6adfb930f02d1981565a6e5d9c547ac15a96606256d3b59040e5cd4ca3" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" [[package]] name = "bech32" @@ -68,6 +68,18 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + [[package]] name = "block-buffer" version = "0.9.0" @@ -88,9 +100,9 @@ dependencies = [ [[package]] name = "blst" -version = "0.3.14" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47c79a94619fade3c0b887670333513a67ac28a6a7e653eb260bf0d4103db38d" +checksum = "4378725facc195f1a538864863f6de233b500a8862747e7f165078a419d5e874" dependencies = [ "cc", "glob", @@ -100,9 +112,15 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.17.0" +version = "3.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" + +[[package]] +name = "byteorder" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "cardano-serialization-lib" @@ -115,7 +133,7 @@ dependencies = [ "cryptoxide", "digest 0.9.0", "ed25519-bip32", - "getrandom 0.2.16", + "getrandom 0.2.15", "hex", "itertools 0.10.5", "js-sys", @@ -145,9 +163,9 @@ checksum = "089a0261d1bc59e54e8e11860031efd88593f0e61b921172c474f1f38c2f2d3c" [[package]] name = "cc" -version = "1.2.21" +version = "1.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8691782945451c1c383942c4874dbe63814f61cb57ef773cda2972682b7bb3c0" +checksum = "07b1695e2c7e8fc85310cde85aeaab7e3097f593c91d209d3f9df76c928100f0" dependencies = [ "shlex", ] @@ -184,18 +202,18 @@ checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" [[package]] name = "cpufeatures" -version = "0.2.17" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" dependencies = [ "libc", ] [[package]] name = "crc" -version = "3.3.0" +version = "3.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9710d3b3739c2e349eb44fe848ad0b7c8cb1e42bd87ee49371df2f7acaf3e675" +checksum = "69e6e4d7b33a94f0991c26729976b10ebde1d34c3ee82408fb536164fa10d636" dependencies = [ "crc-catalog", ] @@ -206,6 +224,12 @@ version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" +[[package]] +name = "crunchy" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43da5946c66ffcc7745f48db692ffbb10a83bfe0afd96235c5c2a4fb23994929" + [[package]] name = "crypto-bigint" version = "0.5.5" @@ -236,9 +260,9 @@ checksum = "382ce8820a5bb815055d3553a610e8cb542b2d767bbacea99038afda96cd760d" [[package]] name = "der" -version = "0.7.10" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" dependencies = [ "const-oid", "zeroize", @@ -267,9 +291,9 @@ dependencies = [ [[package]] name = "dyn-clone" -version = "1.0.19" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c7a8fb8a9fbf66c1f703fe16184d10ca0ee9d23be5b4436400408ba54a95005" +checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125" [[package]] name = "ecdsa" @@ -296,9 +320,9 @@ dependencies = [ [[package]] name = "either" -version = "1.15.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[package]] name = "elliptic-curve" @@ -331,9 +355,9 @@ dependencies = [ [[package]] name = "ff" -version = "0.13.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" dependencies = [ "rand_core 0.6.4", "subtle", @@ -345,6 +369,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + [[package]] name = "generic-array" version = "0.14.7" @@ -369,9 +399,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.16" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "js-sys", @@ -382,9 +412,9 @@ dependencies = [ [[package]] name = "glob" -version = "0.3.2" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "group" @@ -399,9 +429,19 @@ dependencies = [ [[package]] name = "half" -version = "1.8.3" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b43ede17f21864e81be2fa654110bf1e793774238d86ef8555c37e6519c0403" +checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888" +dependencies = [ + "cfg-if", + "crunchy", +] + +[[package]] +name = "hamming" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65043da274378d68241eb9a8f8f8aa54e349136f7b8e12f63e3ef44043cc30e1" [[package]] name = "hashbrown" @@ -411,9 +451,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "heck" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "hermit-abi" @@ -442,7 +482,7 @@ version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ - "autocfg 1.4.0", + "autocfg 1.3.0", "hashbrown", ] @@ -466,9 +506,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.15" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "js-sys" @@ -489,7 +529,7 @@ dependencies = [ "ecdsa", "elliptic-curve", "once_cell", - "sha2 0.10.9", + "sha2 0.10.8", "signature", ] @@ -501,9 +541,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.172" +version = "0.2.159" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" +checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" [[package]] name = "linked-hash-map" @@ -513,9 +553,9 @@ checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" [[package]] name = "log" -version = "0.4.27" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" [[package]] name = "memchr" @@ -543,14 +583,14 @@ checksum = "49e7bc1560b95a3c4a25d03de42fe76ca718ab92d1a22a55b9b4cf67b3ae635c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.77", ] [[package]] name = "minicbor" -version = "0.20.0" +version = "0.25.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d15f4203d71fdf90903c2696e55426ac97a363c67b218488a73b534ce7aca10" +checksum = "c0452a60c1863c1f50b5f77cd295e8d2786849f35883f0b9e18e7e6e1b5691b0" dependencies = [ "half", "minicbor-derive", @@ -558,13 +598,13 @@ dependencies = [ [[package]] name = "minicbor-derive" -version = "0.13.0" +version = "0.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1154809406efdb7982841adb6311b3d095b46f78342dd646736122fe6b19e267" +checksum = "bd2209fff77f705b00c737016a48e73733d7fbccb8b007194db148f03561fb70" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.77", ] [[package]] @@ -598,7 +638,7 @@ version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ - "autocfg 1.4.0", + "autocfg 1.3.0", ] [[package]] @@ -613,9 +653,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.21.3" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "opaque-debug" @@ -625,9 +665,9 @@ checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" [[package]] name = "pallas-addresses" -version = "0.30.2" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84460293bb3323066e9ce608702750c14f02bc36d41c469e44b3eef5ec0fdbf6" +checksum = "d7bd039d7f1618d12ff348dd03eebe38c5d2a010325750e5341526c419b0f8e0" dependencies = [ "base58", "bech32 0.9.1", @@ -641,9 +681,9 @@ dependencies = [ [[package]] name = "pallas-codec" -version = "0.30.2" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "747279d1bc612986035619a3eaded8f9f4ceae29668aa7a5feae83681a0e93f4" +checksum = "1584d615857c0a44058fb612e892e9e0cc47b56c3c82cdf7347b5c1d1193598c" dependencies = [ "hex", "minicbor", @@ -654,9 +694,9 @@ dependencies = [ [[package]] name = "pallas-crypto" -version = "0.30.2" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b6f8b08e32c7dbb50302222701ae15ef9ac1a7cc39225ce29c253f6ddab2aa7" +checksum = "37c1d642326ce402eb9191aeacc3dd0bf2b499848e97a56396c978a6eb9dd31a" dependencies = [ "cryptoxide", "hex", @@ -664,13 +704,14 @@ dependencies = [ "rand_core 0.6.4", "serde", "thiserror", + "zeroize", ] [[package]] name = "pallas-primitives" -version = "0.30.2" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24929d461308626183d5bf15290e6315f4cc67fa38a1a66469425919683cceb2" +checksum = "6d30f5053073554d016a9f009c077f9a84275951a611cce54230de6c54d34d9b" dependencies = [ "base58", "bech32 0.9.1", @@ -684,9 +725,9 @@ dependencies = [ [[package]] name = "pallas-traverse" -version = "0.30.2" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73ca94c2278a160c226d6f5bb1756ea5f355421158aaa697445f59f09477a6a4" +checksum = "02d2572d316883fe866ae648bc3c5357e70cbbe8de5d78b1246f6109520fa52f" dependencies = [ "hex", "itertools 0.13.0", @@ -707,9 +748,9 @@ checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "peg" -version = "0.8.5" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9928cfca101b36ec5163e70049ee5368a8a1c3c6efc9ca9c5f9cc2f816152477" +checksum = "295283b02df346d1ef66052a757869b2876ac29a6bb0ac3f5f7cd44aebe40e8f" dependencies = [ "peg-macros", "peg-runtime", @@ -717,9 +758,9 @@ dependencies = [ [[package]] name = "peg-macros" -version = "0.8.5" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6298ab04c202fa5b5d52ba03269fb7b74550b150323038878fe6c372d8280f71" +checksum = "bdad6a1d9cf116a059582ce415d5f5566aabcd4008646779dab7fdc2a9a9d426" dependencies = [ "peg-runtime", "proc-macro2", @@ -728,9 +769,9 @@ dependencies = [ [[package]] name = "peg-runtime" -version = "0.8.5" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "132dca9b868d927b35b5dd728167b2dee150eb1ad686008fc71ccb298b776fca" +checksum = "e3aeb8f54c078314c2065ee649a7241f46b9d8e418e1a9581ba0546657d7aa3a" [[package]] name = "pkcs8" @@ -744,9 +785,9 @@ dependencies = [ [[package]] name = "ppv-lite86" -version = "0.2.21" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" dependencies = [ "zerocopy", ] @@ -765,9 +806,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.95" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] @@ -797,13 +838,19 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.40" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + [[package]] name = "rand" version = "0.7.3" @@ -888,7 +935,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.16", + "getrandom 0.2.15", ] [[package]] @@ -926,9 +973,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.11.1" +version = "1.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" dependencies = [ "aho-corasick", "memchr", @@ -938,9 +985,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.9" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" dependencies = [ "aho-corasick", "memchr", @@ -949,9 +996,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.5" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "rfc6979" @@ -965,21 +1012,21 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.20" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2" +checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" [[package]] name = "ryu" -version = "1.0.20" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "schemars" -version = "0.8.22" +version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fbf2ae1b8bc8e02df939598064d22402220cd5bbcca1c76f7d6a310974d5615" +checksum = "09c024468a378b7e36765cd36702b7a90cc3cba11654f6685c8f233408e89e92" dependencies = [ "dyn-clone", "schemars_derive", @@ -989,14 +1036,14 @@ dependencies = [ [[package]] name = "schemars_derive" -version = "0.8.22" +version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32e265784ad618884abaea0600a9adf15393368d840e0222d101a072f3f7534d" +checksum = "b1eee588578aff73f856ab961cd2f79e36bc45d7ded33a7562adba4667aecc0e" dependencies = [ "proc-macro2", "quote", "serde_derive_internals", - "syn 2.0.101", + "syn 2.0.77", ] [[package]] @@ -1033,9 +1080,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.219" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" dependencies = [ "serde_derive", ] @@ -1053,13 +1100,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.219" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.77", ] [[package]] @@ -1070,14 +1117,14 @@ checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.77", ] [[package]] name = "serde_json" -version = "1.0.140" +version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" dependencies = [ "itoa", "memchr", @@ -1100,9 +1147,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.9" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", "cpufeatures", @@ -1137,21 +1184,24 @@ dependencies = [ [[package]] name = "strum" -version = "0.24.1" +version = "0.26.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" +checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" +dependencies = [ + "strum_macros", +] [[package]] name = "strum_macros" -version = "0.24.3" +version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" +checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" dependencies = [ "heck", "proc-macro2", "quote", "rustversion", - "syn 1.0.109", + "syn 2.0.77", ] [[package]] @@ -1173,33 +1223,39 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.101" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + [[package]] name = "thiserror" -version = "1.0.69" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.69" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.77", ] [[package]] @@ -1219,15 +1275,15 @@ checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a" [[package]] name = "typenum" -version = "1.18.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "unicode-ident" -version = "1.0.18" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unicode-segmentation" @@ -1243,11 +1299,13 @@ checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" [[package]] name = "uplc" -version = "1.1.3" -source = "git+https://github.com/aiken-lang/aiken.git?rev=3d77b5c378ce404cddd9a1f111906d72fd46fc83#3d77b5c378ce404cddd9a1f111906d72fd46fc83" +version = "1.1.13" +source = "git+https://github.com/aiken-lang/aiken.git?rev=900bf91216deff19be9b3582a9fccd03be0d485c#900bf91216deff19be9b3582a9fccd03be0d485c" dependencies = [ + "bitvec", "blst", "cryptoxide", + "hamming", "hex", "indexmap", "itertools 0.10.5", @@ -1268,7 +1326,6 @@ dependencies = [ "serde", "serde_json", "strum", - "strum_macros", "thiserror", ] @@ -1366,24 +1423,34 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + [[package]] name = "zerocopy" -version = "0.8.25" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1702d9583232ddb9174e01bb7c15a2ab8fb1bc6f227aa1233858c351a3ba0cb" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ + "byteorder", "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.25" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28a6e20d751156648aa063f3800b706ee209a32c0b4d9f24be3d980b01be55ef" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.77", ] [[package]] @@ -1403,5 +1470,5 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.77", ] diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 716d28d..d98e0f8 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -35,7 +35,7 @@ itertools = "0.10.1" rand = "0.8.4" schemars = "0.8.8" serde = { version = "1.0", features = ["derive"] } -uplc = { git = "https://github.com/aiken-lang/aiken.git", rev = "3d77b5c378ce404cddd9a1f111906d72fd46fc83", default-features = false } +uplc = { git = "https://github.com/aiken-lang/aiken.git", rev = "900bf91216deff19be9b3582a9fccd03be0d485c", default-features = false } # non-wasm [target.'cfg(not(all(target_arch = "wasm32", not(target_os = "emscripten"))))'.dependencies] diff --git a/rust/src/tx_builder.rs b/rust/src/tx_builder.rs index 8a6acd4..e37126c 100644 --- a/rust/src/tx_builder.rs +++ b/rust/src/tx_builder.rs @@ -68,7 +68,7 @@ pub fn get_ex_units( Ok(redeemers_bytes) => Ok(Redeemers( redeemers_bytes .iter() - .map(|r| Redeemer::from_bytes(r.to_vec()).unwrap()) + .map(|(r, _)| Redeemer::from_bytes(r.clone()).unwrap()) .collect(), )), Err(err) => Err(JsError::from_str(&err.to_string())), From ffb2d3add8666edcf71150a4e8dc06bd56e39893 Mon Sep 17 00:00:00 2001 From: tony Date: Mon, 30 Jun 2025 20:03:35 +0700 Subject: [PATCH 2/7] add vote delegation --- rust/pkg/cardano_serialization_lib.js.flow | 10756 ------------------- rust/src/address.rs | 7 + rust/src/error.rs | 7 + rust/src/lib.rs | 155 + rust/src/serialization.rs | 225 + rust/src/tx_builder.rs | 6 + 6 files changed, 400 insertions(+), 10756 deletions(-) delete mode 100644 rust/pkg/cardano_serialization_lib.js.flow diff --git a/rust/pkg/cardano_serialization_lib.js.flow b/rust/pkg/cardano_serialization_lib.js.flow deleted file mode 100644 index b5e0fa2..0000000 --- a/rust/pkg/cardano_serialization_lib.js.flow +++ /dev/null @@ -1,10756 +0,0 @@ -/** - * Flowtype definitions for cardano_serialization_lib - * Generated by Flowgen from a Typescript Definition - * Flowgen v1.11.0 - * @flow - */ - -/** - * @param {Transaction} tx - * @param {LinearFee} linear_fee - * @returns {BigNum} - */ -declare export function min_fee(tx: Transaction, linear_fee: LinearFee): BigNum; - -/** - * @param {number} tx_size - * @param {LinearFee} linear_fee - * @returns {BigNum} - */ -declare export function cal_min_fee( - tx_size: number, - 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 - * @param {string} nonce - * @param {string} data - * @returns {string} - */ -declare export function encrypt_with_password( - password: string, - salt: string, - nonce: string, - data: string -): string; - -/** - * @param {string} password - * @param {string} data - * @returns {string} - */ -declare export function decrypt_with_password( - password: string, - data: string -): string; - -/** - * @param {Uint8Array} bytes - * @returns {TransactionMetadatum} - */ -declare export function encode_arbitrary_bytes_as_metadatum( - bytes: Uint8Array -): TransactionMetadatum; - -/** - * @param {TransactionMetadatum} metadata - * @returns {Uint8Array} - */ -declare export function decode_arbitrary_bytes_from_metadatum( - metadata: TransactionMetadatum -): Uint8Array; - -/** - * @param {string} json - * @param {number} schema - * @returns {TransactionMetadatum} - */ -declare export function encode_json_str_to_metadatum( - json: string, - schema: number -): TransactionMetadatum; - -/** - * @param {TransactionMetadatum} metadatum - * @param {number} schema - * @returns {string} - */ -declare export function decode_metadatum_to_json_str( - metadatum: TransactionMetadatum, - 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 {TransactionHash} tx_body_hash - * @param {ByronAddress} addr - * @param {LegacyDaedalusPrivateKey} key - * @returns {BootstrapWitness} - */ -declare export function make_daedalus_bootstrap_witness( - tx_body_hash: TransactionHash, - addr: ByronAddress, - key: LegacyDaedalusPrivateKey -): BootstrapWitness; - -/** - * @param {TransactionHash} tx_body_hash - * @param {ByronAddress} addr - * @param {Bip32PrivateKey} key - * @returns {BootstrapWitness} - */ -declare export function make_icarus_bootstrap_witness( - tx_body_hash: TransactionHash, - addr: ByronAddress, - key: Bip32PrivateKey -): BootstrapWitness; - -/** - * @param {TransactionHash} tx_body_hash - * @param {PrivateKey} sk - * @returns {Vkeywitness} - */ -declare export function make_vkey_witness( - tx_body_hash: TransactionHash, - sk: PrivateKey -): Vkeywitness; - -/** - * @param {AuxiliaryData} auxiliary_data - * @returns {AuxiliaryDataHash} - */ -declare export function hash_auxiliary_data( - auxiliary_data: AuxiliaryData -): AuxiliaryDataHash; - -/** - * @param {TransactionBody} tx_body - * @returns {TransactionHash} - */ -declare export function hash_transaction( - tx_body: TransactionBody -): TransactionHash; - -/** - * @param {PlutusData} plutus_data - * @returns {DataHash} - */ -declare export function hash_plutus_data(plutus_data: PlutusData): DataHash; - -/** - * @param {Redeemers} redeemers - * @param {Costmdls} cost_models - * @param {PlutusList | void} datums - * @returns {ScriptDataHash} - */ -declare export function hash_script_data( - redeemers: Redeemers, - cost_models: Costmdls, - datums?: PlutusList -): ScriptDataHash; - -/** - * @param {TransactionBody} txbody - * @param {BigNum} pool_deposit - * @param {BigNum} key_deposit - * @returns {Value} - */ -declare export function get_implicit_input( - txbody: TransactionBody, - pool_deposit: BigNum, - key_deposit: BigNum -): Value; - -/** - * @param {TransactionBody} txbody - * @param {BigNum} pool_deposit - * @param {BigNum} key_deposit - * @returns {BigNum} - */ -declare export function get_deposit( - txbody: TransactionBody, - pool_deposit: BigNum, - key_deposit: BigNum -): BigNum; - -/** - * returns minimal amount of ada for the output for case when the amount is included to the output - * @param {TransactionOutput} output - * @param {DataCost} data_cost - * @returns {BigNum} - */ -declare export function min_ada_for_output( - output: TransactionOutput, - data_cost: DataCost -): BigNum; - -/** - * !!! DEPRECATED !!! - * This function uses outdated set of arguments. - * Use `min_ada_for_output` instead - * @param {Value} assets - * @param {boolean} has_data_hash - * @param {BigNum} coins_per_utxo_word - * @returns {BigNum} - */ -declare export function min_ada_required( - assets: Value, - has_data_hash: boolean, - coins_per_utxo_word: BigNum -): BigNum; - -/** - * Receives a script JSON string - * and returns a NativeScript. - * Cardano Wallet and Node styles are supported. - * - * * wallet: https://github.com/input-output-hk/cardano-wallet/blob/master/specifications/api/swagger.yaml - * * node: https://github.com/input-output-hk/cardano-node/blob/master/doc/reference/simple-scripts.md - * - * self_xpub is expected to be a Bip32PublicKey as hex-encoded bytes - * @param {string} json - * @param {string} self_xpub - * @param {number} schema - * @returns {NativeScript} - */ -declare export function encode_json_str_to_native_script( - json: string, - self_xpub: string, - schema: number -): NativeScript; - -/** - * @param {PlutusList} params - * @param {PlutusScript} plutus_script - * @returns {PlutusScript} - */ -declare export function apply_params_to_plutus_script( - params: PlutusList, - plutus_script: PlutusScript -): PlutusScript; - -/** - * @param {Transaction} tx - * @param {TransactionUnspentOutputs} utxos - * @param {Costmdls} cost_mdls - * @param {ExUnits} max_ex_units - * @param {BigNum} zero_time - * @param {BigNum} zero_slot - * @param {number} slot_length - * @returns {Redeemers} - */ -declare export function get_ex_units( - tx: Transaction, - utxos: TransactionUnspentOutputs, - cost_mdls: Costmdls, - max_ex_units: ExUnits, - zero_time: BigNum, - zero_slot: BigNum, - slot_length: number -): Redeemers; - -/** - */ - -declare export var CertificateKind: {| - +StakeRegistration: 0, // 0 - +StakeDeregistration: 1, // 1 - +StakeDelegation: 2, // 2 - +PoolRegistration: 3, // 3 - +PoolRetirement: 4, // 4 - +GenesisKeyDelegation: 5, // 5 - +MoveInstantaneousRewardsCert: 6, // 6 -|}; - -/** - */ - -declare export var MIRPot: {| - +Reserves: 0, // 0 - +Treasury: 1, // 1 -|}; - -/** - */ - -declare export var MIRKind: {| - +ToOtherPot: 0, // 0 - +ToStakeCredentials: 1, // 1 -|}; - -/** - */ - -declare export var RelayKind: {| - +SingleHostAddr: 0, // 0 - +SingleHostName: 1, // 1 - +MultiHostName: 2, // 2 -|}; - -/** - */ - -declare export var NativeScriptKind: {| - +ScriptPubkey: 0, // 0 - +ScriptAll: 1, // 1 - +ScriptAny: 2, // 2 - +ScriptNOfK: 3, // 3 - +TimelockStart: 4, // 4 - +TimelockExpiry: 5, // 5 -|}; - -/** - * Each new language uses a different namespace for hashing its script - * This is because you could have a language where the same bytes have different semantics - * So this avoids scripts in different languages mapping to the same hash - * Note that the enum value here is different than the enum value for deciding the cost model of a script - */ - -declare export var ScriptHashNamespace: {| - +NativeScript: 0, // 0 - +PlutusScript: 1, // 1 - +PlutusScriptV2: 2, // 2 - +PlutusScriptV3: 3, // 3 -|}; - -/** - */ - -declare export var NetworkIdKind: {| - +Testnet: 0, // 0 - +Mainnet: 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 -|}; - -/** - */ - -declare export var MetadataJsonSchema: {| - +NoConversions: 0, // 0 - +BasicConversions: 1, // 1 - +DetailedSchema: 2, // 2 -|}; - -/** - */ - -declare export var ScriptKind: {| - +NativeScript: 0, // 0 - +PlutusScriptV1: 1, // 1 - +PlutusScriptV2: 2, // 2 - +PlutusScriptV3: 3, // 3 -|}; - -/** - */ - -declare export var LanguageKind: {| - +PlutusV1: 0, // 0 - +PlutusV2: 1, // 1 - +PlutusV3: 2, // 2 -|}; - -/** - */ - -declare export var PlutusDataKind: {| - +ConstrPlutusData: 0, // 0 - +Map: 1, // 1 - +List: 2, // 2 - +Integer: 3, // 3 - +Bytes: 4, // 4 -|}; - -/** - */ - -declare export var RedeemerTagKind: {| - +Spend: 0, // 0 - +Mint: 1, // 1 - +Cert: 2, // 2 - +Reward: 3, // 3 -|}; - -/** - * JSON <-> PlutusData conversion schemas. - * Follows ScriptDataJsonSchema in cardano-cli defined at: - * https://github.com/input-output-hk/cardano-node/blob/master/cardano-api/src/Cardano/Api/ScriptData.hs#L254 - * - * 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 - */ - -declare export var PlutusDatumSchema: {| - +BasicConversions: 0, // 0 - +DetailedSchema: 1, // 1 -|}; - -/** - * Used to choosed the schema for a script JSON string - */ - -declare export var ScriptSchema: {| - +Wallet: 0, // 0 - +Node: 1, // 1 -|}; - -/** - */ - -declare export var CoinSelectionStrategyCIP2: {| - +LargestFirst: 0, // 0 - +RandomImprove: 1, // 1 - +LargestFirstMultiAsset: 2, // 2 - +RandomImproveMultiAsset: 3, // 3 -|}; - -/** - */ -declare export class Address { - free(): void; - - /** - * @param {Uint8Array} data - * @returns {Address} - */ - static from_bytes(data: Uint8Array): Address; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {AddressJSON} - */ - to_js_value(): AddressJSON; - - /** - * @param {string} json - * @returns {Address} - */ - static from_json(json: string): Address; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {Address} - */ - static from_hex(hex_str: string): Address; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {string | void} prefix - * @returns {string} - */ - to_bech32(prefix?: string): string; - - /** - * @param {string} bech_str - * @returns {Address} - */ - static from_bech32(bech_str: string): Address; - - /** - * @returns {number} - */ - network_id(): number; -} -/** - */ -declare export class AssetName { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {AssetName} - */ - static from_bytes(bytes: Uint8Array): AssetName; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {AssetName} - */ - static from_hex(hex_str: string): AssetName; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {AssetNameJSON} - */ - to_js_value(): AssetNameJSON; - - /** - * @param {string} json - * @returns {AssetName} - */ - static from_json(json: string): AssetName; - - /** - * @param {Uint8Array} name - * @returns {AssetName} - */ - static new(name: Uint8Array): AssetName; - - /** - * @returns {Uint8Array} - */ - name(): Uint8Array; -} -/** - */ -declare export class AssetNames { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {AssetNames} - */ - static from_bytes(bytes: Uint8Array): AssetNames; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {AssetNames} - */ - static from_hex(hex_str: string): AssetNames; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {AssetNamesJSON} - */ - to_js_value(): AssetNamesJSON; - - /** - * @param {string} json - * @returns {AssetNames} - */ - static from_json(json: string): AssetNames; - - /** - * @returns {AssetNames} - */ - static new(): AssetNames; - - /** - * @returns {number} - */ - len(): number; - - /** - * @param {number} index - * @returns {AssetName} - */ - get(index: number): AssetName; - - /** - * @param {AssetName} elem - */ - add(elem: AssetName): void; -} -/** - */ -declare export class Assets { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {Assets} - */ - static from_bytes(bytes: Uint8Array): Assets; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {Assets} - */ - static from_hex(hex_str: string): Assets; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {AssetsJSON} - */ - to_js_value(): AssetsJSON; - - /** - * @param {string} json - * @returns {Assets} - */ - static from_json(json: string): Assets; - - /** - * @returns {Assets} - */ - static new(): Assets; - - /** - * @returns {number} - */ - len(): number; - - /** - * @param {AssetName} key - * @param {BigNum} value - * @returns {BigNum | void} - */ - insert(key: AssetName, value: BigNum): BigNum | void; - - /** - * @param {AssetName} key - * @returns {BigNum | void} - */ - get(key: AssetName): BigNum | void; - - /** - * @returns {AssetNames} - */ - keys(): AssetNames; -} -/** - */ -declare export class AuxiliaryData { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {AuxiliaryData} - */ - static from_bytes(bytes: Uint8Array): AuxiliaryData; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {AuxiliaryData} - */ - static from_hex(hex_str: string): AuxiliaryData; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {AuxiliaryDataJSON} - */ - to_js_value(): AuxiliaryDataJSON; - - /** - * @param {string} json - * @returns {AuxiliaryData} - */ - static from_json(json: string): AuxiliaryData; - - /** - * @returns {AuxiliaryData} - */ - static new(): AuxiliaryData; - - /** - * @returns {GeneralTransactionMetadata | void} - */ - metadata(): GeneralTransactionMetadata | void; - - /** - * @param {GeneralTransactionMetadata} metadata - */ - set_metadata(metadata: GeneralTransactionMetadata): void; - - /** - * @returns {NativeScripts | void} - */ - native_scripts(): NativeScripts | void; - - /** - * @param {NativeScripts} native_scripts - */ - set_native_scripts(native_scripts: NativeScripts): void; - - /** - * @returns {PlutusScripts | void} - */ - plutus_scripts(): PlutusScripts | void; - - /** - * @param {PlutusScripts} plutus_scripts - */ - set_plutus_scripts(plutus_scripts: PlutusScripts): void; -} -/** - */ -declare export class AuxiliaryDataHash { - free(): void; - - /** - * @param {Uint8Array} bytes - * @returns {AuxiliaryDataHash} - */ - static from_bytes(bytes: Uint8Array): AuxiliaryDataHash; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {string} prefix - * @returns {string} - */ - to_bech32(prefix: string): string; - - /** - * @param {string} bech_str - * @returns {AuxiliaryDataHash} - */ - static from_bech32(bech_str: string): AuxiliaryDataHash; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex - * @returns {AuxiliaryDataHash} - */ - static from_hex(hex: string): AuxiliaryDataHash; -} -/** - */ -declare export class AuxiliaryDataSet { - free(): void; - - /** - * @returns {AuxiliaryDataSet} - */ - static new(): AuxiliaryDataSet; - - /** - * @returns {number} - */ - len(): number; - - /** - * @param {number} tx_index - * @param {AuxiliaryData} data - * @returns {AuxiliaryData | void} - */ - insert(tx_index: number, data: AuxiliaryData): AuxiliaryData | void; - - /** - * @param {number} tx_index - * @returns {AuxiliaryData | void} - */ - get(tx_index: number): AuxiliaryData | void; - - /** - * @returns {Uint32Array} - */ - indices(): Uint32Array; -} -/** - */ -declare export class BaseAddress { - free(): void; - - /** - * @param {number} network - * @param {StakeCredential} payment - * @param {StakeCredential} stake - * @returns {BaseAddress} - */ - static new( - network: number, - payment: StakeCredential, - stake: StakeCredential - ): BaseAddress; - - /** - * @returns {StakeCredential} - */ - payment_cred(): StakeCredential; - - /** - * @returns {StakeCredential} - */ - stake_cred(): StakeCredential; - - /** - * @returns {Address} - */ - to_address(): Address; - - /** - * @param {Address} addr - * @returns {BaseAddress | void} - */ - static from_address(addr: Address): BaseAddress | void; -} -/** - */ -declare export class BigInt { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {BigInt} - */ - static from_bytes(bytes: Uint8Array): BigInt; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {BigInt} - */ - static from_hex(hex_str: string): BigInt; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {BigIntJSON} - */ - to_js_value(): BigIntJSON; - - /** - * @param {string} json - * @returns {BigInt} - */ - static from_json(json: string): BigInt; - - /** - * @returns {boolean} - */ - is_zero(): boolean; - - /** - * @returns {BigNum | void} - */ - as_u64(): BigNum | void; - - /** - * @returns {Int | void} - */ - as_int(): Int | void; - - /** - * @param {string} text - * @returns {BigInt} - */ - static from_str(text: string): BigInt; - - /** - * @returns {string} - */ - to_str(): string; - - /** - * @param {BigInt} other - * @returns {BigInt} - */ - add(other: BigInt): BigInt; - - /** - * @param {BigInt} other - * @returns {BigInt} - */ - mul(other: BigInt): BigInt; - - /** - * @returns {BigInt} - */ - static one(): BigInt; - - /** - * @returns {BigInt} - */ - increment(): BigInt; - - /** - * @param {BigInt} other - * @returns {BigInt} - */ - div_ceil(other: BigInt): BigInt; -} -/** - */ -declare export class BigNum { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {BigNum} - */ - static from_bytes(bytes: Uint8Array): BigNum; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {BigNum} - */ - static from_hex(hex_str: string): BigNum; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {BigNumJSON} - */ - to_js_value(): BigNumJSON; - - /** - * @param {string} json - * @returns {BigNum} - */ - static from_json(json: string): BigNum; - - /** - * @param {string} string - * @returns {BigNum} - */ - static from_str(string: string): BigNum; - - /** - * @returns {string} - */ - to_str(): string; - - /** - * @returns {BigNum} - */ - static zero(): BigNum; - - /** - * @returns {BigNum} - */ - static one(): BigNum; - - /** - * @returns {boolean} - */ - is_zero(): boolean; - - /** - * @param {BigNum} other - * @returns {BigNum} - */ - div_floor(other: BigNum): BigNum; - - /** - * @param {BigNum} other - * @returns {BigNum} - */ - checked_mul(other: BigNum): BigNum; - - /** - * @param {BigNum} other - * @returns {BigNum} - */ - checked_add(other: BigNum): BigNum; - - /** - * @param {BigNum} other - * @returns {BigNum} - */ - checked_sub(other: BigNum): BigNum; - - /** - * returns 0 if it would otherwise underflow - * @param {BigNum} other - * @returns {BigNum} - */ - clamped_sub(other: BigNum): BigNum; - - /** - * @param {BigNum} rhs_value - * @returns {number} - */ - compare(rhs_value: BigNum): number; - - /** - * @param {BigNum} rhs_value - * @returns {boolean} - */ - less_than(rhs_value: BigNum): boolean; - - /** - * @param {BigNum} a - * @param {BigNum} b - * @returns {BigNum} - */ - static max(a: BigNum, b: BigNum): BigNum; -} -/** - */ -declare export class Bip32PrivateKey { - free(): void; - - /** - * derive this private key with the given index. - * - * # Security considerations - * - * * hard derivation index cannot be soft derived with the public key - * - * # Hard derivation vs Soft derivation - * - * If you pass an index below 0x80000000 then it is a soft derivation. - * The advantage of soft derivation is that it is possible to derive the - * public key too. I.e. derivation the private key with a soft derivation - * index and then retrieving the associated public key is equivalent to - * deriving the public key associated to the parent private key. - * - * Hard derivation index does not allow public key derivation. - * - * This is why deriving the private key should not fail while deriving - * the public key may fail (if the derivation index is invalid). - * @param {number} index - * @returns {Bip32PrivateKey} - */ - derive(index: number): Bip32PrivateKey; - - /** - * 128-byte xprv a key format in Cardano that some software still uses or requires - * the traditional 96-byte xprv is simply encoded as - * prv | chaincode - * however, because some software may not know how to compute a public key from a private key, - * the 128-byte inlines the public key in the following format - * prv | pub | chaincode - * so be careful if you see the term "xprv" as it could refer to either one - * our library does not require the pub (instead we compute the pub key when needed) - * @param {Uint8Array} bytes - * @returns {Bip32PrivateKey} - */ - static from_128_xprv(bytes: Uint8Array): Bip32PrivateKey; - - /** - * see from_128_xprv - * @returns {Uint8Array} - */ - to_128_xprv(): Uint8Array; - - /** - * @returns {Bip32PrivateKey} - */ - static generate_ed25519_bip32(): Bip32PrivateKey; - - /** - * @returns {PrivateKey} - */ - to_raw_key(): PrivateKey; - - /** - * @returns {Bip32PublicKey} - */ - to_public(): Bip32PublicKey; - - /** - * @param {Uint8Array} bytes - * @returns {Bip32PrivateKey} - */ - static from_bytes(bytes: Uint8Array): Bip32PrivateKey; - - /** - * @returns {Uint8Array} - */ - as_bytes(): Uint8Array; - - /** - * @param {string} bech32_str - * @returns {Bip32PrivateKey} - */ - static from_bech32(bech32_str: string): Bip32PrivateKey; - - /** - * @returns {string} - */ - to_bech32(): string; - - /** - * @param {Uint8Array} entropy - * @param {Uint8Array} password - * @returns {Bip32PrivateKey} - */ - static from_bip39_entropy( - entropy: Uint8Array, - password: Uint8Array - ): Bip32PrivateKey; - - /** - * @returns {Uint8Array} - */ - chaincode(): Uint8Array; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {Bip32PrivateKey} - */ - static from_hex(hex_str: string): Bip32PrivateKey; -} -/** - */ -declare export class Bip32PublicKey { - free(): void; - - /** - * derive this public key with the given index. - * - * # Errors - * - * If the index is not a soft derivation index (< 0x80000000) then - * calling this method will fail. - * - * # Security considerations - * - * * hard derivation index cannot be soft derived with the public key - * - * # Hard derivation vs Soft derivation - * - * If you pass an index below 0x80000000 then it is a soft derivation. - * The advantage of soft derivation is that it is possible to derive the - * public key too. I.e. derivation the private key with a soft derivation - * index and then retrieving the associated public key is equivalent to - * deriving the public key associated to the parent private key. - * - * Hard derivation index does not allow public key derivation. - * - * This is why deriving the private key should not fail while deriving - * the public key may fail (if the derivation index is invalid). - * @param {number} index - * @returns {Bip32PublicKey} - */ - derive(index: number): Bip32PublicKey; - - /** - * @returns {PublicKey} - */ - to_raw_key(): PublicKey; - - /** - * @param {Uint8Array} bytes - * @returns {Bip32PublicKey} - */ - static from_bytes(bytes: Uint8Array): Bip32PublicKey; - - /** - * @returns {Uint8Array} - */ - as_bytes(): Uint8Array; - - /** - * @param {string} bech32_str - * @returns {Bip32PublicKey} - */ - static from_bech32(bech32_str: string): Bip32PublicKey; - - /** - * @returns {string} - */ - to_bech32(): string; - - /** - * @returns {Uint8Array} - */ - chaincode(): Uint8Array; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {Bip32PublicKey} - */ - static from_hex(hex_str: string): Bip32PublicKey; -} -/** - */ -declare export class Block { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {Block} - */ - static from_bytes(bytes: Uint8Array): Block; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {Block} - */ - static from_hex(hex_str: string): Block; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {BlockJSON} - */ - to_js_value(): BlockJSON; - - /** - * @param {string} json - * @returns {Block} - */ - static from_json(json: string): Block; - - /** - * @returns {Header} - */ - header(): Header; - - /** - * @returns {TransactionBodies} - */ - transaction_bodies(): TransactionBodies; - - /** - * @returns {TransactionWitnessSets} - */ - transaction_witness_sets(): TransactionWitnessSets; - - /** - * @returns {AuxiliaryDataSet} - */ - auxiliary_data_set(): AuxiliaryDataSet; - - /** - * @returns {Uint32Array} - */ - invalid_transactions(): Uint32Array; - - /** - * @param {Header} header - * @param {TransactionBodies} transaction_bodies - * @param {TransactionWitnessSets} transaction_witness_sets - * @param {AuxiliaryDataSet} auxiliary_data_set - * @param {Uint32Array} invalid_transactions - * @returns {Block} - */ - static new( - header: Header, - transaction_bodies: TransactionBodies, - transaction_witness_sets: TransactionWitnessSets, - auxiliary_data_set: AuxiliaryDataSet, - invalid_transactions: Uint32Array - ): Block; -} -/** - */ -declare export class BlockHash { - free(): void; - - /** - * @param {Uint8Array} bytes - * @returns {BlockHash} - */ - static from_bytes(bytes: Uint8Array): BlockHash; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {string} prefix - * @returns {string} - */ - to_bech32(prefix: string): string; - - /** - * @param {string} bech_str - * @returns {BlockHash} - */ - static from_bech32(bech_str: string): BlockHash; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex - * @returns {BlockHash} - */ - static from_hex(hex: string): BlockHash; -} -/** - */ -declare export class BootstrapWitness { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {BootstrapWitness} - */ - static from_bytes(bytes: Uint8Array): BootstrapWitness; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {BootstrapWitness} - */ - static from_hex(hex_str: string): BootstrapWitness; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {BootstrapWitnessJSON} - */ - to_js_value(): BootstrapWitnessJSON; - - /** - * @param {string} json - * @returns {BootstrapWitness} - */ - static from_json(json: string): BootstrapWitness; - - /** - * @returns {Vkey} - */ - vkey(): Vkey; - - /** - * @returns {Ed25519Signature} - */ - signature(): Ed25519Signature; - - /** - * @returns {Uint8Array} - */ - chain_code(): Uint8Array; - - /** - * @returns {Uint8Array} - */ - attributes(): Uint8Array; - - /** - * @param {Vkey} vkey - * @param {Ed25519Signature} signature - * @param {Uint8Array} chain_code - * @param {Uint8Array} attributes - * @returns {BootstrapWitness} - */ - static new( - vkey: Vkey, - signature: Ed25519Signature, - chain_code: Uint8Array, - attributes: Uint8Array - ): BootstrapWitness; -} -/** - */ -declare export class BootstrapWitnesses { - free(): void; - - /** - * @returns {BootstrapWitnesses} - */ - static new(): BootstrapWitnesses; - - /** - * @returns {number} - */ - len(): number; - - /** - * @param {number} index - * @returns {BootstrapWitness} - */ - get(index: number): BootstrapWitness; - - /** - * @param {BootstrapWitness} elem - */ - add(elem: BootstrapWitness): void; -} -/** - */ -declare export class ByronAddress { - free(): void; - - /** - * @returns {string} - */ - to_base58(): string; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {ByronAddress} - */ - static from_bytes(bytes: Uint8Array): ByronAddress; - - /** - * returns the byron protocol magic embedded in the address, or mainnet id if none is present - * note: for bech32 addresses, you need to use network_id instead - * @returns {number} - */ - byron_protocol_magic(): number; - - /** - * @returns {Uint8Array} - */ - attributes(): Uint8Array; - - /** - * @returns {number} - */ - network_id(): number; - - /** - * @param {string} s - * @returns {ByronAddress} - */ - static from_base58(s: string): ByronAddress; - - /** - * @param {Bip32PublicKey} key - * @param {number} protocol_magic - * @returns {ByronAddress} - */ - static icarus_from_key( - key: Bip32PublicKey, - protocol_magic: number - ): ByronAddress; - - /** - * @param {string} s - * @returns {boolean} - */ - static is_valid(s: string): boolean; - - /** - * @returns {Address} - */ - to_address(): Address; - - /** - * @param {Address} addr - * @returns {ByronAddress | void} - */ - static from_address(addr: Address): ByronAddress | void; -} -/** - */ -declare export class Certificate { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {Certificate} - */ - static from_bytes(bytes: Uint8Array): Certificate; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {Certificate} - */ - static from_hex(hex_str: string): Certificate; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {CertificateJSON} - */ - to_js_value(): CertificateJSON; - - /** - * @param {string} json - * @returns {Certificate} - */ - static from_json(json: string): Certificate; - - /** - * @param {StakeRegistration} stake_registration - * @returns {Certificate} - */ - static new_stake_registration( - stake_registration: StakeRegistration - ): Certificate; - - /** - * @param {StakeDeregistration} stake_deregistration - * @returns {Certificate} - */ - static new_stake_deregistration( - stake_deregistration: StakeDeregistration - ): Certificate; - - /** - * @param {StakeDelegation} stake_delegation - * @returns {Certificate} - */ - static new_stake_delegation(stake_delegation: StakeDelegation): Certificate; - - /** - * @param {PoolRegistration} pool_registration - * @returns {Certificate} - */ - static new_pool_registration( - pool_registration: PoolRegistration - ): Certificate; - - /** - * @param {PoolRetirement} pool_retirement - * @returns {Certificate} - */ - static new_pool_retirement(pool_retirement: PoolRetirement): Certificate; - - /** - * @param {GenesisKeyDelegation} genesis_key_delegation - * @returns {Certificate} - */ - static new_genesis_key_delegation( - genesis_key_delegation: GenesisKeyDelegation - ): Certificate; - - /** - * @param {MoveInstantaneousRewardsCert} move_instantaneous_rewards_cert - * @returns {Certificate} - */ - static new_move_instantaneous_rewards_cert( - move_instantaneous_rewards_cert: MoveInstantaneousRewardsCert - ): Certificate; - - /** - * @returns {number} - */ - kind(): number; - - /** - * @returns {StakeRegistration | void} - */ - as_stake_registration(): StakeRegistration | void; - - /** - * @returns {StakeDeregistration | void} - */ - as_stake_deregistration(): StakeDeregistration | void; - - /** - * @returns {StakeDelegation | void} - */ - as_stake_delegation(): StakeDelegation | void; - - /** - * @returns {PoolRegistration | void} - */ - as_pool_registration(): PoolRegistration | void; - - /** - * @returns {PoolRetirement | void} - */ - as_pool_retirement(): PoolRetirement | void; - - /** - * @returns {GenesisKeyDelegation | void} - */ - as_genesis_key_delegation(): GenesisKeyDelegation | void; - - /** - * @returns {MoveInstantaneousRewardsCert | void} - */ - as_move_instantaneous_rewards_cert(): MoveInstantaneousRewardsCert | void; -} -/** - */ -declare export class Certificates { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {Certificates} - */ - static from_bytes(bytes: Uint8Array): Certificates; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {Certificates} - */ - static from_hex(hex_str: string): Certificates; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {CertificatesJSON} - */ - to_js_value(): CertificatesJSON; - - /** - * @param {string} json - * @returns {Certificates} - */ - static from_json(json: string): Certificates; - - /** - * @returns {Certificates} - */ - static new(): Certificates; - - /** - * @returns {number} - */ - len(): number; - - /** - * @param {number} index - * @returns {Certificate} - */ - get(index: number): Certificate; - - /** - * @param {Certificate} elem - */ - add(elem: Certificate): void; -} -/** - */ -declare export class ConstrPlutusData { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {ConstrPlutusData} - */ - static from_bytes(bytes: Uint8Array): ConstrPlutusData; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {ConstrPlutusData} - */ - static from_hex(hex_str: string): ConstrPlutusData; - - /** - * @returns {BigNum} - */ - alternative(): BigNum; - - /** - * @returns {PlutusList} - */ - data(): PlutusList; - - /** - * @param {BigNum} alternative - * @param {PlutusList} data - * @returns {ConstrPlutusData} - */ - static new(alternative: BigNum, data: PlutusList): ConstrPlutusData; -} -/** - */ -declare export class CostModel { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {CostModel} - */ - static from_bytes(bytes: Uint8Array): CostModel; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {CostModel} - */ - static from_hex(hex_str: string): CostModel; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {CostModelJSON} - */ - to_js_value(): CostModelJSON; - - /** - * @param {string} json - * @returns {CostModel} - */ - static from_json(json: string): CostModel; - - /** - * Creates a new CostModels instance of an unrestricted length - * @returns {CostModel} - */ - static new(): CostModel; - - /** - * Sets the cost at the specified index to the specified value. - * In case the operation index is larger than the previous largest used index, - * it will fill any inbetween indexes with zeroes - * @param {number} operation - * @param {Int} cost - * @returns {Int} - */ - set(operation: number, cost: Int): Int; - - /** - * @param {number} operation - * @returns {Int} - */ - get(operation: number): Int; - - /** - * @returns {number} - */ - len(): number; -} -/** - */ -declare export class Costmdls { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {Costmdls} - */ - static from_bytes(bytes: Uint8Array): Costmdls; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {Costmdls} - */ - static from_hex(hex_str: string): Costmdls; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {CostmdlsJSON} - */ - to_js_value(): CostmdlsJSON; - - /** - * @param {string} json - * @returns {Costmdls} - */ - static from_json(json: string): Costmdls; - - /** - * @returns {Costmdls} - */ - static new(): Costmdls; - - /** - * @returns {number} - */ - len(): number; - - /** - * @param {Language} key - * @param {CostModel} value - * @returns {CostModel | void} - */ - insert(key: Language, value: CostModel): CostModel | void; - - /** - * @param {Language} key - * @returns {CostModel | void} - */ - get(key: Language): CostModel | void; - - /** - * @returns {Languages} - */ - keys(): Languages; - - /** - * @param {Languages} languages - * @returns {Costmdls} - */ - retain_language_versions(languages: Languages): Costmdls; -} -/** - */ -declare export class DNSRecordAorAAAA { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {DNSRecordAorAAAA} - */ - static from_bytes(bytes: Uint8Array): DNSRecordAorAAAA; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {DNSRecordAorAAAA} - */ - static from_hex(hex_str: string): DNSRecordAorAAAA; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {DNSRecordAorAAAAJSON} - */ - to_js_value(): DNSRecordAorAAAAJSON; - - /** - * @param {string} json - * @returns {DNSRecordAorAAAA} - */ - static from_json(json: string): DNSRecordAorAAAA; - - /** - * @param {string} dns_name - * @returns {DNSRecordAorAAAA} - */ - static new(dns_name: string): DNSRecordAorAAAA; - - /** - * @returns {string} - */ - record(): string; -} -/** - */ -declare export class DNSRecordSRV { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {DNSRecordSRV} - */ - static from_bytes(bytes: Uint8Array): DNSRecordSRV; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {DNSRecordSRV} - */ - static from_hex(hex_str: string): DNSRecordSRV; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {DNSRecordSRVJSON} - */ - to_js_value(): DNSRecordSRVJSON; - - /** - * @param {string} json - * @returns {DNSRecordSRV} - */ - static from_json(json: string): DNSRecordSRV; - - /** - * @param {string} dns_name - * @returns {DNSRecordSRV} - */ - static new(dns_name: string): DNSRecordSRV; - - /** - * @returns {string} - */ - record(): string; -} -/** - */ -declare export class DataCost { - free(): void; - - /** - * !!! DEPRECATED !!! - * Since babbage era we should use coins per byte. Use `.new_coins_per_byte` instead. - * @param {BigNum} coins_per_word - * @returns {DataCost} - */ - static new_coins_per_word(coins_per_word: BigNum): DataCost; - - /** - * @param {BigNum} coins_per_byte - * @returns {DataCost} - */ - static new_coins_per_byte(coins_per_byte: BigNum): DataCost; - - /** - * @returns {BigNum} - */ - coins_per_byte(): BigNum; -} -/** - */ -declare export class DataHash { - free(): void; - - /** - * @param {Uint8Array} bytes - * @returns {DataHash} - */ - static from_bytes(bytes: Uint8Array): DataHash; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {string} prefix - * @returns {string} - */ - to_bech32(prefix: string): string; - - /** - * @param {string} bech_str - * @returns {DataHash} - */ - static from_bech32(bech_str: string): DataHash; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex - * @returns {DataHash} - */ - static from_hex(hex: string): DataHash; -} -/** - */ -declare export class DatumSource { - free(): void; - - /** - * @param {PlutusData} datum - * @returns {DatumSource} - */ - static new(datum: PlutusData): DatumSource; - - /** - * @param {TransactionInput} input - * @returns {DatumSource} - */ - static new_ref_input(input: TransactionInput): DatumSource; -} -/** - */ -declare export class Ed25519KeyHash { - free(): void; - - /** - * @param {Uint8Array} bytes - * @returns {Ed25519KeyHash} - */ - static from_bytes(bytes: Uint8Array): Ed25519KeyHash; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {string} prefix - * @returns {string} - */ - to_bech32(prefix: string): string; - - /** - * @param {string} bech_str - * @returns {Ed25519KeyHash} - */ - static from_bech32(bech_str: string): Ed25519KeyHash; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex - * @returns {Ed25519KeyHash} - */ - static from_hex(hex: string): Ed25519KeyHash; -} -/** - */ -declare export class Ed25519KeyHashes { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {Ed25519KeyHashes} - */ - static from_bytes(bytes: Uint8Array): Ed25519KeyHashes; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {Ed25519KeyHashes} - */ - static from_hex(hex_str: string): Ed25519KeyHashes; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {Ed25519KeyHashesJSON} - */ - to_js_value(): Ed25519KeyHashesJSON; - - /** - * @param {string} json - * @returns {Ed25519KeyHashes} - */ - static from_json(json: string): Ed25519KeyHashes; - - /** - * @returns {Ed25519KeyHashes} - */ - static new(): Ed25519KeyHashes; - - /** - * @returns {number} - */ - len(): number; - - /** - * @param {number} index - * @returns {Ed25519KeyHash} - */ - get(index: number): Ed25519KeyHash; - - /** - * @param {Ed25519KeyHash} elem - */ - add(elem: Ed25519KeyHash): void; - - /** - * @returns {Ed25519KeyHashes | void} - */ - to_option(): Ed25519KeyHashes | void; -} -/** - */ -declare export class Ed25519Signature { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @returns {string} - */ - to_bech32(): string; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} bech32_str - * @returns {Ed25519Signature} - */ - static from_bech32(bech32_str: string): Ed25519Signature; - - /** - * @param {string} input - * @returns {Ed25519Signature} - */ - static from_hex(input: string): Ed25519Signature; - - /** - * @param {Uint8Array} bytes - * @returns {Ed25519Signature} - */ - static from_bytes(bytes: Uint8Array): Ed25519Signature; -} -/** - */ -declare export class EnterpriseAddress { - free(): void; - - /** - * @param {number} network - * @param {StakeCredential} payment - * @returns {EnterpriseAddress} - */ - static new(network: number, payment: StakeCredential): EnterpriseAddress; - - /** - * @returns {StakeCredential} - */ - payment_cred(): StakeCredential; - - /** - * @returns {Address} - */ - to_address(): Address; - - /** - * @param {Address} addr - * @returns {EnterpriseAddress | void} - */ - static from_address(addr: Address): EnterpriseAddress | void; -} -/** - */ -declare export class ExUnitPrices { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {ExUnitPrices} - */ - static from_bytes(bytes: Uint8Array): ExUnitPrices; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {ExUnitPrices} - */ - static from_hex(hex_str: string): ExUnitPrices; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {ExUnitPricesJSON} - */ - to_js_value(): ExUnitPricesJSON; - - /** - * @param {string} json - * @returns {ExUnitPrices} - */ - static from_json(json: string): ExUnitPrices; - - /** - * @returns {UnitInterval} - */ - mem_price(): UnitInterval; - - /** - * @returns {UnitInterval} - */ - step_price(): UnitInterval; - - /** - * @param {UnitInterval} mem_price - * @param {UnitInterval} step_price - * @returns {ExUnitPrices} - */ - static new(mem_price: UnitInterval, step_price: UnitInterval): ExUnitPrices; -} -/** - */ -declare export class ExUnits { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {ExUnits} - */ - static from_bytes(bytes: Uint8Array): ExUnits; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {ExUnits} - */ - static from_hex(hex_str: string): ExUnits; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {ExUnitsJSON} - */ - to_js_value(): ExUnitsJSON; - - /** - * @param {string} json - * @returns {ExUnits} - */ - static from_json(json: string): ExUnits; - - /** - * @returns {BigNum} - */ - mem(): BigNum; - - /** - * @returns {BigNum} - */ - steps(): BigNum; - - /** - * @param {BigNum} mem - * @param {BigNum} steps - * @returns {ExUnits} - */ - static new(mem: BigNum, steps: BigNum): ExUnits; -} -/** - */ -declare export class GeneralTransactionMetadata { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {GeneralTransactionMetadata} - */ - static from_bytes(bytes: Uint8Array): GeneralTransactionMetadata; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {GeneralTransactionMetadata} - */ - static from_hex(hex_str: string): GeneralTransactionMetadata; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {GeneralTransactionMetadataJSON} - */ - to_js_value(): GeneralTransactionMetadataJSON; - - /** - * @param {string} json - * @returns {GeneralTransactionMetadata} - */ - static from_json(json: string): GeneralTransactionMetadata; - - /** - * @returns {GeneralTransactionMetadata} - */ - static new(): GeneralTransactionMetadata; - - /** - * @returns {number} - */ - len(): number; - - /** - * @param {BigNum} key - * @param {TransactionMetadatum} value - * @returns {TransactionMetadatum | void} - */ - insert(key: BigNum, value: TransactionMetadatum): TransactionMetadatum | void; - - /** - * @param {BigNum} key - * @returns {TransactionMetadatum | void} - */ - get(key: BigNum): TransactionMetadatum | void; - - /** - * @returns {TransactionMetadatumLabels} - */ - keys(): TransactionMetadatumLabels; -} -/** - */ -declare export class GenesisDelegateHash { - free(): void; - - /** - * @param {Uint8Array} bytes - * @returns {GenesisDelegateHash} - */ - static from_bytes(bytes: Uint8Array): GenesisDelegateHash; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {string} prefix - * @returns {string} - */ - to_bech32(prefix: string): string; - - /** - * @param {string} bech_str - * @returns {GenesisDelegateHash} - */ - static from_bech32(bech_str: string): GenesisDelegateHash; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex - * @returns {GenesisDelegateHash} - */ - static from_hex(hex: string): GenesisDelegateHash; -} -/** - */ -declare export class GenesisHash { - free(): void; - - /** - * @param {Uint8Array} bytes - * @returns {GenesisHash} - */ - static from_bytes(bytes: Uint8Array): GenesisHash; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {string} prefix - * @returns {string} - */ - to_bech32(prefix: string): string; - - /** - * @param {string} bech_str - * @returns {GenesisHash} - */ - static from_bech32(bech_str: string): GenesisHash; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex - * @returns {GenesisHash} - */ - static from_hex(hex: string): GenesisHash; -} -/** - */ -declare export class GenesisHashes { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {GenesisHashes} - */ - static from_bytes(bytes: Uint8Array): GenesisHashes; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {GenesisHashes} - */ - static from_hex(hex_str: string): GenesisHashes; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {GenesisHashesJSON} - */ - to_js_value(): GenesisHashesJSON; - - /** - * @param {string} json - * @returns {GenesisHashes} - */ - static from_json(json: string): GenesisHashes; - - /** - * @returns {GenesisHashes} - */ - static new(): GenesisHashes; - - /** - * @returns {number} - */ - len(): number; - - /** - * @param {number} index - * @returns {GenesisHash} - */ - get(index: number): GenesisHash; - - /** - * @param {GenesisHash} elem - */ - add(elem: GenesisHash): void; -} -/** - */ -declare export class GenesisKeyDelegation { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {GenesisKeyDelegation} - */ - static from_bytes(bytes: Uint8Array): GenesisKeyDelegation; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {GenesisKeyDelegation} - */ - static from_hex(hex_str: string): GenesisKeyDelegation; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {GenesisKeyDelegationJSON} - */ - to_js_value(): GenesisKeyDelegationJSON; - - /** - * @param {string} json - * @returns {GenesisKeyDelegation} - */ - static from_json(json: string): GenesisKeyDelegation; - - /** - * @returns {GenesisHash} - */ - genesishash(): GenesisHash; - - /** - * @returns {GenesisDelegateHash} - */ - genesis_delegate_hash(): GenesisDelegateHash; - - /** - * @returns {VRFKeyHash} - */ - vrf_keyhash(): VRFKeyHash; - - /** - * @param {GenesisHash} genesishash - * @param {GenesisDelegateHash} genesis_delegate_hash - * @param {VRFKeyHash} vrf_keyhash - * @returns {GenesisKeyDelegation} - */ - static new( - genesishash: GenesisHash, - genesis_delegate_hash: GenesisDelegateHash, - vrf_keyhash: VRFKeyHash - ): GenesisKeyDelegation; -} -/** - */ -declare export class Header { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {Header} - */ - static from_bytes(bytes: Uint8Array): Header; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {Header} - */ - static from_hex(hex_str: string): Header; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {HeaderJSON} - */ - to_js_value(): HeaderJSON; - - /** - * @param {string} json - * @returns {Header} - */ - static from_json(json: string): Header; - - /** - * @returns {HeaderBody} - */ - header_body(): HeaderBody; - - /** - * @returns {KESSignature} - */ - body_signature(): KESSignature; - - /** - * @param {HeaderBody} header_body - * @param {KESSignature} body_signature - * @returns {Header} - */ - static new(header_body: HeaderBody, body_signature: KESSignature): Header; -} -/** - */ -declare export class HeaderBody { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {HeaderBody} - */ - static from_bytes(bytes: Uint8Array): HeaderBody; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {HeaderBody} - */ - static from_hex(hex_str: string): HeaderBody; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {HeaderBodyJSON} - */ - to_js_value(): HeaderBodyJSON; - - /** - * @param {string} json - * @returns {HeaderBody} - */ - static from_json(json: string): HeaderBody; - - /** - * @returns {number} - */ - block_number(): number; - - /** - * !!! DEPRECATED !!! - * Returns a Slot32 (u32) value in case the underlying original BigNum (u64) value is within the limits. - * Otherwise will just raise an error. - * @returns {number} - */ - slot(): number; - - /** - * @returns {BigNum} - */ - slot_bignum(): BigNum; - - /** - * @returns {BlockHash | void} - */ - prev_hash(): BlockHash | void; - - /** - * @returns {Vkey} - */ - issuer_vkey(): Vkey; - - /** - * @returns {VRFVKey} - */ - vrf_vkey(): VRFVKey; - - /** - * If this function returns true, the `.nonce_vrf_or_nothing` - * and the `.leader_vrf_or_nothing` functions will return - * non-empty results - * @returns {boolean} - */ - has_nonce_and_leader_vrf(): boolean; - - /** - * Might return nothing in case `.has_nonce_and_leader_vrf` returns false - * @returns {VRFCert | void} - */ - nonce_vrf_or_nothing(): VRFCert | void; - - /** - * Might return nothing in case `.has_nonce_and_leader_vrf` returns false - * @returns {VRFCert | void} - */ - leader_vrf_or_nothing(): VRFCert | void; - - /** - * If this function returns true, the `.vrf_result_or_nothing` - * function will return a non-empty result - * @returns {boolean} - */ - has_vrf_result(): boolean; - - /** - * Might return nothing in case `.has_vrf_result` returns false - * @returns {VRFCert | void} - */ - vrf_result_or_nothing(): VRFCert | void; - - /** - * @returns {number} - */ - block_body_size(): number; - - /** - * @returns {BlockHash} - */ - block_body_hash(): BlockHash; - - /** - * @returns {OperationalCert} - */ - operational_cert(): OperationalCert; - - /** - * @returns {ProtocolVersion} - */ - protocol_version(): ProtocolVersion; - - /** - * !!! DEPRECATED !!! - * This constructor uses outdated slot number format. - * Use `.new_headerbody` instead - * @param {number} block_number - * @param {number} slot - * @param {BlockHash | void} prev_hash - * @param {Vkey} issuer_vkey - * @param {VRFVKey} vrf_vkey - * @param {VRFCert} vrf_result - * @param {number} block_body_size - * @param {BlockHash} block_body_hash - * @param {OperationalCert} operational_cert - * @param {ProtocolVersion} protocol_version - * @returns {HeaderBody} - */ - static new( - block_number: number, - slot: number, - prev_hash: BlockHash | void, - issuer_vkey: Vkey, - vrf_vkey: VRFVKey, - vrf_result: VRFCert, - block_body_size: number, - block_body_hash: BlockHash, - operational_cert: OperationalCert, - protocol_version: ProtocolVersion - ): HeaderBody; - - /** - * @param {number} block_number - * @param {BigNum} slot - * @param {BlockHash | void} prev_hash - * @param {Vkey} issuer_vkey - * @param {VRFVKey} vrf_vkey - * @param {VRFCert} vrf_result - * @param {number} block_body_size - * @param {BlockHash} block_body_hash - * @param {OperationalCert} operational_cert - * @param {ProtocolVersion} protocol_version - * @returns {HeaderBody} - */ - static new_headerbody( - block_number: number, - slot: BigNum, - prev_hash: BlockHash | void, - issuer_vkey: Vkey, - vrf_vkey: VRFVKey, - vrf_result: VRFCert, - block_body_size: number, - block_body_hash: BlockHash, - operational_cert: OperationalCert, - protocol_version: ProtocolVersion - ): HeaderBody; -} -/** - */ -declare export class Int { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {Int} - */ - static from_bytes(bytes: Uint8Array): Int; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {Int} - */ - static from_hex(hex_str: string): Int; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {IntJSON} - */ - to_js_value(): IntJSON; - - /** - * @param {string} json - * @returns {Int} - */ - static from_json(json: string): Int; - - /** - * @param {BigNum} x - * @returns {Int} - */ - static new(x: BigNum): Int; - - /** - * @param {BigNum} x - * @returns {Int} - */ - static new_negative(x: BigNum): Int; - - /** - * @param {number} x - * @returns {Int} - */ - static new_i32(x: number): Int; - - /** - * @returns {boolean} - */ - is_positive(): boolean; - - /** - * BigNum can only contain unsigned u64 values - * - * This function will return the BigNum representation - * only in case the underlying i128 value is positive. - * - * Otherwise nothing will be returned (undefined). - * @returns {BigNum | void} - */ - as_positive(): BigNum | void; - - /** - * BigNum can only contain unsigned u64 values - * - * This function will return the *absolute* BigNum representation - * only in case the underlying i128 value is negative. - * - * Otherwise nothing will be returned (undefined). - * @returns {BigNum | void} - */ - as_negative(): BigNum | void; - - /** - * !!! DEPRECATED !!! - * Returns an i32 value in case the underlying original i128 value is within the limits. - * Otherwise will just return an empty value (undefined). - * @returns {number | void} - */ - as_i32(): number | void; - - /** - * Returns the underlying value converted to i32 if possible (within limits) - * Otherwise will just return an empty value (undefined). - * @returns {number | void} - */ - as_i32_or_nothing(): number | void; - - /** - * Returns the underlying value converted to i32 if possible (within limits) - * JsError in case of out of boundary overflow - * @returns {number} - */ - as_i32_or_fail(): number; - - /** - * Returns string representation of the underlying i128 value directly. - * Might contain the minus sign (-) in case of negative value. - * @returns {string} - */ - to_str(): string; - - /** - * @param {string} string - * @returns {Int} - */ - static from_str(string: string): Int; -} -/** - */ -declare export class Ipv4 { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {Ipv4} - */ - static from_bytes(bytes: Uint8Array): Ipv4; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {Ipv4} - */ - static from_hex(hex_str: string): Ipv4; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {Ipv4JSON} - */ - to_js_value(): Ipv4JSON; - - /** - * @param {string} json - * @returns {Ipv4} - */ - static from_json(json: string): Ipv4; - - /** - * @param {Uint8Array} data - * @returns {Ipv4} - */ - static new(data: Uint8Array): Ipv4; - - /** - * @returns {Uint8Array} - */ - ip(): Uint8Array; -} -/** - */ -declare export class Ipv6 { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {Ipv6} - */ - static from_bytes(bytes: Uint8Array): Ipv6; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {Ipv6} - */ - static from_hex(hex_str: string): Ipv6; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {Ipv6JSON} - */ - to_js_value(): Ipv6JSON; - - /** - * @param {string} json - * @returns {Ipv6} - */ - static from_json(json: string): Ipv6; - - /** - * @param {Uint8Array} data - * @returns {Ipv6} - */ - static new(data: Uint8Array): Ipv6; - - /** - * @returns {Uint8Array} - */ - ip(): Uint8Array; -} -/** - */ -declare export class KESSignature { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {KESSignature} - */ - static from_bytes(bytes: Uint8Array): KESSignature; -} -/** - */ -declare export class KESVKey { - free(): void; - - /** - * @param {Uint8Array} bytes - * @returns {KESVKey} - */ - static from_bytes(bytes: Uint8Array): KESVKey; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {string} prefix - * @returns {string} - */ - to_bech32(prefix: string): string; - - /** - * @param {string} bech_str - * @returns {KESVKey} - */ - static from_bech32(bech_str: string): KESVKey; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex - * @returns {KESVKey} - */ - static from_hex(hex: string): KESVKey; -} -/** - */ -declare export class Language { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {Language} - */ - static from_bytes(bytes: Uint8Array): Language; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {Language} - */ - static from_hex(hex_str: string): Language; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {LanguageJSON} - */ - to_js_value(): LanguageJSON; - - /** - * @param {string} json - * @returns {Language} - */ - static from_json(json: string): Language; - - /** - * @returns {Language} - */ - static new_plutus_v1(): Language; - - /** - * @returns {Language} - */ - static new_plutus_v2(): Language; - - /** - * @returns {Language} - */ - static new_plutus_v3(): Language; - - /** - * @returns {number} - */ - kind(): number; -} -/** - */ -declare export class Languages { - free(): void; - - /** - * @returns {Languages} - */ - static new(): Languages; - - /** - * @returns {number} - */ - len(): number; - - /** - * @param {number} index - * @returns {Language} - */ - get(index: number): Language; - - /** - * @param {Language} elem - */ - add(elem: Language): void; -} -/** - */ -declare export class LegacyDaedalusPrivateKey { - free(): void; - - /** - * @param {Uint8Array} bytes - * @returns {LegacyDaedalusPrivateKey} - */ - static from_bytes(bytes: Uint8Array): LegacyDaedalusPrivateKey; - - /** - * @returns {Uint8Array} - */ - as_bytes(): Uint8Array; - - /** - * @returns {Uint8Array} - */ - chaincode(): Uint8Array; -} -/** - */ -declare export class LinearFee { - free(): void; - - /** - * @returns {BigNum} - */ - constant(): BigNum; - - /** - * @returns {BigNum} - */ - coefficient(): BigNum; - - /** - * @param {BigNum} coefficient - * @param {BigNum} constant - * @returns {LinearFee} - */ - static new(coefficient: BigNum, constant: BigNum): LinearFee; -} -/** - */ -declare export class MIRToStakeCredentials { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {MIRToStakeCredentials} - */ - static from_bytes(bytes: Uint8Array): MIRToStakeCredentials; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {MIRToStakeCredentials} - */ - static from_hex(hex_str: string): MIRToStakeCredentials; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {MIRToStakeCredentialsJSON} - */ - to_js_value(): MIRToStakeCredentialsJSON; - - /** - * @param {string} json - * @returns {MIRToStakeCredentials} - */ - static from_json(json: string): MIRToStakeCredentials; - - /** - * @returns {MIRToStakeCredentials} - */ - static new(): MIRToStakeCredentials; - - /** - * @returns {number} - */ - len(): number; - - /** - * @param {StakeCredential} cred - * @param {Int} delta - * @returns {Int | void} - */ - insert(cred: StakeCredential, delta: Int): Int | void; - - /** - * @param {StakeCredential} cred - * @returns {Int | void} - */ - get(cred: StakeCredential): Int | void; - - /** - * @returns {StakeCredentials} - */ - keys(): StakeCredentials; -} -/** - */ -declare export class MetadataList { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {MetadataList} - */ - static from_bytes(bytes: Uint8Array): MetadataList; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {MetadataList} - */ - static from_hex(hex_str: string): MetadataList; - - /** - * @returns {MetadataList} - */ - static new(): MetadataList; - - /** - * @returns {number} - */ - len(): number; - - /** - * @param {number} index - * @returns {TransactionMetadatum} - */ - get(index: number): TransactionMetadatum; - - /** - * @param {TransactionMetadatum} elem - */ - add(elem: TransactionMetadatum): void; -} -/** - */ -declare export class MetadataMap { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {MetadataMap} - */ - static from_bytes(bytes: Uint8Array): MetadataMap; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {MetadataMap} - */ - static from_hex(hex_str: string): MetadataMap; - - /** - * @returns {MetadataMap} - */ - static new(): MetadataMap; - - /** - * @returns {number} - */ - len(): number; - - /** - * @param {TransactionMetadatum} key - * @param {TransactionMetadatum} value - * @returns {TransactionMetadatum | void} - */ - insert( - key: TransactionMetadatum, - value: TransactionMetadatum - ): TransactionMetadatum | void; - - /** - * @param {string} key - * @param {TransactionMetadatum} value - * @returns {TransactionMetadatum | void} - */ - insert_str( - key: string, - value: TransactionMetadatum - ): TransactionMetadatum | void; - - /** - * @param {number} key - * @param {TransactionMetadatum} value - * @returns {TransactionMetadatum | void} - */ - insert_i32( - key: number, - value: TransactionMetadatum - ): TransactionMetadatum | void; - - /** - * @param {TransactionMetadatum} key - * @returns {TransactionMetadatum} - */ - get(key: TransactionMetadatum): TransactionMetadatum; - - /** - * @param {string} key - * @returns {TransactionMetadatum} - */ - get_str(key: string): TransactionMetadatum; - - /** - * @param {number} key - * @returns {TransactionMetadatum} - */ - get_i32(key: number): TransactionMetadatum; - - /** - * @param {TransactionMetadatum} key - * @returns {boolean} - */ - has(key: TransactionMetadatum): boolean; - - /** - * @returns {MetadataList} - */ - keys(): MetadataList; -} -/** - */ -declare export class Mint { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {Mint} - */ - static from_bytes(bytes: Uint8Array): Mint; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {Mint} - */ - static from_hex(hex_str: string): Mint; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {MintJSON} - */ - to_js_value(): MintJSON; - - /** - * @param {string} json - * @returns {Mint} - */ - static from_json(json: string): Mint; - - /** - * @returns {Mint} - */ - static new(): Mint; - - /** - * @param {ScriptHash} key - * @param {MintAssets} value - * @returns {Mint} - */ - static new_from_entry(key: ScriptHash, value: MintAssets): Mint; - - /** - * @returns {number} - */ - len(): number; - - /** - * @param {ScriptHash} key - * @param {MintAssets} value - * @returns {MintAssets | void} - */ - insert(key: ScriptHash, value: MintAssets): MintAssets | void; - - /** - * @param {ScriptHash} key - * @returns {MintAssets | void} - */ - get(key: ScriptHash): MintAssets | void; - - /** - * @returns {ScriptHashes} - */ - keys(): ScriptHashes; - - /** - * Returns the multiasset where only positive (minting) entries are present - * @returns {MultiAsset} - */ - as_positive_multiasset(): MultiAsset; - - /** - * Returns the multiasset where only negative (burning) entries are present - * @returns {MultiAsset} - */ - as_negative_multiasset(): MultiAsset; -} -/** - */ -declare export class MintAssets { - free(): void; - - /** - * @returns {MintAssets} - */ - static new(): 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 MoveInstantaneousReward { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {MoveInstantaneousReward} - */ - static from_bytes(bytes: Uint8Array): MoveInstantaneousReward; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {MoveInstantaneousReward} - */ - static from_hex(hex_str: string): MoveInstantaneousReward; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {MoveInstantaneousRewardJSON} - */ - to_js_value(): MoveInstantaneousRewardJSON; - - /** - * @param {string} json - * @returns {MoveInstantaneousReward} - */ - static from_json(json: string): MoveInstantaneousReward; - - /** - * @param {number} pot - * @param {BigNum} amount - * @returns {MoveInstantaneousReward} - */ - static new_to_other_pot(pot: number, amount: BigNum): MoveInstantaneousReward; - - /** - * @param {number} pot - * @param {MIRToStakeCredentials} amounts - * @returns {MoveInstantaneousReward} - */ - static new_to_stake_creds( - pot: number, - amounts: MIRToStakeCredentials - ): MoveInstantaneousReward; - - /** - * @returns {number} - */ - pot(): number; - - /** - * @returns {number} - */ - kind(): number; - - /** - * @returns {BigNum | void} - */ - as_to_other_pot(): BigNum | void; - - /** - * @returns {MIRToStakeCredentials | void} - */ - as_to_stake_creds(): MIRToStakeCredentials | void; -} -/** - */ -declare export class MoveInstantaneousRewardsCert { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {MoveInstantaneousRewardsCert} - */ - static from_bytes(bytes: Uint8Array): MoveInstantaneousRewardsCert; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {MoveInstantaneousRewardsCert} - */ - static from_hex(hex_str: string): MoveInstantaneousRewardsCert; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {MoveInstantaneousRewardsCertJSON} - */ - to_js_value(): MoveInstantaneousRewardsCertJSON; - - /** - * @param {string} json - * @returns {MoveInstantaneousRewardsCert} - */ - static from_json(json: string): MoveInstantaneousRewardsCert; - - /** - * @returns {MoveInstantaneousReward} - */ - move_instantaneous_reward(): MoveInstantaneousReward; - - /** - * @param {MoveInstantaneousReward} move_instantaneous_reward - * @returns {MoveInstantaneousRewardsCert} - */ - static new( - move_instantaneous_reward: MoveInstantaneousReward - ): MoveInstantaneousRewardsCert; -} -/** - */ -declare export class MultiAsset { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {MultiAsset} - */ - static from_bytes(bytes: Uint8Array): MultiAsset; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {MultiAsset} - */ - static from_hex(hex_str: string): MultiAsset; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {MultiAssetJSON} - */ - to_js_value(): MultiAssetJSON; - - /** - * @param {string} json - * @returns {MultiAsset} - */ - static from_json(json: string): MultiAsset; - - /** - * @returns {MultiAsset} - */ - static new(): MultiAsset; - - /** - * the number of unique policy IDs in the multiasset - * @returns {number} - */ - len(): number; - - /** - * set (and replace if it exists) all assets with policy {policy_id} to a copy of {assets} - * @param {ScriptHash} policy_id - * @param {Assets} assets - * @returns {Assets | void} - */ - insert(policy_id: ScriptHash, assets: Assets): Assets | void; - - /** - * all assets under {policy_id}, if any exist, or else None (undefined in JS) - * @param {ScriptHash} policy_id - * @returns {Assets | void} - */ - get(policy_id: ScriptHash): Assets | void; - - /** - * sets the asset {asset_name} to {value} under policy {policy_id} - * returns the previous amount if it was set, or else None (undefined in JS) - * @param {ScriptHash} policy_id - * @param {AssetName} asset_name - * @param {BigNum} value - * @returns {BigNum | void} - */ - set_asset( - policy_id: ScriptHash, - asset_name: AssetName, - value: BigNum - ): BigNum | void; - - /** - * returns the amount of asset {asset_name} under policy {policy_id} - * If such an asset does not exist, 0 is returned. - * @param {ScriptHash} policy_id - * @param {AssetName} asset_name - * @returns {BigNum} - */ - get_asset(policy_id: ScriptHash, asset_name: AssetName): BigNum; - - /** - * returns all policy IDs used by assets in this multiasset - * @returns {ScriptHashes} - */ - keys(): ScriptHashes; - - /** - * removes an asset from the list if the result is 0 or less - * does not modify this object, instead the result is returned - * @param {MultiAsset} rhs_ma - * @returns {MultiAsset} - */ - sub(rhs_ma: MultiAsset): MultiAsset; -} -/** - */ -declare export class MultiHostName { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {MultiHostName} - */ - static from_bytes(bytes: Uint8Array): MultiHostName; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {MultiHostName} - */ - static from_hex(hex_str: string): MultiHostName; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {MultiHostNameJSON} - */ - to_js_value(): MultiHostNameJSON; - - /** - * @param {string} json - * @returns {MultiHostName} - */ - static from_json(json: string): MultiHostName; - - /** - * @returns {DNSRecordSRV} - */ - dns_name(): DNSRecordSRV; - - /** - * @param {DNSRecordSRV} dns_name - * @returns {MultiHostName} - */ - static new(dns_name: DNSRecordSRV): MultiHostName; -} -/** - */ -declare export class NativeScript { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {NativeScript} - */ - static from_bytes(bytes: Uint8Array): NativeScript; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {NativeScript} - */ - static from_hex(hex_str: string): NativeScript; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {NativeScriptJSON} - */ - to_js_value(): NativeScriptJSON; - - /** - * @param {string} json - * @returns {NativeScript} - */ - static from_json(json: string): NativeScript; - - /** - * @returns {ScriptHash} - */ - hash(): ScriptHash; - - /** - * @param {ScriptPubkey} script_pubkey - * @returns {NativeScript} - */ - static new_script_pubkey(script_pubkey: ScriptPubkey): NativeScript; - - /** - * @param {ScriptAll} script_all - * @returns {NativeScript} - */ - static new_script_all(script_all: ScriptAll): NativeScript; - - /** - * @param {ScriptAny} script_any - * @returns {NativeScript} - */ - static new_script_any(script_any: ScriptAny): NativeScript; - - /** - * @param {ScriptNOfK} script_n_of_k - * @returns {NativeScript} - */ - static new_script_n_of_k(script_n_of_k: ScriptNOfK): NativeScript; - - /** - * @param {TimelockStart} timelock_start - * @returns {NativeScript} - */ - static new_timelock_start(timelock_start: TimelockStart): NativeScript; - - /** - * @param {TimelockExpiry} timelock_expiry - * @returns {NativeScript} - */ - static new_timelock_expiry(timelock_expiry: TimelockExpiry): NativeScript; - - /** - * @returns {number} - */ - kind(): number; - - /** - * @returns {ScriptPubkey | void} - */ - as_script_pubkey(): ScriptPubkey | void; - - /** - * @returns {ScriptAll | void} - */ - as_script_all(): ScriptAll | void; - - /** - * @returns {ScriptAny | void} - */ - as_script_any(): ScriptAny | void; - - /** - * @returns {ScriptNOfK | void} - */ - as_script_n_of_k(): ScriptNOfK | void; - - /** - * @returns {TimelockStart | void} - */ - as_timelock_start(): TimelockStart | void; - - /** - * @returns {TimelockExpiry | void} - */ - as_timelock_expiry(): TimelockExpiry | void; - - /** - * Returns an array of unique Ed25519KeyHashes - * contained within this script recursively on any depth level. - * The order of the keys in the result is not determined in any way. - * @returns {Ed25519KeyHashes} - */ - get_required_signers(): Ed25519KeyHashes; -} -/** - */ -declare export class NativeScripts { - free(): void; - - /** - * @returns {NativeScripts} - */ - static new(): NativeScripts; - - /** - * @returns {number} - */ - len(): number; - - /** - * @param {number} index - * @returns {NativeScript} - */ - get(index: number): NativeScript; - - /** - * @param {NativeScript} elem - */ - add(elem: NativeScript): void; -} -/** - */ -declare export class NetworkId { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {NetworkId} - */ - static from_bytes(bytes: Uint8Array): NetworkId; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {NetworkId} - */ - static from_hex(hex_str: string): NetworkId; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {NetworkIdJSON} - */ - to_js_value(): NetworkIdJSON; - - /** - * @param {string} json - * @returns {NetworkId} - */ - static from_json(json: string): NetworkId; - - /** - * @returns {NetworkId} - */ - static testnet(): NetworkId; - - /** - * @returns {NetworkId} - */ - static mainnet(): NetworkId; - - /** - * @returns {number} - */ - kind(): number; -} -/** - */ -declare export class NetworkInfo { - free(): void; - - /** - * @param {number} network_id - * @param {number} protocol_magic - * @returns {NetworkInfo} - */ - static new(network_id: number, protocol_magic: number): NetworkInfo; - - /** - * @returns {number} - */ - network_id(): number; - - /** - * @returns {number} - */ - protocol_magic(): number; - - /** - * @returns {NetworkInfo} - */ - static testnet(): NetworkInfo; - - /** - * @returns {NetworkInfo} - */ - static mainnet(): NetworkInfo; -} -/** - */ -declare export class Nonce { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {Nonce} - */ - static from_bytes(bytes: Uint8Array): Nonce; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {Nonce} - */ - static from_hex(hex_str: string): Nonce; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {NonceJSON} - */ - to_js_value(): NonceJSON; - - /** - * @param {string} json - * @returns {Nonce} - */ - static from_json(json: string): Nonce; - - /** - * @returns {Nonce} - */ - static new_identity(): Nonce; - - /** - * @param {Uint8Array} hash - * @returns {Nonce} - */ - static new_from_hash(hash: Uint8Array): Nonce; - - /** - * @returns {Uint8Array | void} - */ - get_hash(): Uint8Array | void; -} -/** - */ -declare export class OperationalCert { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {OperationalCert} - */ - static from_bytes(bytes: Uint8Array): OperationalCert; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {OperationalCert} - */ - static from_hex(hex_str: string): OperationalCert; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {OperationalCertJSON} - */ - to_js_value(): OperationalCertJSON; - - /** - * @param {string} json - * @returns {OperationalCert} - */ - static from_json(json: string): OperationalCert; - - /** - * @returns {KESVKey} - */ - hot_vkey(): KESVKey; - - /** - * @returns {number} - */ - sequence_number(): number; - - /** - * @returns {number} - */ - kes_period(): number; - - /** - * @returns {Ed25519Signature} - */ - sigma(): Ed25519Signature; - - /** - * @param {KESVKey} hot_vkey - * @param {number} sequence_number - * @param {number} kes_period - * @param {Ed25519Signature} sigma - * @returns {OperationalCert} - */ - static new( - hot_vkey: KESVKey, - sequence_number: number, - kes_period: number, - sigma: Ed25519Signature - ): OperationalCert; -} -/** - */ -declare export class PlutusData { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {PlutusData} - */ - static from_bytes(bytes: Uint8Array): PlutusData; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {PlutusData} - */ - static from_hex(hex_str: string): PlutusData; - - /** - * @param {ConstrPlutusData} constr_plutus_data - * @returns {PlutusData} - */ - static new_constr_plutus_data( - constr_plutus_data: ConstrPlutusData - ): PlutusData; - - /** - * Same as `.new_constr_plutus_data` but creates constr with empty data list - * @param {BigNum} alternative - * @returns {PlutusData} - */ - static new_empty_constr_plutus_data(alternative: BigNum): PlutusData; - - /** - * @param {PlutusMap} map - * @returns {PlutusData} - */ - static new_map(map: PlutusMap): PlutusData; - - /** - * @param {PlutusList} list - * @returns {PlutusData} - */ - static new_list(list: PlutusList): PlutusData; - - /** - * @param {BigInt} integer - * @returns {PlutusData} - */ - static new_integer(integer: BigInt): PlutusData; - - /** - * @param {Uint8Array} bytes - * @returns {PlutusData} - */ - static new_bytes(bytes: Uint8Array): PlutusData; - - /** - * @returns {number} - */ - kind(): number; - - /** - * @returns {ConstrPlutusData | void} - */ - as_constr_plutus_data(): ConstrPlutusData | void; - - /** - * @returns {PlutusMap | void} - */ - as_map(): PlutusMap | void; - - /** - * @returns {PlutusList | void} - */ - as_list(): PlutusList | void; - - /** - * @returns {BigInt | void} - */ - as_integer(): BigInt | void; - - /** - * @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; -} -/** - */ -declare export class PlutusList { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {PlutusList} - */ - static from_bytes(bytes: Uint8Array): PlutusList; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {PlutusList} - */ - static from_hex(hex_str: string): PlutusList; - - /** - * @returns {PlutusList} - */ - static new(): PlutusList; - - /** - * @returns {number} - */ - len(): number; - - /** - * @param {number} index - * @returns {PlutusData} - */ - get(index: number): PlutusData; - - /** - * @param {PlutusData} elem - */ - add(elem: PlutusData): void; -} -/** - */ -declare export class PlutusMap { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {PlutusMap} - */ - static from_bytes(bytes: Uint8Array): PlutusMap; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {PlutusMap} - */ - static from_hex(hex_str: string): PlutusMap; - - /** - * @returns {PlutusMap} - */ - static new(): PlutusMap; - - /** - * @returns {number} - */ - len(): number; - - /** - * @param {PlutusData} key - * @param {PlutusData} value - * @returns {PlutusData | void} - */ - insert(key: PlutusData, value: PlutusData): PlutusData | void; - - /** - * @param {PlutusData} key - * @returns {PlutusData | void} - */ - get(key: PlutusData): PlutusData | void; - - /** - * @returns {PlutusList} - */ - keys(): PlutusList; -} -/** - */ -declare export class PlutusScript { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {PlutusScript} - */ - static from_bytes(bytes: Uint8Array): PlutusScript; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {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. - * @param {Uint8Array} bytes - * @returns {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. - * @param {Uint8Array} bytes - * @returns {PlutusScript} - */ - static new_v2(bytes: Uint8Array): PlutusScript; - - /** - * @param {Uint8Array} bytes - * @returns {PlutusScript} - */ - static new_v3(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. - * @param {Uint8Array} bytes - * @param {Language} language - * @returns {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} - */ - bytes(): Uint8Array; - - /** - * Same as `.from_bytes` but will consider the script as requiring the Plutus Language V2 - * @param {Uint8Array} bytes - * @returns {PlutusScript} - */ - static from_bytes_v2(bytes: Uint8Array): PlutusScript; - - /** - * @param {Uint8Array} bytes - * @returns {PlutusScript} - */ - static from_bytes_v3(bytes: Uint8Array): PlutusScript; - - /** - * Same as `.from_bytes` but will consider the script as requiring the specified language version - * @param {Uint8Array} bytes - * @param {Language} language - * @returns {PlutusScript} - */ - static from_bytes_with_version( - bytes: Uint8Array, - 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} - */ - hash(): ScriptHash; - - /** - * @returns {Language} - */ - language_version(): Language; -} -/** - */ -declare export class PlutusScriptSource { - free(): void; - - /** - * @param {PlutusScript} script - * @returns {PlutusScriptSource} - */ - static new(script: PlutusScript): PlutusScriptSource; - - /** - * @param {ScriptHash} script_hash - * @param {TransactionInput} input - * @returns {PlutusScriptSource} - */ - static new_ref_input( - script_hash: ScriptHash, - input: TransactionInput - ): PlutusScriptSource; -} -/** - */ -declare export class PlutusScripts { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {PlutusScripts} - */ - static from_bytes(bytes: Uint8Array): PlutusScripts; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {PlutusScripts} - */ - static from_hex(hex_str: string): PlutusScripts; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {PlutusScriptsJSON} - */ - to_js_value(): PlutusScriptsJSON; - - /** - * @param {string} json - * @returns {PlutusScripts} - */ - static from_json(json: string): PlutusScripts; - - /** - * @returns {PlutusScripts} - */ - static new(): PlutusScripts; - - /** - * @returns {number} - */ - len(): number; - - /** - * @param {number} index - * @returns {PlutusScript} - */ - get(index: number): PlutusScript; - - /** - * @param {PlutusScript} elem - */ - add(elem: PlutusScript): void; -} -/** - */ -declare export class PlutusWitness { - free(): void; - - /** - * @param {PlutusScript} script - * @param {PlutusData} datum - * @param {Redeemer} redeemer - * @returns {PlutusWitness} - */ - static new( - script: PlutusScript, - datum: PlutusData, - redeemer: Redeemer - ): PlutusWitness; - - /** - * @param {PlutusScriptSource} script - * @param {DatumSource} datum - * @param {Redeemer} redeemer - * @returns {PlutusWitness} - */ - static new_with_ref( - script: PlutusScriptSource, - datum: DatumSource, - redeemer: Redeemer - ): PlutusWitness; - - /** - * @returns {PlutusScript | void} - */ - script(): PlutusScript | void; - - /** - * @returns {PlutusData | void} - */ - datum(): PlutusData | void; - - /** - * @returns {Redeemer} - */ - redeemer(): Redeemer; -} -/** - */ -declare export class PlutusWitnesses { - free(): void; - - /** - * @returns {PlutusWitnesses} - */ - static new(): PlutusWitnesses; - - /** - * @returns {number} - */ - len(): number; - - /** - * @param {number} index - * @returns {PlutusWitness} - */ - get(index: number): PlutusWitness; - - /** - * @param {PlutusWitness} elem - */ - add(elem: PlutusWitness): void; -} -/** - */ -declare export class Pointer { - free(): void; - - /** - * !!! DEPRECATED !!! - * This constructor uses outdated slot number format for the ttl value, tx_index and cert_index. - * Use `.new_pointer` instead - * @param {number} slot - * @param {number} tx_index - * @param {number} cert_index - * @returns {Pointer} - */ - static new(slot: number, tx_index: number, cert_index: number): Pointer; - - /** - * @param {BigNum} slot - * @param {BigNum} tx_index - * @param {BigNum} cert_index - * @returns {Pointer} - */ - static new_pointer( - slot: BigNum, - tx_index: BigNum, - cert_index: BigNum - ): Pointer; - - /** - * @returns {number} - */ - slot(): number; - - /** - * @returns {number} - */ - tx_index(): number; - - /** - * @returns {number} - */ - cert_index(): number; - - /** - * @returns {BigNum} - */ - slot_bignum(): BigNum; - - /** - * @returns {BigNum} - */ - tx_index_bignum(): BigNum; - - /** - * @returns {BigNum} - */ - cert_index_bignum(): BigNum; -} -/** - */ -declare export class PointerAddress { - free(): void; - - /** - * @param {number} network - * @param {StakeCredential} payment - * @param {Pointer} stake - * @returns {PointerAddress} - */ - static new( - network: number, - payment: StakeCredential, - stake: Pointer - ): PointerAddress; - - /** - * @returns {StakeCredential} - */ - payment_cred(): StakeCredential; - - /** - * @returns {Pointer} - */ - stake_pointer(): Pointer; - - /** - * @returns {Address} - */ - to_address(): Address; - - /** - * @param {Address} addr - * @returns {PointerAddress | void} - */ - static from_address(addr: Address): PointerAddress | void; -} -/** - */ -declare export class PoolMetadata { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {PoolMetadata} - */ - static from_bytes(bytes: Uint8Array): PoolMetadata; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {PoolMetadata} - */ - static from_hex(hex_str: string): PoolMetadata; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {PoolMetadataJSON} - */ - to_js_value(): PoolMetadataJSON; - - /** - * @param {string} json - * @returns {PoolMetadata} - */ - static from_json(json: string): PoolMetadata; - - /** - * @returns {URL} - */ - url(): URL; - - /** - * @returns {PoolMetadataHash} - */ - pool_metadata_hash(): PoolMetadataHash; - - /** - * @param {URL} url - * @param {PoolMetadataHash} pool_metadata_hash - * @returns {PoolMetadata} - */ - static new(url: URL, pool_metadata_hash: PoolMetadataHash): PoolMetadata; -} -/** - */ -declare export class PoolMetadataHash { - free(): void; - - /** - * @param {Uint8Array} bytes - * @returns {PoolMetadataHash} - */ - static from_bytes(bytes: Uint8Array): PoolMetadataHash; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {string} prefix - * @returns {string} - */ - to_bech32(prefix: string): string; - - /** - * @param {string} bech_str - * @returns {PoolMetadataHash} - */ - static from_bech32(bech_str: string): PoolMetadataHash; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex - * @returns {PoolMetadataHash} - */ - static from_hex(hex: string): PoolMetadataHash; -} -/** - */ -declare export class PoolParams { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {PoolParams} - */ - static from_bytes(bytes: Uint8Array): PoolParams; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {PoolParams} - */ - static from_hex(hex_str: string): PoolParams; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {PoolParamsJSON} - */ - to_js_value(): PoolParamsJSON; - - /** - * @param {string} json - * @returns {PoolParams} - */ - static from_json(json: string): PoolParams; - - /** - * @returns {Ed25519KeyHash} - */ - operator(): Ed25519KeyHash; - - /** - * @returns {VRFKeyHash} - */ - vrf_keyhash(): VRFKeyHash; - - /** - * @returns {BigNum} - */ - pledge(): BigNum; - - /** - * @returns {BigNum} - */ - cost(): BigNum; - - /** - * @returns {UnitInterval} - */ - margin(): UnitInterval; - - /** - * @returns {RewardAddress} - */ - reward_account(): RewardAddress; - - /** - * @returns {Ed25519KeyHashes} - */ - pool_owners(): Ed25519KeyHashes; - - /** - * @returns {Relays} - */ - relays(): Relays; - - /** - * @returns {PoolMetadata | void} - */ - pool_metadata(): PoolMetadata | void; - - /** - * @param {Ed25519KeyHash} operator - * @param {VRFKeyHash} vrf_keyhash - * @param {BigNum} pledge - * @param {BigNum} cost - * @param {UnitInterval} margin - * @param {RewardAddress} reward_account - * @param {Ed25519KeyHashes} pool_owners - * @param {Relays} relays - * @param {PoolMetadata | void} pool_metadata - * @returns {PoolParams} - */ - static new( - operator: Ed25519KeyHash, - vrf_keyhash: VRFKeyHash, - pledge: BigNum, - cost: BigNum, - margin: UnitInterval, - reward_account: RewardAddress, - pool_owners: Ed25519KeyHashes, - relays: Relays, - pool_metadata?: PoolMetadata - ): PoolParams; -} -/** - */ -declare export class PoolRegistration { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {PoolRegistration} - */ - static from_bytes(bytes: Uint8Array): PoolRegistration; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {PoolRegistration} - */ - static from_hex(hex_str: string): PoolRegistration; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {PoolRegistrationJSON} - */ - to_js_value(): PoolRegistrationJSON; - - /** - * @param {string} json - * @returns {PoolRegistration} - */ - static from_json(json: string): PoolRegistration; - - /** - * @returns {PoolParams} - */ - pool_params(): PoolParams; - - /** - * @param {PoolParams} pool_params - * @returns {PoolRegistration} - */ - static new(pool_params: PoolParams): PoolRegistration; -} -/** - */ -declare export class PoolRetirement { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {PoolRetirement} - */ - static from_bytes(bytes: Uint8Array): PoolRetirement; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {PoolRetirement} - */ - static from_hex(hex_str: string): PoolRetirement; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {PoolRetirementJSON} - */ - to_js_value(): PoolRetirementJSON; - - /** - * @param {string} json - * @returns {PoolRetirement} - */ - static from_json(json: string): PoolRetirement; - - /** - * @returns {Ed25519KeyHash} - */ - pool_keyhash(): Ed25519KeyHash; - - /** - * @returns {number} - */ - epoch(): number; - - /** - * @param {Ed25519KeyHash} pool_keyhash - * @param {number} epoch - * @returns {PoolRetirement} - */ - static new(pool_keyhash: Ed25519KeyHash, epoch: number): PoolRetirement; -} -/** - */ -declare export class PrivateKey { - free(): void; - - /** - * @returns {PublicKey} - */ - to_public(): PublicKey; - - /** - * @returns {PrivateKey} - */ - static generate_ed25519(): PrivateKey; - - /** - * @returns {PrivateKey} - */ - static generate_ed25519extended(): PrivateKey; - - /** - * Get private key from its bech32 representation - * ```javascript - * PrivateKey.from_bech32('ed25519_sk1ahfetf02qwwg4dkq7mgp4a25lx5vh9920cr5wnxmpzz9906qvm8qwvlts0'); - * ``` - * For an extended 25519 key - * ```javascript - * PrivateKey.from_bech32('ed25519e_sk1gqwl4szuwwh6d0yk3nsqcc6xxc3fpvjlevgwvt60df59v8zd8f8prazt8ln3lmz096ux3xvhhvm3ca9wj2yctdh3pnw0szrma07rt5gl748fp'); - * ``` - * @param {string} bech32_str - * @returns {PrivateKey} - */ - static from_bech32(bech32_str: string): PrivateKey; - - /** - * @returns {string} - */ - to_bech32(): string; - - /** - * @returns {Uint8Array} - */ - as_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {PrivateKey} - */ - static from_extended_bytes(bytes: Uint8Array): PrivateKey; - - /** - * @param {Uint8Array} bytes - * @returns {PrivateKey} - */ - static from_normal_bytes(bytes: Uint8Array): PrivateKey; - - /** - * @param {Uint8Array} message - * @returns {Ed25519Signature} - */ - sign(message: Uint8Array): Ed25519Signature; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {PrivateKey} - */ - static from_hex(hex_str: string): PrivateKey; -} -/** - */ -declare export class ProposedProtocolParameterUpdates { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {ProposedProtocolParameterUpdates} - */ - static from_bytes(bytes: Uint8Array): ProposedProtocolParameterUpdates; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {ProposedProtocolParameterUpdates} - */ - static from_hex(hex_str: string): ProposedProtocolParameterUpdates; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {ProposedProtocolParameterUpdatesJSON} - */ - to_js_value(): ProposedProtocolParameterUpdatesJSON; - - /** - * @param {string} json - * @returns {ProposedProtocolParameterUpdates} - */ - static from_json(json: string): ProposedProtocolParameterUpdates; - - /** - * @returns {ProposedProtocolParameterUpdates} - */ - static new(): ProposedProtocolParameterUpdates; - - /** - * @returns {number} - */ - len(): number; - - /** - * @param {GenesisHash} key - * @param {ProtocolParamUpdate} value - * @returns {ProtocolParamUpdate | void} - */ - insert( - key: GenesisHash, - value: ProtocolParamUpdate - ): ProtocolParamUpdate | void; - - /** - * @param {GenesisHash} key - * @returns {ProtocolParamUpdate | void} - */ - get(key: GenesisHash): ProtocolParamUpdate | void; - - /** - * @returns {GenesisHashes} - */ - keys(): GenesisHashes; -} -/** - */ -declare export class ProtocolParamUpdate { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {ProtocolParamUpdate} - */ - static from_bytes(bytes: Uint8Array): ProtocolParamUpdate; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {ProtocolParamUpdate} - */ - static from_hex(hex_str: string): ProtocolParamUpdate; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {ProtocolParamUpdateJSON} - */ - to_js_value(): ProtocolParamUpdateJSON; - - /** - * @param {string} json - * @returns {ProtocolParamUpdate} - */ - static from_json(json: string): ProtocolParamUpdate; - - /** - * @param {BigNum} minfee_a - */ - set_minfee_a(minfee_a: BigNum): void; - - /** - * @returns {BigNum | void} - */ - minfee_a(): BigNum | void; - - /** - * @param {BigNum} minfee_b - */ - set_minfee_b(minfee_b: BigNum): void; - - /** - * @returns {BigNum | void} - */ - minfee_b(): BigNum | void; - - /** - * @param {number} max_block_body_size - */ - set_max_block_body_size(max_block_body_size: number): void; - - /** - * @returns {number | void} - */ - max_block_body_size(): number | void; - - /** - * @param {number} max_tx_size - */ - set_max_tx_size(max_tx_size: number): void; - - /** - * @returns {number | void} - */ - max_tx_size(): number | void; - - /** - * @param {number} max_block_header_size - */ - set_max_block_header_size(max_block_header_size: number): void; - - /** - * @returns {number | void} - */ - max_block_header_size(): number | void; - - /** - * @param {BigNum} key_deposit - */ - set_key_deposit(key_deposit: BigNum): void; - - /** - * @returns {BigNum | void} - */ - key_deposit(): BigNum | void; - - /** - * @param {BigNum} pool_deposit - */ - set_pool_deposit(pool_deposit: BigNum): void; - - /** - * @returns {BigNum | void} - */ - pool_deposit(): BigNum | void; - - /** - * @param {number} max_epoch - */ - set_max_epoch(max_epoch: number): void; - - /** - * @returns {number | void} - */ - max_epoch(): number | void; - - /** - * @param {number} n_opt - */ - set_n_opt(n_opt: number): void; - - /** - * @returns {number | void} - */ - n_opt(): number | void; - - /** - * @param {UnitInterval} pool_pledge_influence - */ - set_pool_pledge_influence(pool_pledge_influence: UnitInterval): void; - - /** - * @returns {UnitInterval | void} - */ - pool_pledge_influence(): UnitInterval | void; - - /** - * @param {UnitInterval} expansion_rate - */ - set_expansion_rate(expansion_rate: UnitInterval): void; - - /** - * @returns {UnitInterval | void} - */ - expansion_rate(): UnitInterval | void; - - /** - * @param {UnitInterval} treasury_growth_rate - */ - set_treasury_growth_rate(treasury_growth_rate: UnitInterval): void; - - /** - * @returns {UnitInterval | void} - */ - treasury_growth_rate(): UnitInterval | void; - - /** - * !!! DEPRECATED !!! - * Since babbage era this param is outdated. But this param you can meet in a pre-babbage block. - * @returns {UnitInterval | void} - */ - d(): UnitInterval | void; - - /** - * !!! DEPRECATED !!! - * Since babbage era this param is outdated. But this param you can meet in a pre-babbage block. - * @returns {Nonce | void} - */ - extra_entropy(): Nonce | void; - - /** - * @param {ProtocolVersion} protocol_version - */ - set_protocol_version(protocol_version: ProtocolVersion): void; - - /** - * @returns {ProtocolVersion | void} - */ - protocol_version(): ProtocolVersion | void; - - /** - * @param {BigNum} min_pool_cost - */ - set_min_pool_cost(min_pool_cost: BigNum): void; - - /** - * @returns {BigNum | void} - */ - min_pool_cost(): BigNum | void; - - /** - * @param {BigNum} ada_per_utxo_byte - */ - set_ada_per_utxo_byte(ada_per_utxo_byte: BigNum): void; - - /** - * @returns {BigNum | void} - */ - ada_per_utxo_byte(): BigNum | void; - - /** - * @param {Costmdls} cost_models - */ - set_cost_models(cost_models: Costmdls): void; - - /** - * @returns {Costmdls | void} - */ - cost_models(): Costmdls | void; - - /** - * @param {ExUnitPrices} execution_costs - */ - set_execution_costs(execution_costs: ExUnitPrices): void; - - /** - * @returns {ExUnitPrices | void} - */ - execution_costs(): ExUnitPrices | void; - - /** - * @param {ExUnits} max_tx_ex_units - */ - set_max_tx_ex_units(max_tx_ex_units: ExUnits): void; - - /** - * @returns {ExUnits | void} - */ - max_tx_ex_units(): ExUnits | void; - - /** - * @param {ExUnits} max_block_ex_units - */ - set_max_block_ex_units(max_block_ex_units: ExUnits): void; - - /** - * @returns {ExUnits | void} - */ - max_block_ex_units(): ExUnits | void; - - /** - * @param {number} max_value_size - */ - set_max_value_size(max_value_size: number): void; - - /** - * @returns {number | void} - */ - max_value_size(): number | void; - - /** - * @param {number} collateral_percentage - */ - set_collateral_percentage(collateral_percentage: number): void; - - /** - * @returns {number | void} - */ - collateral_percentage(): number | void; - - /** - * @param {number} max_collateral_inputs - */ - set_max_collateral_inputs(max_collateral_inputs: number): void; - - /** - * @returns {number | void} - */ - max_collateral_inputs(): number | void; - - /** - * @returns {ProtocolParamUpdate} - */ - static new(): ProtocolParamUpdate; -} -/** - */ -declare export class ProtocolVersion { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {ProtocolVersion} - */ - static from_bytes(bytes: Uint8Array): ProtocolVersion; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {ProtocolVersion} - */ - static from_hex(hex_str: string): ProtocolVersion; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {ProtocolVersionJSON} - */ - to_js_value(): ProtocolVersionJSON; - - /** - * @param {string} json - * @returns {ProtocolVersion} - */ - static from_json(json: string): ProtocolVersion; - - /** - * @returns {number} - */ - major(): number; - - /** - * @returns {number} - */ - minor(): number; - - /** - * @param {number} major - * @param {number} minor - * @returns {ProtocolVersion} - */ - static new(major: number, minor: number): ProtocolVersion; -} -/** - * ED25519 key used as public key - */ -declare export class PublicKey { - free(): void; - - /** - * Get public key from its bech32 representation - * Example: - * ```javascript - * const pkey = PublicKey.from_bech32('ed25519_pk1dgaagyh470y66p899txcl3r0jaeaxu6yd7z2dxyk55qcycdml8gszkxze2'); - * ``` - * @param {string} bech32_str - * @returns {PublicKey} - */ - static from_bech32(bech32_str: string): PublicKey; - - /** - * @returns {string} - */ - to_bech32(): string; - - /** - * @returns {Uint8Array} - */ - as_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {PublicKey} - */ - static from_bytes(bytes: Uint8Array): PublicKey; - - /** - * @param {Uint8Array} data - * @param {Ed25519Signature} signature - * @returns {boolean} - */ - verify(data: Uint8Array, signature: Ed25519Signature): boolean; - - /** - * @returns {Ed25519KeyHash} - */ - hash(): Ed25519KeyHash; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {PublicKey} - */ - static from_hex(hex_str: string): PublicKey; -} -/** - */ -declare export class PublicKeys { - free(): void; - - /** - */ - constructor(): this; - - /** - * @returns {number} - */ - size(): number; - - /** - * @param {number} index - * @returns {PublicKey} - */ - get(index: number): PublicKey; - - /** - * @param {PublicKey} key - */ - add(key: PublicKey): void; -} -/** - */ -declare export class Redeemer { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {Redeemer} - */ - static from_bytes(bytes: Uint8Array): Redeemer; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {Redeemer} - */ - static from_hex(hex_str: string): Redeemer; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {RedeemerJSON} - */ - to_js_value(): RedeemerJSON; - - /** - * @param {string} json - * @returns {Redeemer} - */ - static from_json(json: string): Redeemer; - - /** - * @returns {RedeemerTag} - */ - tag(): RedeemerTag; - - /** - * @returns {BigNum} - */ - index(): BigNum; - - /** - * @returns {PlutusData} - */ - data(): PlutusData; - - /** - * @returns {ExUnits} - */ - ex_units(): ExUnits; - - /** - * @param {RedeemerTag} tag - * @param {BigNum} index - * @param {PlutusData} data - * @param {ExUnits} ex_units - * @returns {Redeemer} - */ - static new( - tag: RedeemerTag, - index: BigNum, - data: PlutusData, - ex_units: ExUnits - ): Redeemer; -} -/** - */ -declare export class RedeemerTag { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {RedeemerTag} - */ - static from_bytes(bytes: Uint8Array): RedeemerTag; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {RedeemerTag} - */ - static from_hex(hex_str: string): RedeemerTag; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {RedeemerTagJSON} - */ - to_js_value(): RedeemerTagJSON; - - /** - * @param {string} json - * @returns {RedeemerTag} - */ - static from_json(json: string): RedeemerTag; - - /** - * @returns {RedeemerTag} - */ - static new_spend(): RedeemerTag; - - /** - * @returns {RedeemerTag} - */ - static new_mint(): RedeemerTag; - - /** - * @returns {RedeemerTag} - */ - static new_cert(): RedeemerTag; - - /** - * @returns {RedeemerTag} - */ - static new_reward(): RedeemerTag; - - /** - * @returns {number} - */ - kind(): number; -} -/** - */ -declare export class Redeemers { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {Redeemers} - */ - static from_bytes(bytes: Uint8Array): Redeemers; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {Redeemers} - */ - static from_hex(hex_str: string): Redeemers; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {RedeemersJSON} - */ - to_js_value(): RedeemersJSON; - - /** - * @param {string} json - * @returns {Redeemers} - */ - static from_json(json: string): Redeemers; - - /** - * @returns {Redeemers} - */ - static new(): Redeemers; - - /** - * @returns {number} - */ - len(): number; - - /** - * @param {number} index - * @returns {Redeemer} - */ - get(index: number): Redeemer; - - /** - * @param {Redeemer} elem - */ - add(elem: Redeemer): void; - - /** - * @returns {ExUnits} - */ - total_ex_units(): ExUnits; -} -/** - */ -declare export class Relay { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {Relay} - */ - static from_bytes(bytes: Uint8Array): Relay; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {Relay} - */ - static from_hex(hex_str: string): Relay; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {RelayJSON} - */ - to_js_value(): RelayJSON; - - /** - * @param {string} json - * @returns {Relay} - */ - static from_json(json: string): Relay; - - /** - * @param {SingleHostAddr} single_host_addr - * @returns {Relay} - */ - static new_single_host_addr(single_host_addr: SingleHostAddr): Relay; - - /** - * @param {SingleHostName} single_host_name - * @returns {Relay} - */ - static new_single_host_name(single_host_name: SingleHostName): Relay; - - /** - * @param {MultiHostName} multi_host_name - * @returns {Relay} - */ - static new_multi_host_name(multi_host_name: MultiHostName): Relay; - - /** - * @returns {number} - */ - kind(): number; - - /** - * @returns {SingleHostAddr | void} - */ - as_single_host_addr(): SingleHostAddr | void; - - /** - * @returns {SingleHostName | void} - */ - as_single_host_name(): SingleHostName | void; - - /** - * @returns {MultiHostName | void} - */ - as_multi_host_name(): MultiHostName | void; -} -/** - */ -declare export class Relays { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {Relays} - */ - static from_bytes(bytes: Uint8Array): Relays; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {Relays} - */ - static from_hex(hex_str: string): Relays; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {RelaysJSON} - */ - to_js_value(): RelaysJSON; - - /** - * @param {string} json - * @returns {Relays} - */ - static from_json(json: string): Relays; - - /** - * @returns {Relays} - */ - static new(): Relays; - - /** - * @returns {number} - */ - len(): number; - - /** - * @param {number} index - * @returns {Relay} - */ - get(index: number): Relay; - - /** - * @param {Relay} elem - */ - add(elem: Relay): void; -} -/** - */ -declare export class RewardAddress { - free(): void; - - /** - * @param {number} network - * @param {StakeCredential} payment - * @returns {RewardAddress} - */ - static new(network: number, payment: StakeCredential): RewardAddress; - - /** - * @returns {StakeCredential} - */ - payment_cred(): StakeCredential; - - /** - * @returns {Address} - */ - to_address(): Address; - - /** - * @param {Address} addr - * @returns {RewardAddress | void} - */ - static from_address(addr: Address): RewardAddress | void; -} -/** - */ -declare export class RewardAddresses { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {RewardAddresses} - */ - static from_bytes(bytes: Uint8Array): RewardAddresses; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {RewardAddresses} - */ - static from_hex(hex_str: string): RewardAddresses; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {RewardAddressesJSON} - */ - to_js_value(): RewardAddressesJSON; - - /** - * @param {string} json - * @returns {RewardAddresses} - */ - static from_json(json: string): RewardAddresses; - - /** - * @returns {RewardAddresses} - */ - static new(): RewardAddresses; - - /** - * @returns {number} - */ - len(): number; - - /** - * @param {number} index - * @returns {RewardAddress} - */ - get(index: number): RewardAddress; - - /** - * @param {RewardAddress} elem - */ - add(elem: RewardAddress): void; -} -/** - */ -declare export class Script { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {Script} - */ - static from_bytes(bytes: Uint8Array): Script; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {Script} - */ - static from_hex(hex_str: string): Script; - - /** - * @param {NativeScript} native_script - * @returns {Script} - */ - static new_native(native_script: NativeScript): Script; - - /** - * @param {PlutusScript} plutus_script - * @returns {Script} - */ - static new_plutus_v1(plutus_script: PlutusScript): Script; - - /** - * @param {PlutusScript} plutus_script - * @returns {Script} - */ - static new_plutus_v2(plutus_script: PlutusScript): Script; - - /** - * @param {PlutusScript} plutus_script - * @returns {Script} - */ - static new_plutus_v3(plutus_script: PlutusScript): Script; - - /** - * @returns {number} - */ - kind(): number; - - /** - * @returns {NativeScript | void} - */ - as_native(): NativeScript | void; - - /** - * @returns {PlutusScript | void} - */ - as_plutus(): PlutusScript | void; - - /** - * @returns {PlutusScript | void} - */ - as_plutus_v1(): PlutusScript | void; - - /** - * @returns {PlutusScript | void} - */ - as_plutus_v2(): PlutusScript | void; -} -/** - */ -declare export class ScriptAll { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {ScriptAll} - */ - static from_bytes(bytes: Uint8Array): ScriptAll; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {ScriptAll} - */ - static from_hex(hex_str: string): ScriptAll; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {ScriptAllJSON} - */ - to_js_value(): ScriptAllJSON; - - /** - * @param {string} json - * @returns {ScriptAll} - */ - static from_json(json: string): ScriptAll; - - /** - * @returns {NativeScripts} - */ - native_scripts(): NativeScripts; - - /** - * @param {NativeScripts} native_scripts - * @returns {ScriptAll} - */ - static new(native_scripts: NativeScripts): ScriptAll; -} -/** - */ -declare export class ScriptAny { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {ScriptAny} - */ - static from_bytes(bytes: Uint8Array): ScriptAny; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {ScriptAny} - */ - static from_hex(hex_str: string): ScriptAny; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {ScriptAnyJSON} - */ - to_js_value(): ScriptAnyJSON; - - /** - * @param {string} json - * @returns {ScriptAny} - */ - static from_json(json: string): ScriptAny; - - /** - * @returns {NativeScripts} - */ - native_scripts(): NativeScripts; - - /** - * @param {NativeScripts} native_scripts - * @returns {ScriptAny} - */ - static new(native_scripts: NativeScripts): ScriptAny; -} -/** - */ -declare export class ScriptDataHash { - free(): void; - - /** - * @param {Uint8Array} bytes - * @returns {ScriptDataHash} - */ - static from_bytes(bytes: Uint8Array): ScriptDataHash; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {string} prefix - * @returns {string} - */ - to_bech32(prefix: string): string; - - /** - * @param {string} bech_str - * @returns {ScriptDataHash} - */ - static from_bech32(bech_str: string): ScriptDataHash; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex - * @returns {ScriptDataHash} - */ - static from_hex(hex: string): ScriptDataHash; -} -/** - */ -declare export class ScriptHash { - free(): void; - - /** - * @param {Uint8Array} bytes - * @returns {ScriptHash} - */ - static from_bytes(bytes: Uint8Array): ScriptHash; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {string} prefix - * @returns {string} - */ - to_bech32(prefix: string): string; - - /** - * @param {string} bech_str - * @returns {ScriptHash} - */ - static from_bech32(bech_str: string): ScriptHash; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex - * @returns {ScriptHash} - */ - static from_hex(hex: string): ScriptHash; -} -/** - */ -declare export class ScriptHashes { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {ScriptHashes} - */ - static from_bytes(bytes: Uint8Array): ScriptHashes; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {ScriptHashes} - */ - static from_hex(hex_str: string): ScriptHashes; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {ScriptHashesJSON} - */ - to_js_value(): ScriptHashesJSON; - - /** - * @param {string} json - * @returns {ScriptHashes} - */ - static from_json(json: string): ScriptHashes; - - /** - * @returns {ScriptHashes} - */ - static new(): ScriptHashes; - - /** - * @returns {number} - */ - len(): number; - - /** - * @param {number} index - * @returns {ScriptHash} - */ - get(index: number): ScriptHash; - - /** - * @param {ScriptHash} elem - */ - add(elem: ScriptHash): void; -} -/** - */ -declare export class ScriptNOfK { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {ScriptNOfK} - */ - static from_bytes(bytes: Uint8Array): ScriptNOfK; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {ScriptNOfK} - */ - static from_hex(hex_str: string): ScriptNOfK; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {ScriptNOfKJSON} - */ - to_js_value(): ScriptNOfKJSON; - - /** - * @param {string} json - * @returns {ScriptNOfK} - */ - static from_json(json: string): ScriptNOfK; - - /** - * @returns {number} - */ - n(): number; - - /** - * @returns {NativeScripts} - */ - native_scripts(): NativeScripts; - - /** - * @param {number} n - * @param {NativeScripts} native_scripts - * @returns {ScriptNOfK} - */ - static new(n: number, native_scripts: NativeScripts): ScriptNOfK; -} -/** - */ -declare export class ScriptPubkey { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {ScriptPubkey} - */ - static from_bytes(bytes: Uint8Array): ScriptPubkey; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {ScriptPubkey} - */ - static from_hex(hex_str: string): ScriptPubkey; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {ScriptPubkeyJSON} - */ - to_js_value(): ScriptPubkeyJSON; - - /** - * @param {string} json - * @returns {ScriptPubkey} - */ - static from_json(json: string): ScriptPubkey; - - /** - * @returns {Ed25519KeyHash} - */ - addr_keyhash(): Ed25519KeyHash; - - /** - * @param {Ed25519KeyHash} addr_keyhash - * @returns {ScriptPubkey} - */ - static new(addr_keyhash: Ed25519KeyHash): ScriptPubkey; -} -/** - */ -declare export class ScriptRef { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {ScriptRef} - */ - static from_bytes(bytes: Uint8Array): ScriptRef; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {ScriptRef} - */ - static from_hex(hex_str: string): ScriptRef; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {ScriptRefJSON} - */ - to_js_value(): ScriptRefJSON; - - /** - * @param {string} json - * @returns {ScriptRef} - */ - static from_json(json: string): ScriptRef; - - /** - * @param {Script} script - * @returns {ScriptRef} - */ - static new(script: Script): ScriptRef; - - /** - * @param {NativeScript} native_script - * @returns {ScriptRef} - */ - static new_native_script(native_script: NativeScript): ScriptRef; - - /** - * @param {PlutusScript} plutus_script - * @returns {ScriptRef} - */ - static new_plutus_script(plutus_script: PlutusScript): ScriptRef; - - /** - * @returns {PlutusScript | void} - */ - plutus_script(): PlutusScript | void; - - /** - * @returns {Script} - */ - script(): Script; -} -/** - */ -declare export class SingleHostAddr { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {SingleHostAddr} - */ - static from_bytes(bytes: Uint8Array): SingleHostAddr; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {SingleHostAddr} - */ - static from_hex(hex_str: string): SingleHostAddr; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {SingleHostAddrJSON} - */ - to_js_value(): SingleHostAddrJSON; - - /** - * @param {string} json - * @returns {SingleHostAddr} - */ - static from_json(json: string): SingleHostAddr; - - /** - * @returns {number | void} - */ - port(): number | void; - - /** - * @returns {Ipv4 | void} - */ - ipv4(): Ipv4 | void; - - /** - * @returns {Ipv6 | void} - */ - ipv6(): Ipv6 | void; - - /** - * @param {number | void} port - * @param {Ipv4 | void} ipv4 - * @param {Ipv6 | void} ipv6 - * @returns {SingleHostAddr} - */ - static new(port?: number, ipv4?: Ipv4, ipv6?: Ipv6): SingleHostAddr; -} -/** - */ -declare export class SingleHostName { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {SingleHostName} - */ - static from_bytes(bytes: Uint8Array): SingleHostName; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {SingleHostName} - */ - static from_hex(hex_str: string): SingleHostName; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {SingleHostNameJSON} - */ - to_js_value(): SingleHostNameJSON; - - /** - * @param {string} json - * @returns {SingleHostName} - */ - static from_json(json: string): SingleHostName; - - /** - * @returns {number | void} - */ - port(): number | void; - - /** - * @returns {DNSRecordAorAAAA} - */ - dns_name(): DNSRecordAorAAAA; - - /** - * @param {number | void} port - * @param {DNSRecordAorAAAA} dns_name - * @returns {SingleHostName} - */ - static new(port: number | void, dns_name: DNSRecordAorAAAA): SingleHostName; -} -/** - */ -declare export class StakeCredential { - free(): void; - - /** - * @param {Ed25519KeyHash} hash - * @returns {StakeCredential} - */ - static from_keyhash(hash: Ed25519KeyHash): StakeCredential; - - /** - * @param {ScriptHash} hash - * @returns {StakeCredential} - */ - static from_scripthash(hash: ScriptHash): StakeCredential; - - /** - * @returns {Ed25519KeyHash | void} - */ - to_keyhash(): Ed25519KeyHash | void; - - /** - * @returns {ScriptHash | void} - */ - to_scripthash(): ScriptHash | void; - - /** - * @returns {number} - */ - kind(): number; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {StakeCredential} - */ - static from_bytes(bytes: Uint8Array): StakeCredential; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {StakeCredential} - */ - static from_hex(hex_str: string): StakeCredential; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {StakeCredentialJSON} - */ - to_js_value(): StakeCredentialJSON; - - /** - * @param {string} json - * @returns {StakeCredential} - */ - static from_json(json: string): StakeCredential; -} -/** - */ -declare export class StakeCredentials { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {StakeCredentials} - */ - static from_bytes(bytes: Uint8Array): StakeCredentials; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {StakeCredentials} - */ - static from_hex(hex_str: string): StakeCredentials; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {StakeCredentialsJSON} - */ - to_js_value(): StakeCredentialsJSON; - - /** - * @param {string} json - * @returns {StakeCredentials} - */ - static from_json(json: string): StakeCredentials; - - /** - * @returns {StakeCredentials} - */ - static new(): StakeCredentials; - - /** - * @returns {number} - */ - len(): number; - - /** - * @param {number} index - * @returns {StakeCredential} - */ - get(index: number): StakeCredential; - - /** - * @param {StakeCredential} elem - */ - add(elem: StakeCredential): void; -} -/** - */ -declare export class StakeDelegation { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {StakeDelegation} - */ - static from_bytes(bytes: Uint8Array): StakeDelegation; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {StakeDelegation} - */ - static from_hex(hex_str: string): StakeDelegation; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {StakeDelegationJSON} - */ - to_js_value(): StakeDelegationJSON; - - /** - * @param {string} json - * @returns {StakeDelegation} - */ - static from_json(json: string): StakeDelegation; - - /** - * @returns {StakeCredential} - */ - stake_credential(): StakeCredential; - - /** - * @returns {Ed25519KeyHash} - */ - pool_keyhash(): Ed25519KeyHash; - - /** - * @param {StakeCredential} stake_credential - * @param {Ed25519KeyHash} pool_keyhash - * @returns {StakeDelegation} - */ - static new( - stake_credential: StakeCredential, - pool_keyhash: Ed25519KeyHash - ): StakeDelegation; -} -/** - */ -declare export class StakeDeregistration { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {StakeDeregistration} - */ - static from_bytes(bytes: Uint8Array): StakeDeregistration; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {StakeDeregistration} - */ - static from_hex(hex_str: string): StakeDeregistration; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {StakeDeregistrationJSON} - */ - to_js_value(): StakeDeregistrationJSON; - - /** - * @param {string} json - * @returns {StakeDeregistration} - */ - static from_json(json: string): StakeDeregistration; - - /** - * @returns {StakeCredential} - */ - stake_credential(): StakeCredential; - - /** - * @param {StakeCredential} stake_credential - * @returns {StakeDeregistration} - */ - static new(stake_credential: StakeCredential): StakeDeregistration; -} -/** - */ -declare export class StakeRegistration { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {StakeRegistration} - */ - static from_bytes(bytes: Uint8Array): StakeRegistration; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {StakeRegistration} - */ - static from_hex(hex_str: string): StakeRegistration; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {StakeRegistrationJSON} - */ - to_js_value(): StakeRegistrationJSON; - - /** - * @param {string} json - * @returns {StakeRegistration} - */ - static from_json(json: string): StakeRegistration; - - /** - * @returns {StakeCredential} - */ - stake_credential(): StakeCredential; - - /** - * @param {StakeCredential} stake_credential - * @returns {StakeRegistration} - */ - static new(stake_credential: StakeCredential): StakeRegistration; -} -/** - */ -declare export class Strings { - free(): void; - - /** - * @returns {Strings} - */ - static new(): Strings; - - /** - * @returns {number} - */ - len(): number; - - /** - * @param {number} index - * @returns {string} - */ - get(index: number): string; - - /** - * @param {string} elem - */ - add(elem: string): void; -} -/** - */ -declare export class TimelockExpiry { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {TimelockExpiry} - */ - static from_bytes(bytes: Uint8Array): TimelockExpiry; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {TimelockExpiry} - */ - static from_hex(hex_str: string): TimelockExpiry; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {TimelockExpiryJSON} - */ - to_js_value(): TimelockExpiryJSON; - - /** - * @param {string} json - * @returns {TimelockExpiry} - */ - static from_json(json: string): TimelockExpiry; - - /** - * @returns {number} - */ - slot(): number; - - /** - * @returns {BigNum} - */ - slot_bignum(): BigNum; - - /** - * !!! DEPRECATED !!! - * This constructor uses outdated slot number format. - * Use `.new_timelockexpiry` instead - * @param {number} slot - * @returns {TimelockExpiry} - */ - static new(slot: number): TimelockExpiry; - - /** - * @param {BigNum} slot - * @returns {TimelockExpiry} - */ - static new_timelockexpiry(slot: BigNum): TimelockExpiry; -} -/** - */ -declare export class TimelockStart { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {TimelockStart} - */ - static from_bytes(bytes: Uint8Array): TimelockStart; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {TimelockStart} - */ - static from_hex(hex_str: string): TimelockStart; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {TimelockStartJSON} - */ - to_js_value(): TimelockStartJSON; - - /** - * @param {string} json - * @returns {TimelockStart} - */ - static from_json(json: string): TimelockStart; - - /** - * !!! DEPRECATED !!! - * Returns a Slot32 (u32) value in case the underlying original BigNum (u64) value is within the limits. - * Otherwise will just raise an error. - * Use `.slot_bignum` instead - * @returns {number} - */ - slot(): number; - - /** - * @returns {BigNum} - */ - slot_bignum(): BigNum; - - /** - * !!! DEPRECATED !!! - * This constructor uses outdated slot number format. - * Use `.new_timelockstart` instead. - * @param {number} slot - * @returns {TimelockStart} - */ - static new(slot: number): TimelockStart; - - /** - * @param {BigNum} slot - * @returns {TimelockStart} - */ - static new_timelockstart(slot: BigNum): TimelockStart; -} -/** - */ -declare export class Transaction { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {Transaction} - */ - static from_bytes(bytes: Uint8Array): Transaction; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {Transaction} - */ - static from_hex(hex_str: string): Transaction; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {TransactionJSON} - */ - to_js_value(): TransactionJSON; - - /** - * @param {string} json - * @returns {Transaction} - */ - static from_json(json: string): Transaction; - - /** - * @returns {TransactionBody} - */ - body(): TransactionBody; - - /** - * @returns {TransactionWitnessSet} - */ - witness_set(): TransactionWitnessSet; - - /** - * @returns {boolean} - */ - is_valid(): boolean; - - /** - * @returns {AuxiliaryData | void} - */ - auxiliary_data(): AuxiliaryData | void; - - /** - * @param {boolean} valid - */ - set_is_valid(valid: boolean): void; - - /** - * @param {AuxiliaryData} auxiliary_data - */ - set_auxiliary_data(auxiliary_data: AuxiliaryData): void; - - /** - * @param {TransactionBody} body - * @param {TransactionWitnessSet} witness_set - * @returns {Transaction} - */ - static new( - body: TransactionBody, - witness_set: TransactionWitnessSet - ): Transaction; -} -/** - */ -declare export class TransactionBodies { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {TransactionBodies} - */ - static from_bytes(bytes: Uint8Array): TransactionBodies; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {TransactionBodies} - */ - static from_hex(hex_str: string): TransactionBodies; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {TransactionBodiesJSON} - */ - to_js_value(): TransactionBodiesJSON; - - /** - * @param {string} json - * @returns {TransactionBodies} - */ - static from_json(json: string): TransactionBodies; - - /** - * @returns {TransactionBodies} - */ - static new(): TransactionBodies; - - /** - * @returns {number} - */ - len(): number; - - /** - * @param {number} index - * @returns {TransactionBody} - */ - get(index: number): TransactionBody; - - /** - * @param {TransactionBody} elem - */ - add(elem: TransactionBody): void; -} -/** - */ -declare export class TransactionBody { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {TransactionBody} - */ - static from_bytes(bytes: Uint8Array): TransactionBody; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {TransactionBody} - */ - static from_hex(hex_str: string): TransactionBody; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {TransactionBodyJSON} - */ - to_js_value(): TransactionBodyJSON; - - /** - * @param {string} json - * @returns {TransactionBody} - */ - static from_json(json: string): TransactionBody; - - /** - * @returns {TransactionInputs} - */ - inputs(): TransactionInputs; - - /** - * @returns {TransactionOutputs} - */ - outputs(): TransactionOutputs; - - /** - * @returns {BigNum} - */ - fee(): BigNum; - - /** - * !!! DEPRECATED !!! - * Returns a Slot32 (u32) value in case the underlying original BigNum (u64) value is within the limits. - * Otherwise will just raise an error. - * @returns {number | void} - */ - ttl(): number | void; - - /** - * @returns {BigNum | void} - */ - ttl_bignum(): BigNum | void; - - /** - * @param {BigNum} ttl - */ - set_ttl(ttl: BigNum): void; - - /** - */ - remove_ttl(): void; - - /** - * @param {Certificates} certs - */ - set_certs(certs: Certificates): void; - - /** - * @returns {Certificates | void} - */ - certs(): Certificates | void; - - /** - * @param {Withdrawals} withdrawals - */ - set_withdrawals(withdrawals: Withdrawals): void; - - /** - * @returns {Withdrawals | void} - */ - withdrawals(): Withdrawals | void; - - /** - * @param {Update} update - */ - set_update(update: Update): void; - - /** - * @returns {Update | void} - */ - update(): Update | void; - - /** - * @param {AuxiliaryDataHash} auxiliary_data_hash - */ - set_auxiliary_data_hash(auxiliary_data_hash: AuxiliaryDataHash): void; - - /** - * @returns {AuxiliaryDataHash | void} - */ - auxiliary_data_hash(): AuxiliaryDataHash | void; - - /** - * !!! DEPRECATED !!! - * Uses outdated slot number format. - * @param {number} validity_start_interval - */ - set_validity_start_interval(validity_start_interval: number): void; - - /** - * @param {BigNum} validity_start_interval - */ - set_validity_start_interval_bignum(validity_start_interval: BigNum): void; - - /** - * @returns {BigNum | void} - */ - validity_start_interval_bignum(): BigNum | void; - - /** - * !!! DEPRECATED !!! - * Returns a Option (u32) value in case the underlying original Option (u64) value is within the limits. - * Otherwise will just raise an error. - * Use `.validity_start_interval_bignum` instead. - * @returns {number | void} - */ - validity_start_interval(): number | void; - - /** - * @param {Mint} mint - */ - set_mint(mint: Mint): void; - - /** - * @returns {Mint | void} - */ - mint(): Mint | void; - - /** - * This function returns the mint value of the transaction - * Use `.mint()` instead. - * @returns {Mint | void} - */ - multiassets(): Mint | void; - - /** - * @param {TransactionInputs} reference_inputs - */ - set_reference_inputs(reference_inputs: TransactionInputs): void; - - /** - * @returns {TransactionInputs | void} - */ - reference_inputs(): TransactionInputs | void; - - /** - * @param {ScriptDataHash} script_data_hash - */ - set_script_data_hash(script_data_hash: ScriptDataHash): void; - - /** - * @returns {ScriptDataHash | void} - */ - script_data_hash(): ScriptDataHash | void; - - /** - * @param {TransactionInputs} collateral - */ - set_collateral(collateral: TransactionInputs): void; - - /** - * @returns {TransactionInputs | void} - */ - collateral(): TransactionInputs | void; - - /** - * @param {Ed25519KeyHashes} required_signers - */ - set_required_signers(required_signers: Ed25519KeyHashes): void; - - /** - * @returns {Ed25519KeyHashes | void} - */ - required_signers(): Ed25519KeyHashes | void; - - /** - * @param {NetworkId} network_id - */ - set_network_id(network_id: NetworkId): void; - - /** - * @returns {NetworkId | void} - */ - network_id(): NetworkId | void; - - /** - * @param {TransactionOutput} collateral_return - */ - set_collateral_return(collateral_return: TransactionOutput): void; - - /** - * @returns {TransactionOutput | void} - */ - collateral_return(): TransactionOutput | void; - - /** - * @param {BigNum} total_collateral - */ - set_total_collateral(total_collateral: BigNum): void; - - /** - * @returns {BigNum | void} - */ - total_collateral(): BigNum | void; - - /** - * !!! DEPRECATED !!! - * This constructor uses outdated slot number format for the ttl value. - * Use `.new_tx_body` and then `.set_ttl` instead - * @param {TransactionInputs} inputs - * @param {TransactionOutputs} outputs - * @param {BigNum} fee - * @param {number | void} ttl - * @returns {TransactionBody} - */ - static new( - inputs: TransactionInputs, - outputs: TransactionOutputs, - fee: BigNum, - ttl?: number - ): TransactionBody; - - /** - * Returns a new TransactionBody. - * In the new version of "new" we removed optional ttl for support it by wasm_bingen. - * Your can use "set_ttl" and "remove_ttl" to set a new value for ttl or set it as None. - * @param {TransactionInputs} inputs - * @param {TransactionOutputs} outputs - * @param {BigNum} fee - * @returns {TransactionBody} - */ - static new_tx_body( - inputs: TransactionInputs, - outputs: TransactionOutputs, - fee: BigNum - ): TransactionBody; -} -/** - */ -declare export class TransactionBuilder { - free(): void; - - /** - * This automatically selects and adds inputs from {inputs} consisting of just enough to cover - * the outputs that have already been added. - * This should be called after adding all certs/outputs/etc and will be an error otherwise. - * Uses CIP2: https://github.com/cardano-foundation/CIPs/blob/master/CIP-0002/CIP-0002.md - * Adding a change output must be called after via TransactionBuilder::add_change_if_needed() - * This function, diverging from CIP2, takes into account fees and will attempt to add additional - * inputs to cover the minimum fees. This does not, however, set the txbuilder's fee. - * @param {TransactionUnspentOutputs} inputs - * @param {number} strategy - */ - add_inputs_from(inputs: TransactionUnspentOutputs, strategy: number): void; - - /** - * @param {TxInputsBuilder} inputs - */ - set_inputs(inputs: TxInputsBuilder): void; - - /** - * @returns {TransactionOutputs} - */ - reset_outputs(): TransactionOutputs; - - /** - * @param {TxInputsBuilder} collateral - */ - set_collateral(collateral: TxInputsBuilder): void; - - /** - * @param {TransactionOutput} collateral_return - */ - set_collateral_return(collateral_return: TransactionOutput): void; - - /** - * This function will set the collateral-return value and then auto-calculate and assign - * the total collateral coin value. Will raise an error in case no collateral inputs are set - * or in case the total collateral value will have any assets in it except coin. - * @param {TransactionOutput} collateral_return - */ - set_collateral_return_and_total(collateral_return: TransactionOutput): void; - - /** - * @param {BigNum} total_collateral - */ - set_total_collateral(total_collateral: BigNum): void; - - /** - * This function will set the total-collateral coin and then auto-calculate and assign - * the collateral return value. Will raise an error in case no collateral inputs are set. - * The specified address will be the received of the collateral return - * @param {BigNum} total_collateral - * @param {Address} return_address - */ - set_total_collateral_and_return( - total_collateral: BigNum, - return_address: Address - ): void; - - /** - * @param {TransactionInput} reference_input - */ - add_reference_input(reference_input: TransactionInput): void; - - /** - * We have to know what kind of inputs these are to know what kind of mock witnesses to create since - * 1) mock witnesses have different lengths depending on the type which changes the expecting fee - * 2) Witnesses are a set so we need to get rid of duplicates to avoid over-estimating the fee - * @param {Ed25519KeyHash} hash - * @param {TransactionInput} input - * @param {Value} amount - */ - add_key_input( - hash: Ed25519KeyHash, - input: TransactionInput, - amount: Value - ): void; - - /** - * 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` - * and `.add_required_plutus_input_scripts` to add the witness scripts - * - * Or instead use `.add_native_script_input` and `.add_plutus_script_input` - * to add inputs right along with the script, instead of the script hash - * @param {ScriptHash} hash - * @param {TransactionInput} input - * @param {Value} amount - */ - add_script_input( - hash: ScriptHash, - input: TransactionInput, - amount: Value - ): void; - - /** - * This method will add the input to the builder and also register the required native script witness - * @param {NativeScript} script - * @param {TransactionInput} input - * @param {Value} amount - */ - add_native_script_input( - script: NativeScript, - input: TransactionInput, - amount: Value - ): void; - - /** - * This method will add the input to the builder and also register the required plutus witness - * @param {PlutusWitness} witness - * @param {TransactionInput} input - * @param {Value} amount - */ - add_plutus_script_input( - witness: PlutusWitness, - input: TransactionInput, - amount: Value - ): void; - - /** - * @param {ByronAddress} hash - * @param {TransactionInput} input - * @param {Value} amount - */ - add_bootstrap_input( - hash: ByronAddress, - input: TransactionInput, - amount: Value - ): void; - - /** - * Note that for script inputs this method will use underlying generic `.add_script_input` - * which leaves a required empty spot for the script witness (or witnesses in case of Plutus). - * You can use `.add_native_script_input` or `.add_plutus_script_input` directly to register the input along with the witness. - * @param {Address} address - * @param {TransactionInput} input - * @param {Value} amount - */ - add_input(address: Address, input: TransactionInput, amount: Value): void; - - /** - * Returns the number of still missing input scripts (either native or plutus) - * Use `.add_required_native_input_scripts` or `.add_required_plutus_input_scripts` to add the missing scripts - * @returns {number} - */ - count_missing_input_scripts(): 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 {NativeScripts} scripts - * @returns {number} - */ - add_required_native_input_scripts(scripts: NativeScripts): 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 {PlutusWitnesses} scripts - * @returns {number} - */ - add_required_plutus_input_scripts(scripts: PlutusWitnesses): number; - - /** - * Returns a copy of the current script input witness scripts in the builder - * @returns {NativeScripts | void} - */ - get_native_input_scripts(): NativeScripts | void; - - /** - * Returns a copy of the current plutus input witness scripts in the builder. - * NOTE: each plutus witness will be cloned with a specific corresponding input index - * @returns {PlutusWitnesses | void} - */ - get_plutus_input_scripts(): PlutusWitnesses | void; - - /** - * calculates how much the fee would increase if you added a given output - * @param {Address} address - * @param {TransactionInput} input - * @param {Value} amount - * @returns {BigNum} - */ - fee_for_input( - address: Address, - input: TransactionInput, - amount: Value - ): BigNum; - - /** - * Add explicit output via a TransactionOutput object - * @param {TransactionOutput} output - */ - add_output(output: TransactionOutput): void; - - /** - * calculates how much the fee would increase if you added a given output - * @param {TransactionOutput} output - * @returns {BigNum} - */ - fee_for_output(output: TransactionOutput): BigNum; - - /** - * @param {BigNum} fee - */ - set_fee(fee: BigNum): void; - - /** - * !!! DEPRECATED !!! - * Set ttl value. - * @param {number} ttl - */ - set_ttl(ttl: number): void; - - /** - * @param {BigNum} ttl - */ - set_ttl_bignum(ttl: BigNum): void; - - /** - * !!! DEPRECATED !!! - * Uses outdated slot number format. - * @param {number} validity_start_interval - */ - set_validity_start_interval(validity_start_interval: number): void; - - /** - * @param {BigNum} validity_start_interval - */ - set_validity_start_interval_bignum(validity_start_interval: BigNum): void; - - /** - * @param {Certificates} certs - */ - set_certs(certs: Certificates): void; - - /** - * @param {Withdrawals} withdrawals - */ - set_withdrawals(withdrawals: Withdrawals): void; - - /** - * @param {RewardAddress} reward_address - * @returns {number | void} - */ - get_index_of_withdrawal(reward_address: RewardAddress): number | void; - - /** - * @returns {AuxiliaryData | void} - */ - get_auxiliary_data(): AuxiliaryData | void; - - /** - * Set explicit auxiliary data via an AuxiliaryData object - * It might contain some metadata plus native or Plutus scripts - * @param {AuxiliaryData} auxiliary_data - */ - set_auxiliary_data(auxiliary_data: AuxiliaryData): void; - - /** - * Set metadata using a GeneralTransactionMetadata object - * It will be set to the existing or new auxiliary data in this builder - * @param {GeneralTransactionMetadata} metadata - */ - set_metadata(metadata: GeneralTransactionMetadata): void; - - /** - * Add a single metadatum using TransactionMetadatumLabel and TransactionMetadatum objects - * It will be securely added to existing or new metadata in this builder - * @param {BigNum} key - * @param {TransactionMetadatum} val - */ - add_metadatum(key: BigNum, val: TransactionMetadatum): void; - - /** - * Add a single JSON metadatum using a TransactionMetadatumLabel and a String - * It will be securely added to existing or new metadata in this builder - * @param {BigNum} key - * @param {string} val - */ - add_json_metadatum(key: BigNum, val: string): void; - - /** - * Add a single JSON metadatum using a TransactionMetadatumLabel, a String, and a MetadataJsonSchema object - * It will be securely added to existing or new metadata in this builder - * @param {BigNum} key - * @param {string} val - * @param {number} schema - */ - add_json_metadatum_with_schema( - key: BigNum, - val: string, - schema: number - ): void; - - /** - * @returns {PlutusScripts | void} - */ - get_plutus_scripts(): PlutusScripts | void; - - /** - * @param {PlutusScripts} plutus_scripts - */ - set_plutus_scripts(plutus_scripts: PlutusScripts): void; - - /** - * @returns {PlutusList | void} - */ - get_plutus_data(): PlutusList | void; - - /** - * @param {PlutusList} plutus_data - */ - set_plutus_data(plutus_data: PlutusList): void; - - /** - * @returns {Redeemers | void} - */ - get_redeemers(): Redeemers | void; - - /** - * @param {Redeemers} redeemers - */ - set_redeemers(redeemers: Redeemers): void; - - /** - * @param {TransactionInput} input - * @returns {number} - */ - index_of_input(input: TransactionInput): number; - - /** - * @returns {TransactionInputs} - */ - get_inputs(): TransactionInputs; - - /** - * 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 - * @param {Mint} mint - * @param {NativeScripts} mint_scripts - */ - set_mint(mint: Mint, mint_scripts: NativeScripts): void; - - /** - * Returns a copy of the current mint state in the builder - * @returns {Mint | void} - */ - get_mint(): Mint | void; - - /** - * Returns a copy of the current mint witness scripts in the builder - * @returns {NativeScripts | void} - */ - get_mint_scripts(): NativeScripts | void; - - /** - * 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 - * @param {NativeScript} policy_script - * @param {MintAssets} mint_assets - */ - set_mint_asset(policy_script: NativeScript, mint_assets: MintAssets): void; - - /** - * 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 - * @param {NativeScript} policy_script - * @param {AssetName} asset_name - * @param {Int} amount - */ - add_mint_asset( - policy_script: NativeScript, - asset_name: AssetName, - amount: Int - ): void; - - /** - * Add a mint entry together with an output to this builder - * Using a PolicyID, AssetName, Int for amount, Address, and Coin (BigNum) objects - * The asset will be securely added to existing or new Mint in this builder - * A new output will be added with the specified Address, the Coin value, and the minted asset - * @param {NativeScript} policy_script - * @param {AssetName} asset_name - * @param {Int} amount - * @param {TransactionOutputAmountBuilder} output_builder - * @param {BigNum} output_coin - */ - add_mint_asset_and_output( - policy_script: NativeScript, - asset_name: AssetName, - amount: Int, - output_builder: TransactionOutputAmountBuilder, - output_coin: BigNum - ): void; - - /** - * Add a mint entry together with an output to this builder - * Using a PolicyID, AssetName, Int for amount, and Address objects - * The asset will be securely added to existing or new Mint in this builder - * A new output will be added with the specified Address and the minted asset - * The output will be set to contain the minimum required amount of Coin - * @param {NativeScript} policy_script - * @param {AssetName} asset_name - * @param {Int} amount - * @param {TransactionOutputAmountBuilder} output_builder - */ - add_mint_asset_and_output_min_required_coin( - policy_script: NativeScript, - asset_name: AssetName, - amount: Int, - output_builder: TransactionOutputAmountBuilder - ): void; - - /** - * @param {TransactionBuilderConfig} cfg - * @returns {TransactionBuilder} - */ - static new(cfg: TransactionBuilderConfig): TransactionBuilder; - - /** - * @returns {TransactionInputs} - */ - get_reference_inputs(): TransactionInputs; - - /** - * does not include refunds or withdrawals - * @returns {Value} - */ - get_explicit_input(): Value; - - /** - * withdrawals and refunds - * @returns {Value} - */ - get_implicit_input(): Value; - - /** - * Return explicit input plus implicit input plus mint - * @returns {Value} - */ - get_total_input(): Value; - - /** - * Return explicit output plus deposit plus burn - * @returns {Value} - */ - get_total_output(): Value; - - /** - * does not include fee - * @returns {Value} - */ - get_explicit_output(): Value; - - /** - * @returns {BigNum} - */ - get_deposit(): BigNum; - - /** - * @returns {BigNum | void} - */ - get_fee_if_set(): BigNum | void; - - /** - * Warning: this function will mutate the /fee/ field - * Make sure to call this function last after setting all other tx-body properties - * Editing inputs, outputs, mint, etc. after change been calculated - * might cause a mismatch in calculated fee versus the required fee - * @param {Address} address - * @returns {boolean} - */ - add_change_if_needed(address: Address): boolean; - - /** - * This method will calculate the script hash data - * using the plutus datums and redeemers already present in the builder - * along with the provided cost model, and will register the calculated value - * in the builder to be used when building the tx body. - * In case there are no plutus input witnesses present - nothing will change - * You can set specific hash value using `.set_script_data_hash` - * NOTE: this function will check which language versions are used in the present scripts - * and will assert and require for a corresponding cost-model to be present in the passed map. - * Only the cost-models for the present language versions will be used in the hash calculation. - * @param {Costmdls} cost_models - */ - calc_script_data_hash(cost_models: Costmdls): void; - - /** - * Sets the specified hash value. - * Alternatively you can use `.calc_script_data_hash` to calculate the hash automatically. - * Or use `.remove_script_data_hash` to delete the previously set value - * @param {ScriptDataHash} hash - */ - set_script_data_hash(hash: ScriptDataHash): void; - - /** - * Deletes any previously set plutus data hash value. - * Use `.set_script_data_hash` or `.calc_script_data_hash` to set it. - */ - remove_script_data_hash(): void; - - /** - * @param {Ed25519KeyHash} key - */ - add_required_signer(key: Ed25519KeyHash): void; - - /** - * @returns {number} - */ - full_size(): number; - - /** - * @returns {Uint32Array} - */ - output_sizes(): Uint32Array; - - /** - * @returns {Uint32Array} - */ - input_sizes(): Uint32Array; - - /** - * @returns {LinearFee} - */ - fee_algo(): LinearFee; - - /** - * Returns object the body of the new transaction - * Auxiliary data itself is not included - * You can use `get_auxiliary_data` or `build_tx` - * @returns {TransactionBody} - */ - build(): TransactionBody; - - /** - * Returns full Transaction object with the body and the auxiliary data - * NOTE: witness_set will contain all mint_scripts if any been added or set - * NOTE: is_valid set to true - * NOTE: Will fail in case there are any script inputs added with no corresponding witness - * @returns {Transaction} - */ - build_tx(): Transaction; - - /** - * Similar to `.build_tx()` but will NOT fail in case there are missing script witnesses - * @returns {Transaction} - */ - build_tx_unsafe(): Transaction; - - /** - * warning: sum of all parts of a transaction must equal 0. You cannot just set the fee to the min value and forget about it - * warning: min_fee may be slightly larger than the actual minimum fee (ex: a few lovelaces) - * this is done to simplify the library code, but can be fixed later - * @returns {BigNum} - */ - min_fee(): BigNum; - - /** - * @returns {number} - */ - fake_tx_full_size(): number; -} -/** - */ -declare export class TransactionBuilderConfig { - free(): void; -} -/** - */ -declare export class TransactionBuilderConfigBuilder { - free(): void; - - /** - * @returns {TransactionBuilderConfigBuilder} - */ - static new(): TransactionBuilderConfigBuilder; - - /** - * @param {LinearFee} fee_algo - * @returns {TransactionBuilderConfigBuilder} - */ - fee_algo(fee_algo: LinearFee): TransactionBuilderConfigBuilder; - - /** - * !!! DEPRECATED !!! - * Since babbage era cardano nodes use coins per byte. Use '.coins_per_utxo_byte' instead. - * @param {BigNum} coins_per_utxo_word - * @returns {TransactionBuilderConfigBuilder} - */ - coins_per_utxo_word( - coins_per_utxo_word: BigNum - ): TransactionBuilderConfigBuilder; - - /** - * @param {BigNum} coins_per_utxo_byte - * @returns {TransactionBuilderConfigBuilder} - */ - coins_per_utxo_byte( - coins_per_utxo_byte: BigNum - ): TransactionBuilderConfigBuilder; - - /** - * @param {ExUnitPrices} ex_unit_prices - * @returns {TransactionBuilderConfigBuilder} - */ - ex_unit_prices(ex_unit_prices: ExUnitPrices): TransactionBuilderConfigBuilder; - - /** - * @param {BigNum} pool_deposit - * @returns {TransactionBuilderConfigBuilder} - */ - pool_deposit(pool_deposit: BigNum): TransactionBuilderConfigBuilder; - - /** - * @param {BigNum} key_deposit - * @returns {TransactionBuilderConfigBuilder} - */ - key_deposit(key_deposit: BigNum): TransactionBuilderConfigBuilder; - - /** - * @param {number} max_value_size - * @returns {TransactionBuilderConfigBuilder} - */ - max_value_size(max_value_size: number): TransactionBuilderConfigBuilder; - - /** - * @param {number} max_tx_size - * @returns {TransactionBuilderConfigBuilder} - */ - max_tx_size(max_tx_size: number): TransactionBuilderConfigBuilder; - - /** - * @param {boolean} prefer_pure_change - * @returns {TransactionBuilderConfigBuilder} - */ - prefer_pure_change( - prefer_pure_change: boolean - ): TransactionBuilderConfigBuilder; - - /** - * @param {boolean} minswap_mode - * @returns {TransactionBuilderConfigBuilder} - */ - minswap_mode(minswap_mode: boolean): TransactionBuilderConfigBuilder; - - /** - * @returns {TransactionBuilderConfig} - */ - build(): TransactionBuilderConfig; -} -/** - */ -declare export class TransactionHash { - free(): void; - - /** - * @param {Uint8Array} bytes - * @returns {TransactionHash} - */ - static from_bytes(bytes: Uint8Array): TransactionHash; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {string} prefix - * @returns {string} - */ - to_bech32(prefix: string): string; - - /** - * @param {string} bech_str - * @returns {TransactionHash} - */ - static from_bech32(bech_str: string): TransactionHash; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex - * @returns {TransactionHash} - */ - static from_hex(hex: string): TransactionHash; -} -/** - */ -declare export class TransactionInput { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {TransactionInput} - */ - static from_bytes(bytes: Uint8Array): TransactionInput; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {TransactionInput} - */ - static from_hex(hex_str: string): TransactionInput; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {TransactionInputJSON} - */ - to_js_value(): TransactionInputJSON; - - /** - * @param {string} json - * @returns {TransactionInput} - */ - static from_json(json: string): TransactionInput; - - /** - * @returns {TransactionHash} - */ - transaction_id(): TransactionHash; - - /** - * @returns {number} - */ - index(): number; - - /** - * @param {TransactionHash} transaction_id - * @param {number} index - * @returns {TransactionInput} - */ - static new(transaction_id: TransactionHash, index: number): TransactionInput; -} -/** - */ -declare export class TransactionInputs { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {TransactionInputs} - */ - static from_bytes(bytes: Uint8Array): TransactionInputs; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {TransactionInputs} - */ - static from_hex(hex_str: string): TransactionInputs; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {TransactionInputsJSON} - */ - to_js_value(): TransactionInputsJSON; - - /** - * @param {string} json - * @returns {TransactionInputs} - */ - static from_json(json: string): TransactionInputs; - - /** - * @returns {TransactionInputs} - */ - static new(): TransactionInputs; - - /** - * @returns {number} - */ - len(): number; - - /** - * @param {number} index - * @returns {TransactionInput} - */ - get(index: number): TransactionInput; - - /** - * @param {TransactionInput} elem - */ - add(elem: TransactionInput): void; - - /** - * @returns {TransactionInputs | void} - */ - to_option(): TransactionInputs | void; -} -/** - */ -declare export class TransactionMetadatum { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {TransactionMetadatum} - */ - static from_bytes(bytes: Uint8Array): TransactionMetadatum; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {TransactionMetadatum} - */ - static from_hex(hex_str: string): TransactionMetadatum; - - /** - * @param {MetadataMap} map - * @returns {TransactionMetadatum} - */ - static new_map(map: MetadataMap): TransactionMetadatum; - - /** - * @param {MetadataList} list - * @returns {TransactionMetadatum} - */ - static new_list(list: MetadataList): TransactionMetadatum; - - /** - * @param {Int} int - * @returns {TransactionMetadatum} - */ - static new_int(int: Int): TransactionMetadatum; - - /** - * @param {Uint8Array} bytes - * @returns {TransactionMetadatum} - */ - static new_bytes(bytes: Uint8Array): TransactionMetadatum; - - /** - * @param {string} text - * @returns {TransactionMetadatum} - */ - static new_text(text: string): TransactionMetadatum; - - /** - * @returns {number} - */ - kind(): number; - - /** - * @returns {MetadataMap} - */ - as_map(): MetadataMap; - - /** - * @returns {MetadataList} - */ - as_list(): MetadataList; - - /** - * @returns {Int} - */ - as_int(): Int; - - /** - * @returns {Uint8Array} - */ - as_bytes(): Uint8Array; - - /** - * @returns {string} - */ - as_text(): string; -} -/** - */ -declare export class TransactionMetadatumLabels { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {TransactionMetadatumLabels} - */ - static from_bytes(bytes: Uint8Array): TransactionMetadatumLabels; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {TransactionMetadatumLabels} - */ - static from_hex(hex_str: string): TransactionMetadatumLabels; - - /** - * @returns {TransactionMetadatumLabels} - */ - static new(): TransactionMetadatumLabels; - - /** - * @returns {number} - */ - len(): number; - - /** - * @param {number} index - * @returns {BigNum} - */ - get(index: number): BigNum; - - /** - * @param {BigNum} elem - */ - add(elem: BigNum): void; -} -/** - */ -declare export class TransactionOutput { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {TransactionOutput} - */ - static from_bytes(bytes: Uint8Array): TransactionOutput; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {TransactionOutput} - */ - static from_hex(hex_str: string): TransactionOutput; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {TransactionOutputJSON} - */ - to_js_value(): TransactionOutputJSON; - - /** - * @param {string} json - * @returns {TransactionOutput} - */ - static from_json(json: string): TransactionOutput; - - /** - * @returns {Address} - */ - address(): Address; - - /** - * @returns {Value} - */ - amount(): Value; - - /** - * @returns {DataHash | void} - */ - data_hash(): DataHash | void; - - /** - * @returns {PlutusData | void} - */ - plutus_data(): PlutusData | void; - - /** - * @returns {ScriptRef | void} - */ - script_ref(): ScriptRef | void; - - /** - * @param {ScriptRef} script_ref - */ - set_script_ref(script_ref: ScriptRef): void; - - /** - * @param {PlutusData} data - */ - set_plutus_data(data: PlutusData): void; - - /** - * @param {DataHash} data_hash - */ - set_data_hash(data_hash: DataHash): void; - - /** - * @returns {boolean} - */ - has_plutus_data(): boolean; - - /** - * @returns {boolean} - */ - has_data_hash(): boolean; - - /** - * @returns {boolean} - */ - has_script_ref(): boolean; - - /** - * @param {Address} address - * @param {Value} amount - * @returns {TransactionOutput} - */ - static new(address: Address, amount: Value): TransactionOutput; -} -/** - */ -declare export class TransactionOutputAmountBuilder { - free(): void; - - /** - * @param {Value} amount - * @returns {TransactionOutputAmountBuilder} - */ - with_value(amount: Value): TransactionOutputAmountBuilder; - - /** - * @param {BigNum} coin - * @returns {TransactionOutputAmountBuilder} - */ - with_coin(coin: BigNum): TransactionOutputAmountBuilder; - - /** - * @param {BigNum} coin - * @param {MultiAsset} multiasset - * @returns {TransactionOutputAmountBuilder} - */ - with_coin_and_asset( - coin: BigNum, - multiasset: MultiAsset - ): TransactionOutputAmountBuilder; - - /** - * !!! DEPRECATED !!! - * Since babbage era cardano nodes use coins per byte. Use '.with_asset_and_min_required_coin_by_utxo_cost' instead. - * @param {MultiAsset} multiasset - * @param {BigNum} coins_per_utxo_word - * @returns {TransactionOutputAmountBuilder} - */ - with_asset_and_min_required_coin( - multiasset: MultiAsset, - coins_per_utxo_word: BigNum - ): TransactionOutputAmountBuilder; - - /** - * @param {MultiAsset} multiasset - * @param {DataCost} data_cost - * @returns {TransactionOutputAmountBuilder} - */ - with_asset_and_min_required_coin_by_utxo_cost( - multiasset: MultiAsset, - data_cost: DataCost - ): TransactionOutputAmountBuilder; - - /** - * @returns {TransactionOutput} - */ - build(): TransactionOutput; -} -/** - * We introduce a builder-pattern format for creating transaction outputs - * This is because: - * 1. Some fields (i.e. data hash) are optional, and we can't easily expose Option<> in WASM - * 2. Some fields like amounts have many ways it could be set (some depending on other field values being known) - * 3. Easier to adapt as the output format gets more complicated in future Cardano releases - */ -declare export class TransactionOutputBuilder { - free(): void; - - /** - * @returns {TransactionOutputBuilder} - */ - static new(): TransactionOutputBuilder; - - /** - * @param {Address} address - * @returns {TransactionOutputBuilder} - */ - with_address(address: Address): TransactionOutputBuilder; - - /** - * @param {DataHash} data_hash - * @returns {TransactionOutputBuilder} - */ - with_data_hash(data_hash: DataHash): TransactionOutputBuilder; - - /** - * @param {PlutusData} data - * @returns {TransactionOutputBuilder} - */ - with_plutus_data(data: PlutusData): TransactionOutputBuilder; - - /** - * @param {ScriptRef} script_ref - * @returns {TransactionOutputBuilder} - */ - with_script_ref(script_ref: ScriptRef): TransactionOutputBuilder; - - /** - * @returns {TransactionOutputAmountBuilder} - */ - next(): TransactionOutputAmountBuilder; -} -/** - */ -declare export class TransactionOutputs { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {TransactionOutputs} - */ - static from_bytes(bytes: Uint8Array): TransactionOutputs; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {TransactionOutputs} - */ - static from_hex(hex_str: string): TransactionOutputs; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {TransactionOutputsJSON} - */ - to_js_value(): TransactionOutputsJSON; - - /** - * @param {string} json - * @returns {TransactionOutputs} - */ - static from_json(json: string): TransactionOutputs; - - /** - * @returns {TransactionOutputs} - */ - static new(): TransactionOutputs; - - /** - * @returns {number} - */ - len(): number; - - /** - * @param {number} index - * @returns {TransactionOutput} - */ - get(index: number): TransactionOutput; - - /** - * @param {TransactionOutput} elem - */ - add(elem: TransactionOutput): void; -} -/** - */ -declare export class TransactionUnspentOutput { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {TransactionUnspentOutput} - */ - static from_bytes(bytes: Uint8Array): TransactionUnspentOutput; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {TransactionUnspentOutput} - */ - static from_hex(hex_str: string): TransactionUnspentOutput; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {TransactionUnspentOutputJSON} - */ - to_js_value(): TransactionUnspentOutputJSON; - - /** - * @param {string} json - * @returns {TransactionUnspentOutput} - */ - static from_json(json: string): TransactionUnspentOutput; - - /** - * @param {TransactionInput} input - * @param {TransactionOutput} output - * @returns {TransactionUnspentOutput} - */ - static new( - input: TransactionInput, - output: TransactionOutput - ): TransactionUnspentOutput; - - /** - * @returns {TransactionInput} - */ - input(): TransactionInput; - - /** - * @returns {TransactionOutput} - */ - output(): TransactionOutput; -} -/** - */ -declare export class TransactionUnspentOutputs { - free(): void; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {TransactionUnspentOutputsJSON} - */ - to_js_value(): TransactionUnspentOutputsJSON; - - /** - * @param {string} json - * @returns {TransactionUnspentOutputs} - */ - static from_json(json: string): TransactionUnspentOutputs; - - /** - * @returns {TransactionUnspentOutputs} - */ - static new(): TransactionUnspentOutputs; - - /** - * @returns {number} - */ - len(): number; - - /** - * @param {number} index - * @returns {TransactionUnspentOutput} - */ - get(index: number): TransactionUnspentOutput; - - /** - * @param {TransactionUnspentOutput} elem - */ - add(elem: TransactionUnspentOutput): void; -} -/** - */ -declare export class TransactionWitnessSet { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {TransactionWitnessSet} - */ - static from_bytes(bytes: Uint8Array): TransactionWitnessSet; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {TransactionWitnessSet} - */ - static from_hex(hex_str: string): TransactionWitnessSet; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {TransactionWitnessSetJSON} - */ - to_js_value(): TransactionWitnessSetJSON; - - /** - * @param {string} json - * @returns {TransactionWitnessSet} - */ - static from_json(json: string): TransactionWitnessSet; - - /** - * @param {Vkeywitnesses} vkeys - */ - set_vkeys(vkeys: Vkeywitnesses): void; - - /** - * @returns {Vkeywitnesses | void} - */ - vkeys(): Vkeywitnesses | void; - - /** - * @param {NativeScripts} native_scripts - */ - set_native_scripts(native_scripts: NativeScripts): void; - - /** - * @returns {NativeScripts | void} - */ - native_scripts(): NativeScripts | void; - - /** - * @param {BootstrapWitnesses} bootstraps - */ - set_bootstraps(bootstraps: BootstrapWitnesses): void; - - /** - * @returns {BootstrapWitnesses | void} - */ - bootstraps(): BootstrapWitnesses | void; - - /** - * @param {PlutusScripts} plutus_scripts - */ - set_plutus_scripts(plutus_scripts: PlutusScripts): void; - - /** - * @returns {PlutusScripts | void} - */ - plutus_scripts(): PlutusScripts | void; - - /** - * @param {PlutusList} plutus_data - */ - set_plutus_data(plutus_data: PlutusList): void; - - /** - * @returns {PlutusList | void} - */ - plutus_data(): PlutusList | void; - - /** - * @param {Redeemers} redeemers - */ - set_redeemers(redeemers: Redeemers): void; - - /** - * @returns {Redeemers | void} - */ - redeemers(): Redeemers | void; - - /** - * @returns {TransactionWitnessSet} - */ - static new(): TransactionWitnessSet; -} -/** - */ -declare export class TransactionWitnessSets { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {TransactionWitnessSets} - */ - static from_bytes(bytes: Uint8Array): TransactionWitnessSets; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {TransactionWitnessSets} - */ - static from_hex(hex_str: string): TransactionWitnessSets; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {TransactionWitnessSetsJSON} - */ - to_js_value(): TransactionWitnessSetsJSON; - - /** - * @param {string} json - * @returns {TransactionWitnessSets} - */ - static from_json(json: string): TransactionWitnessSets; - - /** - * @returns {TransactionWitnessSets} - */ - static new(): TransactionWitnessSets; - - /** - * @returns {number} - */ - len(): number; - - /** - * @param {number} index - * @returns {TransactionWitnessSet} - */ - get(index: number): TransactionWitnessSet; - - /** - * @param {TransactionWitnessSet} elem - */ - add(elem: TransactionWitnessSet): void; -} -/** - */ -declare export class TxBuilderConstants { - free(): void; - - /** - * @returns {Costmdls} - */ - static plutus_default_cost_models(): Costmdls; - - /** - * @returns {Costmdls} - */ - static plutus_alonzo_cost_models(): Costmdls; - - /** - * @returns {Costmdls} - */ - static plutus_vasil_cost_models(): Costmdls; -} -/** - */ -declare export class TxInputsBuilder { - free(): void; - - /** - * @returns {TxInputsBuilder} - */ - static new(): TxInputsBuilder; - - /** - * We have to know what kind of inputs these are to know what kind of mock witnesses to create since - * 1) mock witnesses have different lengths depending on the type which changes the expecting fee - * 2) Witnesses are a set so we need to get rid of duplicates to avoid over-estimating the fee - * @param {Ed25519KeyHash} hash - * @param {TransactionInput} input - * @param {Value} amount - */ - add_key_input( - hash: Ed25519KeyHash, - input: TransactionInput, - amount: Value - ): void; - - /** - * 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` - * and `.add_required_plutus_input_scripts` to add the witness scripts - * - * Or instead use `.add_native_script_input` and `.add_plutus_script_input` - * to add inputs right along with the script, instead of the script hash - * @param {ScriptHash} hash - * @param {TransactionInput} input - * @param {Value} amount - */ - add_script_input( - hash: ScriptHash, - input: TransactionInput, - amount: Value - ): void; - - /** - * This method will add the input to the builder and also register the required native script witness - * @param {NativeScript} script - * @param {TransactionInput} input - * @param {Value} amount - */ - add_native_script_input( - script: NativeScript, - input: TransactionInput, - amount: Value - ): void; - - /** - * This method will add the input to the builder and also register the required plutus witness - * @param {PlutusWitness} witness - * @param {TransactionInput} input - * @param {Value} amount - */ - add_plutus_script_input( - witness: PlutusWitness, - input: TransactionInput, - amount: Value - ): void; - - /** - * @param {ByronAddress} hash - * @param {TransactionInput} input - * @param {Value} amount - */ - add_bootstrap_input( - hash: ByronAddress, - input: TransactionInput, - amount: Value - ): void; - - /** - * Note that for script inputs this method will use underlying generic `.add_script_input` - * which leaves a required empty spot for the script witness (or witnesses in case of Plutus). - * You can use `.add_native_script_input` or `.add_plutus_script_input` directly to register the input along with the witness. - * @param {Address} address - * @param {TransactionInput} input - * @param {Value} amount - */ - add_input(address: Address, input: TransactionInput, amount: Value): void; - - /** - * Returns the number of still missing input scripts (either native or plutus) - * Use `.add_required_native_input_scripts` or `.add_required_plutus_input_scripts` to add the missing scripts - * @returns {number} - */ - count_missing_input_scripts(): 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 {NativeScripts} scripts - * @returns {number} - */ - add_required_native_input_scripts(scripts: NativeScripts): 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 {PlutusWitnesses} scripts - * @returns {number} - */ - add_required_plutus_input_scripts(scripts: PlutusWitnesses): number; - - /** - * @returns {TransactionInputs} - */ - get_ref_inputs(): TransactionInputs; - - /** - * Returns a copy of the current script input witness scripts in the builder - * @returns {NativeScripts | void} - */ - get_native_input_scripts(): NativeScripts | void; - - /** - * Returns a copy of the current plutus input witness scripts in the builder. - * NOTE: each plutus witness will be cloned with a specific corresponding input index - * @returns {PlutusWitnesses | void} - */ - get_plutus_input_scripts(): PlutusWitnesses | void; - - /** - * @returns {number} - */ - len(): number; - - /** - * @param {Ed25519KeyHash} key - */ - add_required_signer(key: Ed25519KeyHash): void; - - /** - * @param {Ed25519KeyHashes} keys - */ - add_required_signers(keys: Ed25519KeyHashes): void; - - /** - * @returns {Value} - */ - total_value(): Value; - - /** - * @returns {TransactionInputs} - */ - inputs(): TransactionInputs; - - /** - * @returns {TransactionInputs | void} - */ - inputs_option(): TransactionInputs | void; -} -/** - */ -declare export class URL { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {URL} - */ - static from_bytes(bytes: Uint8Array): URL; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {URL} - */ - static from_hex(hex_str: string): URL; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {URLJSON} - */ - to_js_value(): URLJSON; - - /** - * @param {string} json - * @returns {URL} - */ - static from_json(json: string): URL; - - /** - * @param {string} url - * @returns {URL} - */ - static new(url: string): URL; - - /** - * @returns {string} - */ - url(): string; -} -/** - */ -declare export class UnitInterval { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {UnitInterval} - */ - static from_bytes(bytes: Uint8Array): UnitInterval; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {UnitInterval} - */ - static from_hex(hex_str: string): UnitInterval; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {UnitIntervalJSON} - */ - to_js_value(): UnitIntervalJSON; - - /** - * @param {string} json - * @returns {UnitInterval} - */ - static from_json(json: string): UnitInterval; - - /** - * @returns {BigNum} - */ - numerator(): BigNum; - - /** - * @returns {BigNum} - */ - denominator(): BigNum; - - /** - * @param {BigNum} numerator - * @param {BigNum} denominator - * @returns {UnitInterval} - */ - static new(numerator: BigNum, denominator: BigNum): UnitInterval; -} -/** - */ -declare export class Update { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {Update} - */ - static from_bytes(bytes: Uint8Array): Update; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {Update} - */ - static from_hex(hex_str: string): Update; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {UpdateJSON} - */ - to_js_value(): UpdateJSON; - - /** - * @param {string} json - * @returns {Update} - */ - static from_json(json: string): Update; - - /** - * @returns {ProposedProtocolParameterUpdates} - */ - proposed_protocol_parameter_updates(): ProposedProtocolParameterUpdates; - - /** - * @returns {number} - */ - epoch(): number; - - /** - * @param {ProposedProtocolParameterUpdates} proposed_protocol_parameter_updates - * @param {number} epoch - * @returns {Update} - */ - static new( - proposed_protocol_parameter_updates: ProposedProtocolParameterUpdates, - epoch: number - ): Update; -} -/** - */ -declare export class VRFCert { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {VRFCert} - */ - static from_bytes(bytes: Uint8Array): VRFCert; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {VRFCert} - */ - static from_hex(hex_str: string): VRFCert; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {VRFCertJSON} - */ - to_js_value(): VRFCertJSON; - - /** - * @param {string} json - * @returns {VRFCert} - */ - static from_json(json: string): VRFCert; - - /** - * @returns {Uint8Array} - */ - output(): Uint8Array; - - /** - * @returns {Uint8Array} - */ - proof(): Uint8Array; - - /** - * @param {Uint8Array} output - * @param {Uint8Array} proof - * @returns {VRFCert} - */ - static new(output: Uint8Array, proof: Uint8Array): VRFCert; -} -/** - */ -declare export class VRFKeyHash { - free(): void; - - /** - * @param {Uint8Array} bytes - * @returns {VRFKeyHash} - */ - static from_bytes(bytes: Uint8Array): VRFKeyHash; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {string} prefix - * @returns {string} - */ - to_bech32(prefix: string): string; - - /** - * @param {string} bech_str - * @returns {VRFKeyHash} - */ - static from_bech32(bech_str: string): VRFKeyHash; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex - * @returns {VRFKeyHash} - */ - static from_hex(hex: string): VRFKeyHash; -} -/** - */ -declare export class VRFVKey { - free(): void; - - /** - * @param {Uint8Array} bytes - * @returns {VRFVKey} - */ - static from_bytes(bytes: Uint8Array): VRFVKey; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {string} prefix - * @returns {string} - */ - to_bech32(prefix: string): string; - - /** - * @param {string} bech_str - * @returns {VRFVKey} - */ - static from_bech32(bech_str: string): VRFVKey; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex - * @returns {VRFVKey} - */ - static from_hex(hex: string): VRFVKey; -} -/** - */ -declare export class Value { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {Value} - */ - static from_bytes(bytes: Uint8Array): Value; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {Value} - */ - static from_hex(hex_str: string): Value; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {ValueJSON} - */ - to_js_value(): ValueJSON; - - /** - * @param {string} json - * @returns {Value} - */ - static from_json(json: string): Value; - - /** - * @param {BigNum} coin - * @returns {Value} - */ - static new(coin: BigNum): Value; - - /** - * @param {MultiAsset} multiasset - * @returns {Value} - */ - static new_from_assets(multiasset: MultiAsset): Value; - - /** - * @param {BigNum} coin - * @param {MultiAsset} multiasset - * @returns {Value} - */ - static new_with_assets(coin: BigNum, multiasset: MultiAsset): Value; - - /** - * @returns {Value} - */ - static zero(): Value; - - /** - * @returns {boolean} - */ - is_zero(): boolean; - - /** - * @returns {BigNum} - */ - coin(): BigNum; - - /** - * @param {BigNum} coin - */ - set_coin(coin: BigNum): void; - - /** - * @returns {MultiAsset | void} - */ - multiasset(): MultiAsset | void; - - /** - * @param {MultiAsset} multiasset - */ - set_multiasset(multiasset: MultiAsset): void; - - /** - * @param {Value} rhs - * @returns {Value} - */ - checked_add(rhs: Value): Value; - - /** - * @param {Value} rhs_value - * @returns {Value} - */ - checked_sub(rhs_value: Value): Value; - - /** - * @param {Value} rhs_value - * @returns {Value} - */ - clamped_sub(rhs_value: Value): Value; - - /** - * note: values are only partially comparable - * @param {Value} rhs_value - * @returns {number | void} - */ - compare(rhs_value: Value): number | void; -} -/** - */ -declare export class Vkey { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {Vkey} - */ - static from_bytes(bytes: Uint8Array): Vkey; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {Vkey} - */ - static from_hex(hex_str: string): Vkey; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {VkeyJSON} - */ - to_js_value(): VkeyJSON; - - /** - * @param {string} json - * @returns {Vkey} - */ - static from_json(json: string): Vkey; - - /** - * @param {PublicKey} pk - * @returns {Vkey} - */ - static new(pk: PublicKey): Vkey; - - /** - * @returns {PublicKey} - */ - public_key(): PublicKey; -} -/** - */ -declare export class Vkeys { - free(): void; - - /** - * @returns {Vkeys} - */ - static new(): Vkeys; - - /** - * @returns {number} - */ - len(): number; - - /** - * @param {number} index - * @returns {Vkey} - */ - get(index: number): Vkey; - - /** - * @param {Vkey} elem - */ - add(elem: Vkey): void; -} -/** - */ -declare export class Vkeywitness { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {Vkeywitness} - */ - static from_bytes(bytes: Uint8Array): Vkeywitness; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {Vkeywitness} - */ - static from_hex(hex_str: string): Vkeywitness; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {VkeywitnessJSON} - */ - to_js_value(): VkeywitnessJSON; - - /** - * @param {string} json - * @returns {Vkeywitness} - */ - static from_json(json: string): Vkeywitness; - - /** - * @param {Vkey} vkey - * @param {Ed25519Signature} signature - * @returns {Vkeywitness} - */ - static new(vkey: Vkey, signature: Ed25519Signature): Vkeywitness; - - /** - * @returns {Vkey} - */ - vkey(): Vkey; - - /** - * @returns {Ed25519Signature} - */ - signature(): Ed25519Signature; -} -/** - */ -declare export class Vkeywitnesses { - free(): void; - - /** - * @returns {Vkeywitnesses} - */ - static new(): Vkeywitnesses; - - /** - * @returns {number} - */ - len(): number; - - /** - * @param {number} index - * @returns {Vkeywitness} - */ - get(index: number): Vkeywitness; - - /** - * @param {Vkeywitness} elem - */ - add(elem: Vkeywitness): void; -} -/** - */ -declare export class Withdrawals { - free(): void; - - /** - * @returns {Uint8Array} - */ - to_bytes(): Uint8Array; - - /** - * @param {Uint8Array} bytes - * @returns {Withdrawals} - */ - static from_bytes(bytes: Uint8Array): Withdrawals; - - /** - * @returns {string} - */ - to_hex(): string; - - /** - * @param {string} hex_str - * @returns {Withdrawals} - */ - static from_hex(hex_str: string): Withdrawals; - - /** - * @returns {string} - */ - to_json(): string; - - /** - * @returns {WithdrawalsJSON} - */ - to_js_value(): WithdrawalsJSON; - - /** - * @param {string} json - * @returns {Withdrawals} - */ - static from_json(json: string): Withdrawals; - - /** - * @returns {Withdrawals} - */ - static new(): Withdrawals; - - /** - * @returns {number} - */ - len(): number; - - /** - * @param {RewardAddress} key - * @param {BigNum} value - * @returns {BigNum | void} - */ - insert(key: RewardAddress, value: BigNum): BigNum | void; - - /** - * @param {RewardAddress} key - * @returns {BigNum | void} - */ - get(key: RewardAddress): BigNum | void; - - /** - * @returns {RewardAddresses} - */ - keys(): RewardAddresses; -} -export type AddressJSON = string; -export type AssetNameJSON = string; -export type AssetNamesJSON = string[]; -export interface AssetsJSON { - [k: string]: string; -} -export interface AuxiliaryDataJSON { - metadata?: { - [k: string]: string, - ... - } | null; - native_scripts?: NativeScriptsJSON | null; - plutus_scripts?: PlutusScriptsJSON | null; - prefer_alonzo_format: boolean; -} -export type AuxiliaryDataHashJSON = string; -export interface AuxiliaryDataSetJSON { - [k: string]: AuxiliaryDataJSON; -} -export type BigIntJSON = string; -export type BigNumJSON = string; -export interface BlockJSON { - auxiliary_data_set: { - [k: string]: AuxiliaryDataJSON, - ... - }; - header: HeaderJSON; - invalid_transactions: number[]; - transaction_bodies: TransactionBodiesJSON; - transaction_witness_sets: TransactionWitnessSetsJSON; -} -export type BlockHashJSON = string; -export interface BootstrapWitnessJSON { - attributes: number[]; - chain_code: number[]; - signature: string; - vkey: VkeyJSON; -} -export type BootstrapWitnessesJSON = BootstrapWitnessJSON[]; -export type CertificateJSON = CertificateEnumJSON; -export type CertificateEnumJSON = - | { - StakeRegistrationJSON: StakeRegistration, - ... - } - | { - StakeDeregistrationJSON: StakeDeregistration, - ... - } - | { - StakeDelegationJSON: StakeDelegation, - ... - } - | { - PoolRegistrationJSON: PoolRegistration, - ... - } - | { - PoolRetirementJSON: PoolRetirement, - ... - } - | { - GenesisKeyDelegationJSON: GenesisKeyDelegation, - ... - } - | { - MoveInstantaneousRewardsCertJSON: MoveInstantaneousRewardsCert, - ... - }; -export type CertificatesJSON = CertificateJSON[]; -export type CostModelJSON = string[]; -export interface CostmdlsJSON { - [k: string]: CostModelJSON; -} -export type DNSRecordAorAAAAJSON = string; -export type DNSRecordSRVJSON = string; -export type DataHashJSON = string; -export type DataOptionJSON = - | { - DataHashJSON: string, - ... - } - | { - Data: string, - ... - }; -export type Ed25519KeyHashJSON = string; -export type Ed25519KeyHashesJSON = string[]; -export type Ed25519SignatureJSON = string; -export interface ExUnitPricesJSON { - mem_price: UnitIntervalJSON; - step_price: UnitIntervalJSON; -} -export interface ExUnitsJSON { - mem: string; - steps: string; -} -export interface GeneralTransactionMetadataJSON { - [k: string]: string; -} -export type GenesisDelegateHashJSON = string; -export type GenesisHashJSON = string; -export type GenesisHashesJSON = string[]; -export interface GenesisKeyDelegationJSON { - genesis_delegate_hash: string; - genesishash: string; - vrf_keyhash: string; -} -export interface HeaderJSON { - body_signature: string; - header_body: HeaderBodyJSON; -} -export interface HeaderBodyJSON { - block_body_hash: string; - block_body_size: number; - block_number: number; - issuer_vkey: VkeyJSON; - leader_cert: HeaderLeaderCertEnumJSON; - operational_cert: OperationalCertJSON; - prev_hash?: string | null; - protocol_version: ProtocolVersionJSON; - slot: string; - vrf_vkey: string; -} -export type HeaderLeaderCertEnumJSON = - | { - NonceAndLeader: [VRFCertJSON, VRFCert], - ... - } - | { - VrfResult: VRFCertJSON, - ... - }; -export type IntJSON = string; -export type Ipv4JSON = [number, number, number, number]; -export type Ipv6JSON = [ - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number -]; -export type KESVKeyJSON = string; -export type LanguageJSON = LanguageKindJSON; -export type LanguageKindJSON = "PlutusV1" | "PlutusV2" | "PlutusV3"; -export type LanguagesJSON = LanguageJSON[]; -export type MIREnumJSON = - | { - ToOtherPot: string, - ... - } - | { - ToStakeCredentials: { - [k: string]: ProtocolParamUpdateJSON, - ... - }, - ... - }; -export type MIRPotJSON = "Reserves" | "Treasury"; -export interface MIRToStakeCredentialsJSON { - [k: string]: ProtocolParamUpdateJSON; -} -export interface MintJSON { - [k: string]: MintAssetsJSON; -} -export interface MintAssetsJSON { - [k: string]: string; -} -export interface MoveInstantaneousRewardJSON { - pot: MIRPotJSON; - variant: MIREnumJSON; -} -export interface MoveInstantaneousRewardsCertJSON { - move_instantaneous_reward: MoveInstantaneousRewardJSON; -} -export interface MultiAssetJSON { - [k: string]: AssetsJSON; -} -export interface MultiHostNameJSON { - dns_name: DNSRecordSRVJSON; -} -export type NativeScriptJSON = NativeScript1JSON; -export type NativeScript1JSON = - | { - ScriptPubkeyJSON: ScriptPubkey, - ... - } - | { - ScriptAllJSON: ScriptAll, - ... - } - | { - ScriptAnyJSON: ScriptAny, - ... - } - | { - ScriptNOfKJSON: ScriptNOfK, - ... - } - | { - TimelockStartJSON: TimelockStart, - ... - } - | { - TimelockExpiryJSON: TimelockExpiry, - ... - }; -export type NativeScriptsJSON = NativeScriptJSON[]; -export type NetworkIdJSON = NetworkIdKindJSON; -export type NetworkIdKindJSON = "Testnet" | "Mainnet"; -export interface NonceJSON { - hash?: - | [ - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number - ] - | null; -} -export interface OperationalCertJSON { - hot_vkey: string; - kes_period: number; - sequence_number: number; - sigma: string; -} -export type PlutusScriptJSON = string; -export type PlutusScriptsJSON = string[]; -export interface PoolMetadataJSON { - pool_metadata_hash: string; - url: URLJSON; -} -export type PoolMetadataHashJSON = string; -export interface PoolParamsJSON { - cost: string; - margin: UnitIntervalJSON; - operator: string; - pledge: string; - pool_metadata?: PoolMetadataJSON | null; - pool_owners: Ed25519KeyHashesJSON; - relays: RelaysJSON; - reward_account: string; - vrf_keyhash: string; -} -export interface PoolRegistrationJSON { - pool_params: PoolParamsJSON; -} -export interface PoolRetirementJSON { - epoch: number; - pool_keyhash: string; -} -export interface ProposedProtocolParameterUpdatesJSON { - [k: string]: ProtocolParamUpdateJSON; -} -export interface ProtocolParamUpdateJSON { - ada_per_utxo_byte?: string | null; - collateral_percentage?: number | null; - cost_models?: CostmdlsJSON | null; - d?: UnitIntervalJSON | null; - execution_costs?: ExUnitPricesJSON | null; - expansion_rate?: UnitIntervalJSON | null; - extra_entropy?: NonceJSON | null; - key_deposit?: string | null; - max_block_body_size?: number | null; - max_block_ex_units?: ExUnitsJSON | null; - max_block_header_size?: number | null; - max_collateral_inputs?: number | null; - max_epoch?: number | null; - max_tx_ex_units?: ExUnitsJSON | null; - max_tx_size?: number | null; - max_value_size?: number | null; - min_pool_cost?: string | null; - minfee_a?: string | null; - minfee_b?: string | null; - n_opt?: number | null; - pool_deposit?: string | null; - pool_pledge_influence?: UnitIntervalJSON | null; - protocol_version?: ProtocolVersionJSON | null; - treasury_growth_rate?: UnitIntervalJSON | null; -} -export interface ProtocolVersionJSON { - major: number; - minor: number; -} -export type PublicKeyJSON = string; -export interface RedeemerJSON { - data: string; - ex_units: ExUnitsJSON; - index: string; - tag: RedeemerTagJSON; -} -export type RedeemerTagJSON = RedeemerTagKindJSON; -export type RedeemerTagKindJSON = "Spend" | "MintJSON" | "Cert" | "Reward"; -export type RedeemersJSON = RedeemerJSON[]; -export type RelayJSON = RelayEnumJSON; -export type RelayEnumJSON = - | { - SingleHostAddrJSON: SingleHostAddr, - ... - } - | { - SingleHostNameJSON: SingleHostName, - ... - } - | { - MultiHostNameJSON: MultiHostName, - ... - }; -export type RelaysJSON = RelayJSON[]; -export type RewardAddressJSON = string; -export type RewardAddressesJSON = string[]; -export interface ScriptAllJSON { - native_scripts: NativeScriptsJSON; -} -export interface ScriptAnyJSON { - native_scripts: NativeScriptsJSON; -} -export type ScriptDataHashJSON = string; -export type ScriptHashJSON = string; -export type ScriptHashesJSON = string[]; -export interface ScriptNOfKJSON { - n: number; - native_scripts: NativeScriptsJSON; -} -export interface ScriptPubkeyJSON { - addr_keyhash: string; -} -export type ScriptRefJSON = ScriptJSON; -export type ScriptJSON = - | { - NativeScriptJSON: NativeScript, - ... - } - | { - PlutusScriptV1: string, - ... - } - | { - PlutusScriptV2: string, - ... - } - | { - PlutusScriptV3: string, - ... - }; -export interface SingleHostAddrJSON { - ipv4?: Ipv4JSON | null; - ipv6?: Ipv6JSON | null; - port?: number | null; -} -export interface SingleHostNameJSON { - dns_name: DNSRecordAorAAAAJSON; - port?: number | null; -} -export type StakeCredTypeJSON = - | { - Key: string, - ... - } - | { - ScriptJSON: string, - ... - }; -export type StakeCredentialJSON = StakeCredTypeJSON; -export type StakeCredentialsJSON = StakeCredTypeJSON[]; -export interface StakeDelegationJSON { - pool_keyhash: string; - stake_credential: StakeCredTypeJSON; -} -export interface StakeDeregistrationJSON { - stake_credential: StakeCredTypeJSON; -} -export interface StakeRegistrationJSON { - stake_credential: StakeCredTypeJSON; -} -export interface TimelockExpiryJSON { - slot: string; -} -export interface TimelockStartJSON { - slot: string; -} -export interface TransactionJSON { - auxiliary_data?: AuxiliaryDataJSON | null; - body: TransactionBodyJSON; - is_valid: boolean; - witness_set: TransactionWitnessSetJSON; -} -export type TransactionBodiesJSON = TransactionBodyJSON[]; -export interface TransactionBodyJSON { - auxiliary_data_hash?: string | null; - certs?: CertificatesJSON | null; - collateral?: TransactionInputsJSON | null; - collateral_return?: TransactionOutputJSON | null; - fee: string; - inputs: TransactionInputsJSON; - mint?: MintJSON | null; - network_id?: NetworkIdJSON | null; - outputs: TransactionOutputsJSON; - reference_inputs?: TransactionInputsJSON | null; - required_signers?: Ed25519KeyHashesJSON | null; - script_data_hash?: string | null; - total_collateral?: string | null; - ttl?: string | null; - update?: UpdateJSON | null; - validity_start_interval?: string | null; - withdrawals?: { - [k: string]: ProtocolParamUpdateJSON, - ... - } | null; -} -export type TransactionHashJSON = string; -export interface TransactionInputJSON { - index: number; - transaction_id: string; -} -export type TransactionInputsJSON = TransactionInputJSON[]; -export type TransactionMetadatumJSON = string; -export interface TransactionOutputJSON { - address: string; - amount: ValueJSON; - plutus_data?: DataOptionJSON | null; - script_ref?: ScriptJSON | null; -} -export type TransactionOutputsJSON = TransactionOutputJSON[]; -export interface TransactionUnspentOutputJSON { - input: TransactionInputJSON; - output: TransactionOutputJSON; -} -export type TransactionUnspentOutputsJSON = TransactionUnspentOutputJSON[]; -export interface TransactionWitnessSetJSON { - bootstraps?: BootstrapWitnessesJSON | null; - native_scripts?: NativeScriptsJSON | null; - plutus_data?: PlutusList | null; - plutus_scripts?: PlutusScriptsJSON | null; - redeemers?: RedeemersJSON | null; - vkeys?: VkeywitnessesJSON | null; -} -export type TransactionWitnessSetsJSON = TransactionWitnessSetJSON[]; -export type URLJSON = string; -export interface UnitIntervalJSON { - denominator: string; - numerator: string; -} -export interface UpdateJSON { - epoch: number; - proposed_protocol_parameter_updates: { - [k: string]: ProtocolParamUpdateJSON, - ... - }; -} -export interface VRFCertJSON { - output: number[]; - proof: number[]; -} -export type VRFKeyHashJSON = string; -export type VRFVKeyJSON = string; -export interface ValueJSON { - coin: string; - multiasset?: MultiAssetJSON | null; -} -export type VkeyJSON = string; -export interface VkeywitnessJSON { - signature: string; - vkey: VkeyJSON; -} -export type VkeywitnessesJSON = VkeywitnessJSON[]; -export interface WithdrawalsJSON { - [k: string]: ProtocolParamUpdateJSON; -} diff --git a/rust/src/address.rs b/rust/src/address.rs index e6c725b..49fa4cf 100644 --- a/rust/src/address.rs +++ b/rust/src/address.rs @@ -138,6 +138,13 @@ impl StakeCredential { } } + pub fn has_script_hash(&self) -> bool { + match &self.0 { + StakeCredType::Key(_) => false, + StakeCredType::Script(_) => true, + } + } + fn to_raw_bytes(&self) -> Vec { match &self.0 { StakeCredType::Key(hash) => hash.to_bytes(), diff --git a/rust/src/error.rs b/rust/src/error.rs index 6a209ce..61133a7 100644 --- a/rust/src/error.rs +++ b/rust/src/error.rs @@ -34,6 +34,10 @@ pub enum DeserializeFailure { found: Key, expected: Key, }, + FixedValuesMismatch { + found: Key, + expected: Vec, + }, MandatoryFieldMissing(Key), Metadata(JsError), NoVariantMatched, @@ -104,6 +108,9 @@ impl std::fmt::Display for DeserializeError { DeserializeFailure::FixedValueMismatch { found, expected } => { write!(f, "Expected fixed value {} found {}", expected, found) } + DeserializeFailure::FixedValuesMismatch { found, expected } => { + write!(f, "Expected fixed value {:?} found {}", expected, found) + } DeserializeFailure::MandatoryFieldMissing(key) => { write!(f, "Mandatory field {} not found", key) } diff --git a/rust/src/lib.rs b/rust/src/lib.rs index e32fc07..cf67944 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -1000,6 +1000,8 @@ impl MoveInstantaneousRewardsCert { } } + + #[wasm_bindgen] #[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd)] pub enum CertificateKind { @@ -1010,6 +1012,16 @@ pub enum CertificateKind { PoolRetirement, GenesisKeyDelegation, MoveInstantaneousRewardsCert, + CommitteeHotAuth, + CommitteeColdResign, + DRepDeregistration, + DRepRegistration, + DRepUpdate, + StakeAndVoteDelegation, + StakeRegistrationAndDelegation, + StakeVoteRegistrationAndDelegation, + VoteDelegation, + VoteRegistrationAndDelegation, } #[derive( @@ -1023,8 +1035,144 @@ pub enum CertificateEnum { PoolRetirement(PoolRetirement), GenesisKeyDelegation(GenesisKeyDelegation), MoveInstantaneousRewardsCert(MoveInstantaneousRewardsCert), + CommitteeHotAuth(CommitteeHotAuth), + CommitteeColdResign(CommitteeColdResign), + DRepDeregistration(DRepDeregistration), + DRepRegistration(DRepRegistration), + DRepUpdate(DRepUpdate), + StakeAndVoteDelegation(StakeAndVoteDelegation), + StakeRegistrationAndDelegation(StakeRegistrationAndDelegation), + StakeVoteRegistrationAndDelegation(StakeVoteRegistrationAndDelegation), + VoteDelegation(VoteDelegation), + VoteRegistrationAndDelegation(VoteRegistrationAndDelegation), +} + +// Dummy struct definitions for missing types +#[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize, JsonSchema)] +pub struct CommitteeHotAuth; + +#[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize, JsonSchema)] +pub struct CommitteeColdResign; + +#[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize, JsonSchema)] +pub struct DRepDeregistration; + +#[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize, JsonSchema)] +pub struct DRepRegistration; + +#[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize, JsonSchema)] +pub struct DRepUpdate; + +#[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize, JsonSchema)] +pub struct StakeAndVoteDelegation; + +#[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize, JsonSchema)] +pub struct StakeRegistrationAndDelegation; + +#[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize, JsonSchema)] +pub struct StakeVoteRegistrationAndDelegation; + +#[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize, JsonSchema)] +pub enum DRepEnum { + KeyHash(Ed25519KeyHash), + ScriptHash(ScriptHash), + AlwaysAbstain, + AlwaysNoConfidence, +} + +#[wasm_bindgen] +#[derive(Clone, Debug, Hash, Eq, Ord, PartialEq, PartialOrd)] +pub enum DRepKind { + KeyHash, + ScriptHash, + AlwaysAbstain, + AlwaysNoConfidence, +} + +#[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize, JsonSchema)] +pub struct DRep(DRepEnum); + +impl_to_from!(DRep); + +#[wasm_bindgen] +impl DRep { + pub fn new_key_hash(key_hash: &Ed25519KeyHash) -> Self { + Self(DRepEnum::KeyHash(key_hash.clone())) + } + + pub fn new_script_hash(script_hash: &ScriptHash) -> Self { + Self(DRepEnum::ScriptHash(script_hash.clone())) + } + + pub fn new_always_abstain() -> Self { + Self(DRepEnum::AlwaysAbstain) + } + + pub fn new_always_no_confidence() -> Self { + Self(DRepEnum::AlwaysNoConfidence) + } + + pub fn kind(&self) -> DRepKind { + match &self.0 { + DRepEnum::KeyHash(_) => DRepKind::KeyHash, + DRepEnum::ScriptHash(_) => DRepKind::ScriptHash, + DRepEnum::AlwaysAbstain => DRepKind::AlwaysAbstain, + DRepEnum::AlwaysNoConfidence => DRepKind::AlwaysNoConfidence, + } + } + + pub fn to_key_hash(&self) -> Option { + match &self.0 { + DRepEnum::KeyHash(keyhash) => Some(keyhash.clone()), + _ => None, + } + } + + pub fn to_script_hash(&self) -> Option { + match &self.0 { + DRepEnum::ScriptHash(scripthash) => Some(scripthash.clone()), + _ => None, + } + } +} + +#[wasm_bindgen] +#[derive( + Clone, Debug, Eq, Ord, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize, JsonSchema, +)] +pub struct VoteDelegation { + stake_credential: StakeCredential, + drep: DRep, +} + +impl_to_from!(VoteDelegation); + +#[wasm_bindgen] +impl VoteDelegation { + pub fn stake_credential(&self) -> StakeCredential { + self.stake_credential.clone() + } + + pub fn drep(&self) -> DRep { + self.drep.clone() + } + + pub fn new(stake_credential: &StakeCredential, drep: &DRep) -> Self { + Self { + stake_credential: stake_credential.clone(), + drep: drep.clone(), + } + } + + pub fn has_script_credentials(&self) -> bool { + self.stake_credential.has_script_hash() + } } + +#[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize, JsonSchema)] +pub struct VoteRegistrationAndDelegation; + #[wasm_bindgen] #[derive( Clone, Debug, Eq, Ord, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize, JsonSchema, @@ -1035,6 +1183,10 @@ impl_to_from!(Certificate); #[wasm_bindgen] impl Certificate { + pub fn new_vote_delegation(vote_delegation: &VoteDelegation) -> Self { + Self(CertificateEnum::VoteDelegation(vote_delegation.clone())) + } + pub fn new_stake_registration(stake_registration: &StakeRegistration) -> Self { Self(CertificateEnum::StakeRegistration( stake_registration.clone(), @@ -1084,6 +1236,9 @@ impl Certificate { CertificateEnum::MoveInstantaneousRewardsCert(_) => { CertificateKind::MoveInstantaneousRewardsCert } + CertificateEnum::VoteDelegation(_) => CertificateKind::VoteDelegation, + // For all other variants, return a default or placeholder value, or handle as needed. + _ => panic!("CertificateKind not defined for this certificate variant"), } } diff --git a/rust/src/serialization.rs b/rust/src/serialization.rs index 1d1abe3..e5ed862 100644 --- a/rust/src/serialization.rs +++ b/rust/src/serialization.rs @@ -3,6 +3,7 @@ use crate::utils::*; use address::*; use crypto::*; use error::*; +use core::panic; use std::io::{Seek, SeekFrom}; // This file was code-generated using an experimental CDDL to rust tool: @@ -1681,6 +1682,151 @@ impl cbor_event::se::Serialize for MoveInstantaneousRewardsCert { } } +pub fn check_index( + actual_index: u64, + desired_index: Option, + name: &'static str, +) -> Result<(), DeserializeError> { + let desired_index = desired_index + .ok_or(DeserializeFailure::NoVariantMatched) + .map_err(|e| DeserializeError::from(e))?; + if actual_index != desired_index { + return Err(DeserializeFailure::FixedValueMismatch { + found: Key::Uint(actual_index), + expected: Key::Uint(desired_index), + }) + .map_err(|e| DeserializeError::from(e).annotate(name)); + } + + Ok(()) +} + +pub fn deserialize_and_check_index( + raw: &mut Deserializer, + desired_index: Option, + name: &'static str, +) -> Result { + let actual_index = raw.unsigned_integer()?; + check_index(actual_index, desired_index, name)?; + Ok(actual_index) +} + +pub fn serialize_and_check_index<'se, W: Write>( + serializer: &'se mut Serializer, + index: Option, + name: &'static str, +) -> cbor_event::Result<&'se mut Serializer> { + match index { + Some(index) => serializer.write_unsigned_integer(index), + None => Err(cbor_event::Error::CustomError(format!( + "unknown index of {}", + name + ))), + } +} + +impl cbor_event::se::Serialize for DRep { + fn serialize<'se, W: Write>( + &self, + serializer: &'se mut Serializer, + ) -> cbor_event::Result<&'se mut Serializer> { + serializer.write_array(cbor_event::Len::Len(2))?; + match &self.0 { + DRepEnum::KeyHash(key_hash) => { + serializer.write_array(cbor_event::Len::Len(2))?; + serializer.write_unsigned_integer(0u64)?; + key_hash.serialize(serializer); + } + DRepEnum::ScriptHash(script_hash) => { + serializer.write_array(cbor_event::Len::Len(2))?; + serializer.write_unsigned_integer(1u64)?; + script_hash.serialize(serializer); + } + DRepEnum::AlwaysAbstain => { + serializer.write_array(cbor_event::Len::Len(1))?; + serializer.write_unsigned_integer(2u64); + } + DRepEnum::AlwaysNoConfidence => { + serializer.write_array(cbor_event::Len::Len(1))?; + serializer.write_unsigned_integer(3u64); + } + } + Ok(serializer) + } +} + +impl Deserialize for DRep { + fn deserialize(raw: &mut Deserializer) -> Result { + (|| -> Result<_, DeserializeError> { + let drep_enum = DRepEnum::deserialize(raw)?; + Ok(Self(drep_enum)) + })() + .map_err(|e| e.annotate("DRep")) + } +} + +impl Deserialize for DRepEnum { + fn deserialize(raw: &mut Deserializer) -> Result { + (|| -> Result<_, DeserializeError> { + let len = raw.array()?; + if let cbor_event::Len::Len(n) = len { + if n != 2 && n != 1 { + return Err(DeserializeFailure::CBOR(cbor_event::Error::WrongLen( + 2, + len, + "[id, hash] or [id] (for abstain and no confidence)", + )) + .into()); + } + } + + let drep = match raw.unsigned_integer()? { + 0 => { + let key_hash = + Ed25519KeyHash::deserialize(raw).map_err(|e| e.annotate("key_hash"))?; + DRepEnum::KeyHash(key_hash) + } + 1 => { + let script_hash = + ScriptHash::deserialize(raw).map_err(|e| e.annotate("script_hash"))?; + DRepEnum::ScriptHash(script_hash) + } + 2 => DRepEnum::AlwaysAbstain, + 3 => DRepEnum::AlwaysNoConfidence, + n => { + return Err(DeserializeFailure::FixedValuesMismatch { + found: Key::Uint(n), + expected: vec![Key::Uint(0), Key::Uint(1), Key::Uint(2), Key::Uint(3)], + } + .into()) + } + }; + if let cbor_event::Len::Indefinite = len { + if raw.special()? != CBORSpecial::Break { + return Err(DeserializeFailure::EndingBreakMissing.into()); + } + } + Ok(drep) + })() + .map_err(|e| e.annotate("DRepEnum")) + } +} + +impl cbor_event::se::Serialize for VoteDelegation { + fn serialize<'se, W: Write>( + &self, + serializer: &'se mut Serializer, + ) -> cbor_event::Result<&'se mut Serializer> { + serializer.write_array(cbor_event::Len::Len(3))?; + + serialize_and_check_index(serializer, Some(9u64), "VoteDelegation")?; + + self.stake_credential.serialize(serializer)?; + self.drep.serialize(serializer)?; + Ok(serializer) + } +} + impl SerializeEmbeddedGroup for MoveInstantaneousRewardsCert { fn serialize_as_embedded_group<'se, W: Write>( &self, @@ -1745,6 +1891,83 @@ impl DeserializeEmbeddedGroup for MoveInstantaneousRewardsCert { } } +pub fn check_len( + len: cbor_event::Len, + expected: u64, + struct_description: &'static str, +) -> Result<(), DeserializeError> { + if let cbor_event::Len::Len(n) = len { + if n != expected { + return Err(DeserializeFailure::CBOR(cbor_event::Error::WrongLen( + expected as u64, + len, + struct_description, + )) + .into()); + } + } + Ok(()) +} + +impl SerializeEmbeddedGroup for VoteDelegation { + fn serialize_as_embedded_group<'se, W: Write>( + &self, + serializer: &'se mut Serializer, + ) -> cbor_event::Result<&'se mut Serializer> { + serializer.write_unsigned_integer(15u64)?; + self.stake_credential.serialize(serializer)?; + self.drep.serialize(serializer)?; + Ok(serializer) + } +} + +impl Deserialize for VoteDelegation { + fn deserialize(raw: &mut Deserializer) -> Result { + (|| -> Result<_, DeserializeError> { + let len = raw.array()?; + let ret = Self::deserialize_as_embedded_group(raw, len); + match len { + cbor_event::Len::Len(_) => + /* TODO: check finite len somewhere */ + { + () + } + cbor_event::Len::Indefinite => match raw.special()? { + CBORSpecial::Break => + /* it's ok */ + { + () + } + _ => return Err(DeserializeFailure::EndingBreakMissing.into()), + }, + } + ret + })() + .map_err(|e| e.annotate("VoteDelegation")) + } +} + +impl DeserializeEmbeddedGroup for VoteDelegation { + fn deserialize_as_embedded_group( + raw: &mut Deserializer, + len: cbor_event::Len, + ) -> Result { + check_len(len, 3, "(cert_index, stake_credential, drep)")?; + let cert_index = Some(9u64); + deserialize_and_check_index(raw, cert_index, "cert_index")?; + + let stake_credential = + StakeCredential::deserialize(raw).map_err(|e| e.annotate("stake_credential"))?; + + let drep = DRep::deserialize(raw).map_err(|e| e.annotate("drep"))?; + + Ok(VoteDelegation { + stake_credential, + drep, + }) + } +} + impl cbor_event::se::Serialize for CertificateEnum { fn serialize<'se, W: Write>( &self, @@ -1758,6 +1981,8 @@ impl cbor_event::se::Serialize for CertificateEnum { CertificateEnum::PoolRetirement(x) => x.serialize(serializer), CertificateEnum::GenesisKeyDelegation(x) => x.serialize(serializer), CertificateEnum::MoveInstantaneousRewardsCert(x) => x.serialize(serializer), + CertificateEnum::VoteDelegation(x) => x.serialize(serializer), + _ => panic!("Unknown variant in CertificateEnum"), } } } diff --git a/rust/src/tx_builder.rs b/rust/src/tx_builder.rs index e37126c..1dab18b 100644 --- a/rust/src/tx_builder.rs +++ b/rust/src/tx_builder.rs @@ -101,6 +101,12 @@ fn witness_keys_for_cert(cert_enum: &Certificate) -> RequiredSigners { } // not witness as there is no single core node or genesis key that posts the certificate CertificateEnum::MoveInstantaneousRewardsCert(_cert) => {} + CertificateEnum::VoteDelegation(cert) => { + if let Some(key_hash) = cert.stake_credential().to_keyhash() { + set.add(&key_hash); + } + } + _ => {} } set } From 9518a404faa8a11c04c32e7521f436893e2257b6 Mon Sep 17 00:00:00 2001 From: tony Date: Mon, 30 Jun 2025 20:16:51 +0700 Subject: [PATCH 3/7] revert --- rust/pkg/cardano_serialization_lib.js.flow | 10756 +++++++++++++++++++ 1 file changed, 10756 insertions(+) create mode 100644 rust/pkg/cardano_serialization_lib.js.flow diff --git a/rust/pkg/cardano_serialization_lib.js.flow b/rust/pkg/cardano_serialization_lib.js.flow new file mode 100644 index 0000000..b5e0fa2 --- /dev/null +++ b/rust/pkg/cardano_serialization_lib.js.flow @@ -0,0 +1,10756 @@ +/** + * Flowtype definitions for cardano_serialization_lib + * Generated by Flowgen from a Typescript Definition + * Flowgen v1.11.0 + * @flow + */ + +/** + * @param {Transaction} tx + * @param {LinearFee} linear_fee + * @returns {BigNum} + */ +declare export function min_fee(tx: Transaction, linear_fee: LinearFee): BigNum; + +/** + * @param {number} tx_size + * @param {LinearFee} linear_fee + * @returns {BigNum} + */ +declare export function cal_min_fee( + tx_size: number, + 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 + * @param {string} nonce + * @param {string} data + * @returns {string} + */ +declare export function encrypt_with_password( + password: string, + salt: string, + nonce: string, + data: string +): string; + +/** + * @param {string} password + * @param {string} data + * @returns {string} + */ +declare export function decrypt_with_password( + password: string, + data: string +): string; + +/** + * @param {Uint8Array} bytes + * @returns {TransactionMetadatum} + */ +declare export function encode_arbitrary_bytes_as_metadatum( + bytes: Uint8Array +): TransactionMetadatum; + +/** + * @param {TransactionMetadatum} metadata + * @returns {Uint8Array} + */ +declare export function decode_arbitrary_bytes_from_metadatum( + metadata: TransactionMetadatum +): Uint8Array; + +/** + * @param {string} json + * @param {number} schema + * @returns {TransactionMetadatum} + */ +declare export function encode_json_str_to_metadatum( + json: string, + schema: number +): TransactionMetadatum; + +/** + * @param {TransactionMetadatum} metadatum + * @param {number} schema + * @returns {string} + */ +declare export function decode_metadatum_to_json_str( + metadatum: TransactionMetadatum, + 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 {TransactionHash} tx_body_hash + * @param {ByronAddress} addr + * @param {LegacyDaedalusPrivateKey} key + * @returns {BootstrapWitness} + */ +declare export function make_daedalus_bootstrap_witness( + tx_body_hash: TransactionHash, + addr: ByronAddress, + key: LegacyDaedalusPrivateKey +): BootstrapWitness; + +/** + * @param {TransactionHash} tx_body_hash + * @param {ByronAddress} addr + * @param {Bip32PrivateKey} key + * @returns {BootstrapWitness} + */ +declare export function make_icarus_bootstrap_witness( + tx_body_hash: TransactionHash, + addr: ByronAddress, + key: Bip32PrivateKey +): BootstrapWitness; + +/** + * @param {TransactionHash} tx_body_hash + * @param {PrivateKey} sk + * @returns {Vkeywitness} + */ +declare export function make_vkey_witness( + tx_body_hash: TransactionHash, + sk: PrivateKey +): Vkeywitness; + +/** + * @param {AuxiliaryData} auxiliary_data + * @returns {AuxiliaryDataHash} + */ +declare export function hash_auxiliary_data( + auxiliary_data: AuxiliaryData +): AuxiliaryDataHash; + +/** + * @param {TransactionBody} tx_body + * @returns {TransactionHash} + */ +declare export function hash_transaction( + tx_body: TransactionBody +): TransactionHash; + +/** + * @param {PlutusData} plutus_data + * @returns {DataHash} + */ +declare export function hash_plutus_data(plutus_data: PlutusData): DataHash; + +/** + * @param {Redeemers} redeemers + * @param {Costmdls} cost_models + * @param {PlutusList | void} datums + * @returns {ScriptDataHash} + */ +declare export function hash_script_data( + redeemers: Redeemers, + cost_models: Costmdls, + datums?: PlutusList +): ScriptDataHash; + +/** + * @param {TransactionBody} txbody + * @param {BigNum} pool_deposit + * @param {BigNum} key_deposit + * @returns {Value} + */ +declare export function get_implicit_input( + txbody: TransactionBody, + pool_deposit: BigNum, + key_deposit: BigNum +): Value; + +/** + * @param {TransactionBody} txbody + * @param {BigNum} pool_deposit + * @param {BigNum} key_deposit + * @returns {BigNum} + */ +declare export function get_deposit( + txbody: TransactionBody, + pool_deposit: BigNum, + key_deposit: BigNum +): BigNum; + +/** + * returns minimal amount of ada for the output for case when the amount is included to the output + * @param {TransactionOutput} output + * @param {DataCost} data_cost + * @returns {BigNum} + */ +declare export function min_ada_for_output( + output: TransactionOutput, + data_cost: DataCost +): BigNum; + +/** + * !!! DEPRECATED !!! + * This function uses outdated set of arguments. + * Use `min_ada_for_output` instead + * @param {Value} assets + * @param {boolean} has_data_hash + * @param {BigNum} coins_per_utxo_word + * @returns {BigNum} + */ +declare export function min_ada_required( + assets: Value, + has_data_hash: boolean, + coins_per_utxo_word: BigNum +): BigNum; + +/** + * Receives a script JSON string + * and returns a NativeScript. + * Cardano Wallet and Node styles are supported. + * + * * wallet: https://github.com/input-output-hk/cardano-wallet/blob/master/specifications/api/swagger.yaml + * * node: https://github.com/input-output-hk/cardano-node/blob/master/doc/reference/simple-scripts.md + * + * self_xpub is expected to be a Bip32PublicKey as hex-encoded bytes + * @param {string} json + * @param {string} self_xpub + * @param {number} schema + * @returns {NativeScript} + */ +declare export function encode_json_str_to_native_script( + json: string, + self_xpub: string, + schema: number +): NativeScript; + +/** + * @param {PlutusList} params + * @param {PlutusScript} plutus_script + * @returns {PlutusScript} + */ +declare export function apply_params_to_plutus_script( + params: PlutusList, + plutus_script: PlutusScript +): PlutusScript; + +/** + * @param {Transaction} tx + * @param {TransactionUnspentOutputs} utxos + * @param {Costmdls} cost_mdls + * @param {ExUnits} max_ex_units + * @param {BigNum} zero_time + * @param {BigNum} zero_slot + * @param {number} slot_length + * @returns {Redeemers} + */ +declare export function get_ex_units( + tx: Transaction, + utxos: TransactionUnspentOutputs, + cost_mdls: Costmdls, + max_ex_units: ExUnits, + zero_time: BigNum, + zero_slot: BigNum, + slot_length: number +): Redeemers; + +/** + */ + +declare export var CertificateKind: {| + +StakeRegistration: 0, // 0 + +StakeDeregistration: 1, // 1 + +StakeDelegation: 2, // 2 + +PoolRegistration: 3, // 3 + +PoolRetirement: 4, // 4 + +GenesisKeyDelegation: 5, // 5 + +MoveInstantaneousRewardsCert: 6, // 6 +|}; + +/** + */ + +declare export var MIRPot: {| + +Reserves: 0, // 0 + +Treasury: 1, // 1 +|}; + +/** + */ + +declare export var MIRKind: {| + +ToOtherPot: 0, // 0 + +ToStakeCredentials: 1, // 1 +|}; + +/** + */ + +declare export var RelayKind: {| + +SingleHostAddr: 0, // 0 + +SingleHostName: 1, // 1 + +MultiHostName: 2, // 2 +|}; + +/** + */ + +declare export var NativeScriptKind: {| + +ScriptPubkey: 0, // 0 + +ScriptAll: 1, // 1 + +ScriptAny: 2, // 2 + +ScriptNOfK: 3, // 3 + +TimelockStart: 4, // 4 + +TimelockExpiry: 5, // 5 +|}; + +/** + * Each new language uses a different namespace for hashing its script + * This is because you could have a language where the same bytes have different semantics + * So this avoids scripts in different languages mapping to the same hash + * Note that the enum value here is different than the enum value for deciding the cost model of a script + */ + +declare export var ScriptHashNamespace: {| + +NativeScript: 0, // 0 + +PlutusScript: 1, // 1 + +PlutusScriptV2: 2, // 2 + +PlutusScriptV3: 3, // 3 +|}; + +/** + */ + +declare export var NetworkIdKind: {| + +Testnet: 0, // 0 + +Mainnet: 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 +|}; + +/** + */ + +declare export var MetadataJsonSchema: {| + +NoConversions: 0, // 0 + +BasicConversions: 1, // 1 + +DetailedSchema: 2, // 2 +|}; + +/** + */ + +declare export var ScriptKind: {| + +NativeScript: 0, // 0 + +PlutusScriptV1: 1, // 1 + +PlutusScriptV2: 2, // 2 + +PlutusScriptV3: 3, // 3 +|}; + +/** + */ + +declare export var LanguageKind: {| + +PlutusV1: 0, // 0 + +PlutusV2: 1, // 1 + +PlutusV3: 2, // 2 +|}; + +/** + */ + +declare export var PlutusDataKind: {| + +ConstrPlutusData: 0, // 0 + +Map: 1, // 1 + +List: 2, // 2 + +Integer: 3, // 3 + +Bytes: 4, // 4 +|}; + +/** + */ + +declare export var RedeemerTagKind: {| + +Spend: 0, // 0 + +Mint: 1, // 1 + +Cert: 2, // 2 + +Reward: 3, // 3 +|}; + +/** + * JSON <-> PlutusData conversion schemas. + * Follows ScriptDataJsonSchema in cardano-cli defined at: + * https://github.com/input-output-hk/cardano-node/blob/master/cardano-api/src/Cardano/Api/ScriptData.hs#L254 + * + * 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 + */ + +declare export var PlutusDatumSchema: {| + +BasicConversions: 0, // 0 + +DetailedSchema: 1, // 1 +|}; + +/** + * Used to choosed the schema for a script JSON string + */ + +declare export var ScriptSchema: {| + +Wallet: 0, // 0 + +Node: 1, // 1 +|}; + +/** + */ + +declare export var CoinSelectionStrategyCIP2: {| + +LargestFirst: 0, // 0 + +RandomImprove: 1, // 1 + +LargestFirstMultiAsset: 2, // 2 + +RandomImproveMultiAsset: 3, // 3 +|}; + +/** + */ +declare export class Address { + free(): void; + + /** + * @param {Uint8Array} data + * @returns {Address} + */ + static from_bytes(data: Uint8Array): Address; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {AddressJSON} + */ + to_js_value(): AddressJSON; + + /** + * @param {string} json + * @returns {Address} + */ + static from_json(json: string): Address; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {Address} + */ + static from_hex(hex_str: string): Address; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {string | void} prefix + * @returns {string} + */ + to_bech32(prefix?: string): string; + + /** + * @param {string} bech_str + * @returns {Address} + */ + static from_bech32(bech_str: string): Address; + + /** + * @returns {number} + */ + network_id(): number; +} +/** + */ +declare export class AssetName { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {AssetName} + */ + static from_bytes(bytes: Uint8Array): AssetName; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {AssetName} + */ + static from_hex(hex_str: string): AssetName; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {AssetNameJSON} + */ + to_js_value(): AssetNameJSON; + + /** + * @param {string} json + * @returns {AssetName} + */ + static from_json(json: string): AssetName; + + /** + * @param {Uint8Array} name + * @returns {AssetName} + */ + static new(name: Uint8Array): AssetName; + + /** + * @returns {Uint8Array} + */ + name(): Uint8Array; +} +/** + */ +declare export class AssetNames { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {AssetNames} + */ + static from_bytes(bytes: Uint8Array): AssetNames; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {AssetNames} + */ + static from_hex(hex_str: string): AssetNames; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {AssetNamesJSON} + */ + to_js_value(): AssetNamesJSON; + + /** + * @param {string} json + * @returns {AssetNames} + */ + static from_json(json: string): AssetNames; + + /** + * @returns {AssetNames} + */ + static new(): AssetNames; + + /** + * @returns {number} + */ + len(): number; + + /** + * @param {number} index + * @returns {AssetName} + */ + get(index: number): AssetName; + + /** + * @param {AssetName} elem + */ + add(elem: AssetName): void; +} +/** + */ +declare export class Assets { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {Assets} + */ + static from_bytes(bytes: Uint8Array): Assets; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {Assets} + */ + static from_hex(hex_str: string): Assets; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {AssetsJSON} + */ + to_js_value(): AssetsJSON; + + /** + * @param {string} json + * @returns {Assets} + */ + static from_json(json: string): Assets; + + /** + * @returns {Assets} + */ + static new(): Assets; + + /** + * @returns {number} + */ + len(): number; + + /** + * @param {AssetName} key + * @param {BigNum} value + * @returns {BigNum | void} + */ + insert(key: AssetName, value: BigNum): BigNum | void; + + /** + * @param {AssetName} key + * @returns {BigNum | void} + */ + get(key: AssetName): BigNum | void; + + /** + * @returns {AssetNames} + */ + keys(): AssetNames; +} +/** + */ +declare export class AuxiliaryData { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {AuxiliaryData} + */ + static from_bytes(bytes: Uint8Array): AuxiliaryData; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {AuxiliaryData} + */ + static from_hex(hex_str: string): AuxiliaryData; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {AuxiliaryDataJSON} + */ + to_js_value(): AuxiliaryDataJSON; + + /** + * @param {string} json + * @returns {AuxiliaryData} + */ + static from_json(json: string): AuxiliaryData; + + /** + * @returns {AuxiliaryData} + */ + static new(): AuxiliaryData; + + /** + * @returns {GeneralTransactionMetadata | void} + */ + metadata(): GeneralTransactionMetadata | void; + + /** + * @param {GeneralTransactionMetadata} metadata + */ + set_metadata(metadata: GeneralTransactionMetadata): void; + + /** + * @returns {NativeScripts | void} + */ + native_scripts(): NativeScripts | void; + + /** + * @param {NativeScripts} native_scripts + */ + set_native_scripts(native_scripts: NativeScripts): void; + + /** + * @returns {PlutusScripts | void} + */ + plutus_scripts(): PlutusScripts | void; + + /** + * @param {PlutusScripts} plutus_scripts + */ + set_plutus_scripts(plutus_scripts: PlutusScripts): void; +} +/** + */ +declare export class AuxiliaryDataHash { + free(): void; + + /** + * @param {Uint8Array} bytes + * @returns {AuxiliaryDataHash} + */ + static from_bytes(bytes: Uint8Array): AuxiliaryDataHash; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {string} prefix + * @returns {string} + */ + to_bech32(prefix: string): string; + + /** + * @param {string} bech_str + * @returns {AuxiliaryDataHash} + */ + static from_bech32(bech_str: string): AuxiliaryDataHash; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex + * @returns {AuxiliaryDataHash} + */ + static from_hex(hex: string): AuxiliaryDataHash; +} +/** + */ +declare export class AuxiliaryDataSet { + free(): void; + + /** + * @returns {AuxiliaryDataSet} + */ + static new(): AuxiliaryDataSet; + + /** + * @returns {number} + */ + len(): number; + + /** + * @param {number} tx_index + * @param {AuxiliaryData} data + * @returns {AuxiliaryData | void} + */ + insert(tx_index: number, data: AuxiliaryData): AuxiliaryData | void; + + /** + * @param {number} tx_index + * @returns {AuxiliaryData | void} + */ + get(tx_index: number): AuxiliaryData | void; + + /** + * @returns {Uint32Array} + */ + indices(): Uint32Array; +} +/** + */ +declare export class BaseAddress { + free(): void; + + /** + * @param {number} network + * @param {StakeCredential} payment + * @param {StakeCredential} stake + * @returns {BaseAddress} + */ + static new( + network: number, + payment: StakeCredential, + stake: StakeCredential + ): BaseAddress; + + /** + * @returns {StakeCredential} + */ + payment_cred(): StakeCredential; + + /** + * @returns {StakeCredential} + */ + stake_cred(): StakeCredential; + + /** + * @returns {Address} + */ + to_address(): Address; + + /** + * @param {Address} addr + * @returns {BaseAddress | void} + */ + static from_address(addr: Address): BaseAddress | void; +} +/** + */ +declare export class BigInt { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {BigInt} + */ + static from_bytes(bytes: Uint8Array): BigInt; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {BigInt} + */ + static from_hex(hex_str: string): BigInt; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {BigIntJSON} + */ + to_js_value(): BigIntJSON; + + /** + * @param {string} json + * @returns {BigInt} + */ + static from_json(json: string): BigInt; + + /** + * @returns {boolean} + */ + is_zero(): boolean; + + /** + * @returns {BigNum | void} + */ + as_u64(): BigNum | void; + + /** + * @returns {Int | void} + */ + as_int(): Int | void; + + /** + * @param {string} text + * @returns {BigInt} + */ + static from_str(text: string): BigInt; + + /** + * @returns {string} + */ + to_str(): string; + + /** + * @param {BigInt} other + * @returns {BigInt} + */ + add(other: BigInt): BigInt; + + /** + * @param {BigInt} other + * @returns {BigInt} + */ + mul(other: BigInt): BigInt; + + /** + * @returns {BigInt} + */ + static one(): BigInt; + + /** + * @returns {BigInt} + */ + increment(): BigInt; + + /** + * @param {BigInt} other + * @returns {BigInt} + */ + div_ceil(other: BigInt): BigInt; +} +/** + */ +declare export class BigNum { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {BigNum} + */ + static from_bytes(bytes: Uint8Array): BigNum; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {BigNum} + */ + static from_hex(hex_str: string): BigNum; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {BigNumJSON} + */ + to_js_value(): BigNumJSON; + + /** + * @param {string} json + * @returns {BigNum} + */ + static from_json(json: string): BigNum; + + /** + * @param {string} string + * @returns {BigNum} + */ + static from_str(string: string): BigNum; + + /** + * @returns {string} + */ + to_str(): string; + + /** + * @returns {BigNum} + */ + static zero(): BigNum; + + /** + * @returns {BigNum} + */ + static one(): BigNum; + + /** + * @returns {boolean} + */ + is_zero(): boolean; + + /** + * @param {BigNum} other + * @returns {BigNum} + */ + div_floor(other: BigNum): BigNum; + + /** + * @param {BigNum} other + * @returns {BigNum} + */ + checked_mul(other: BigNum): BigNum; + + /** + * @param {BigNum} other + * @returns {BigNum} + */ + checked_add(other: BigNum): BigNum; + + /** + * @param {BigNum} other + * @returns {BigNum} + */ + checked_sub(other: BigNum): BigNum; + + /** + * returns 0 if it would otherwise underflow + * @param {BigNum} other + * @returns {BigNum} + */ + clamped_sub(other: BigNum): BigNum; + + /** + * @param {BigNum} rhs_value + * @returns {number} + */ + compare(rhs_value: BigNum): number; + + /** + * @param {BigNum} rhs_value + * @returns {boolean} + */ + less_than(rhs_value: BigNum): boolean; + + /** + * @param {BigNum} a + * @param {BigNum} b + * @returns {BigNum} + */ + static max(a: BigNum, b: BigNum): BigNum; +} +/** + */ +declare export class Bip32PrivateKey { + free(): void; + + /** + * derive this private key with the given index. + * + * # Security considerations + * + * * hard derivation index cannot be soft derived with the public key + * + * # Hard derivation vs Soft derivation + * + * If you pass an index below 0x80000000 then it is a soft derivation. + * The advantage of soft derivation is that it is possible to derive the + * public key too. I.e. derivation the private key with a soft derivation + * index and then retrieving the associated public key is equivalent to + * deriving the public key associated to the parent private key. + * + * Hard derivation index does not allow public key derivation. + * + * This is why deriving the private key should not fail while deriving + * the public key may fail (if the derivation index is invalid). + * @param {number} index + * @returns {Bip32PrivateKey} + */ + derive(index: number): Bip32PrivateKey; + + /** + * 128-byte xprv a key format in Cardano that some software still uses or requires + * the traditional 96-byte xprv is simply encoded as + * prv | chaincode + * however, because some software may not know how to compute a public key from a private key, + * the 128-byte inlines the public key in the following format + * prv | pub | chaincode + * so be careful if you see the term "xprv" as it could refer to either one + * our library does not require the pub (instead we compute the pub key when needed) + * @param {Uint8Array} bytes + * @returns {Bip32PrivateKey} + */ + static from_128_xprv(bytes: Uint8Array): Bip32PrivateKey; + + /** + * see from_128_xprv + * @returns {Uint8Array} + */ + to_128_xprv(): Uint8Array; + + /** + * @returns {Bip32PrivateKey} + */ + static generate_ed25519_bip32(): Bip32PrivateKey; + + /** + * @returns {PrivateKey} + */ + to_raw_key(): PrivateKey; + + /** + * @returns {Bip32PublicKey} + */ + to_public(): Bip32PublicKey; + + /** + * @param {Uint8Array} bytes + * @returns {Bip32PrivateKey} + */ + static from_bytes(bytes: Uint8Array): Bip32PrivateKey; + + /** + * @returns {Uint8Array} + */ + as_bytes(): Uint8Array; + + /** + * @param {string} bech32_str + * @returns {Bip32PrivateKey} + */ + static from_bech32(bech32_str: string): Bip32PrivateKey; + + /** + * @returns {string} + */ + to_bech32(): string; + + /** + * @param {Uint8Array} entropy + * @param {Uint8Array} password + * @returns {Bip32PrivateKey} + */ + static from_bip39_entropy( + entropy: Uint8Array, + password: Uint8Array + ): Bip32PrivateKey; + + /** + * @returns {Uint8Array} + */ + chaincode(): Uint8Array; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {Bip32PrivateKey} + */ + static from_hex(hex_str: string): Bip32PrivateKey; +} +/** + */ +declare export class Bip32PublicKey { + free(): void; + + /** + * derive this public key with the given index. + * + * # Errors + * + * If the index is not a soft derivation index (< 0x80000000) then + * calling this method will fail. + * + * # Security considerations + * + * * hard derivation index cannot be soft derived with the public key + * + * # Hard derivation vs Soft derivation + * + * If you pass an index below 0x80000000 then it is a soft derivation. + * The advantage of soft derivation is that it is possible to derive the + * public key too. I.e. derivation the private key with a soft derivation + * index and then retrieving the associated public key is equivalent to + * deriving the public key associated to the parent private key. + * + * Hard derivation index does not allow public key derivation. + * + * This is why deriving the private key should not fail while deriving + * the public key may fail (if the derivation index is invalid). + * @param {number} index + * @returns {Bip32PublicKey} + */ + derive(index: number): Bip32PublicKey; + + /** + * @returns {PublicKey} + */ + to_raw_key(): PublicKey; + + /** + * @param {Uint8Array} bytes + * @returns {Bip32PublicKey} + */ + static from_bytes(bytes: Uint8Array): Bip32PublicKey; + + /** + * @returns {Uint8Array} + */ + as_bytes(): Uint8Array; + + /** + * @param {string} bech32_str + * @returns {Bip32PublicKey} + */ + static from_bech32(bech32_str: string): Bip32PublicKey; + + /** + * @returns {string} + */ + to_bech32(): string; + + /** + * @returns {Uint8Array} + */ + chaincode(): Uint8Array; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {Bip32PublicKey} + */ + static from_hex(hex_str: string): Bip32PublicKey; +} +/** + */ +declare export class Block { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {Block} + */ + static from_bytes(bytes: Uint8Array): Block; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {Block} + */ + static from_hex(hex_str: string): Block; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {BlockJSON} + */ + to_js_value(): BlockJSON; + + /** + * @param {string} json + * @returns {Block} + */ + static from_json(json: string): Block; + + /** + * @returns {Header} + */ + header(): Header; + + /** + * @returns {TransactionBodies} + */ + transaction_bodies(): TransactionBodies; + + /** + * @returns {TransactionWitnessSets} + */ + transaction_witness_sets(): TransactionWitnessSets; + + /** + * @returns {AuxiliaryDataSet} + */ + auxiliary_data_set(): AuxiliaryDataSet; + + /** + * @returns {Uint32Array} + */ + invalid_transactions(): Uint32Array; + + /** + * @param {Header} header + * @param {TransactionBodies} transaction_bodies + * @param {TransactionWitnessSets} transaction_witness_sets + * @param {AuxiliaryDataSet} auxiliary_data_set + * @param {Uint32Array} invalid_transactions + * @returns {Block} + */ + static new( + header: Header, + transaction_bodies: TransactionBodies, + transaction_witness_sets: TransactionWitnessSets, + auxiliary_data_set: AuxiliaryDataSet, + invalid_transactions: Uint32Array + ): Block; +} +/** + */ +declare export class BlockHash { + free(): void; + + /** + * @param {Uint8Array} bytes + * @returns {BlockHash} + */ + static from_bytes(bytes: Uint8Array): BlockHash; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {string} prefix + * @returns {string} + */ + to_bech32(prefix: string): string; + + /** + * @param {string} bech_str + * @returns {BlockHash} + */ + static from_bech32(bech_str: string): BlockHash; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex + * @returns {BlockHash} + */ + static from_hex(hex: string): BlockHash; +} +/** + */ +declare export class BootstrapWitness { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {BootstrapWitness} + */ + static from_bytes(bytes: Uint8Array): BootstrapWitness; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {BootstrapWitness} + */ + static from_hex(hex_str: string): BootstrapWitness; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {BootstrapWitnessJSON} + */ + to_js_value(): BootstrapWitnessJSON; + + /** + * @param {string} json + * @returns {BootstrapWitness} + */ + static from_json(json: string): BootstrapWitness; + + /** + * @returns {Vkey} + */ + vkey(): Vkey; + + /** + * @returns {Ed25519Signature} + */ + signature(): Ed25519Signature; + + /** + * @returns {Uint8Array} + */ + chain_code(): Uint8Array; + + /** + * @returns {Uint8Array} + */ + attributes(): Uint8Array; + + /** + * @param {Vkey} vkey + * @param {Ed25519Signature} signature + * @param {Uint8Array} chain_code + * @param {Uint8Array} attributes + * @returns {BootstrapWitness} + */ + static new( + vkey: Vkey, + signature: Ed25519Signature, + chain_code: Uint8Array, + attributes: Uint8Array + ): BootstrapWitness; +} +/** + */ +declare export class BootstrapWitnesses { + free(): void; + + /** + * @returns {BootstrapWitnesses} + */ + static new(): BootstrapWitnesses; + + /** + * @returns {number} + */ + len(): number; + + /** + * @param {number} index + * @returns {BootstrapWitness} + */ + get(index: number): BootstrapWitness; + + /** + * @param {BootstrapWitness} elem + */ + add(elem: BootstrapWitness): void; +} +/** + */ +declare export class ByronAddress { + free(): void; + + /** + * @returns {string} + */ + to_base58(): string; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {ByronAddress} + */ + static from_bytes(bytes: Uint8Array): ByronAddress; + + /** + * returns the byron protocol magic embedded in the address, or mainnet id if none is present + * note: for bech32 addresses, you need to use network_id instead + * @returns {number} + */ + byron_protocol_magic(): number; + + /** + * @returns {Uint8Array} + */ + attributes(): Uint8Array; + + /** + * @returns {number} + */ + network_id(): number; + + /** + * @param {string} s + * @returns {ByronAddress} + */ + static from_base58(s: string): ByronAddress; + + /** + * @param {Bip32PublicKey} key + * @param {number} protocol_magic + * @returns {ByronAddress} + */ + static icarus_from_key( + key: Bip32PublicKey, + protocol_magic: number + ): ByronAddress; + + /** + * @param {string} s + * @returns {boolean} + */ + static is_valid(s: string): boolean; + + /** + * @returns {Address} + */ + to_address(): Address; + + /** + * @param {Address} addr + * @returns {ByronAddress | void} + */ + static from_address(addr: Address): ByronAddress | void; +} +/** + */ +declare export class Certificate { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {Certificate} + */ + static from_bytes(bytes: Uint8Array): Certificate; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {Certificate} + */ + static from_hex(hex_str: string): Certificate; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {CertificateJSON} + */ + to_js_value(): CertificateJSON; + + /** + * @param {string} json + * @returns {Certificate} + */ + static from_json(json: string): Certificate; + + /** + * @param {StakeRegistration} stake_registration + * @returns {Certificate} + */ + static new_stake_registration( + stake_registration: StakeRegistration + ): Certificate; + + /** + * @param {StakeDeregistration} stake_deregistration + * @returns {Certificate} + */ + static new_stake_deregistration( + stake_deregistration: StakeDeregistration + ): Certificate; + + /** + * @param {StakeDelegation} stake_delegation + * @returns {Certificate} + */ + static new_stake_delegation(stake_delegation: StakeDelegation): Certificate; + + /** + * @param {PoolRegistration} pool_registration + * @returns {Certificate} + */ + static new_pool_registration( + pool_registration: PoolRegistration + ): Certificate; + + /** + * @param {PoolRetirement} pool_retirement + * @returns {Certificate} + */ + static new_pool_retirement(pool_retirement: PoolRetirement): Certificate; + + /** + * @param {GenesisKeyDelegation} genesis_key_delegation + * @returns {Certificate} + */ + static new_genesis_key_delegation( + genesis_key_delegation: GenesisKeyDelegation + ): Certificate; + + /** + * @param {MoveInstantaneousRewardsCert} move_instantaneous_rewards_cert + * @returns {Certificate} + */ + static new_move_instantaneous_rewards_cert( + move_instantaneous_rewards_cert: MoveInstantaneousRewardsCert + ): Certificate; + + /** + * @returns {number} + */ + kind(): number; + + /** + * @returns {StakeRegistration | void} + */ + as_stake_registration(): StakeRegistration | void; + + /** + * @returns {StakeDeregistration | void} + */ + as_stake_deregistration(): StakeDeregistration | void; + + /** + * @returns {StakeDelegation | void} + */ + as_stake_delegation(): StakeDelegation | void; + + /** + * @returns {PoolRegistration | void} + */ + as_pool_registration(): PoolRegistration | void; + + /** + * @returns {PoolRetirement | void} + */ + as_pool_retirement(): PoolRetirement | void; + + /** + * @returns {GenesisKeyDelegation | void} + */ + as_genesis_key_delegation(): GenesisKeyDelegation | void; + + /** + * @returns {MoveInstantaneousRewardsCert | void} + */ + as_move_instantaneous_rewards_cert(): MoveInstantaneousRewardsCert | void; +} +/** + */ +declare export class Certificates { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {Certificates} + */ + static from_bytes(bytes: Uint8Array): Certificates; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {Certificates} + */ + static from_hex(hex_str: string): Certificates; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {CertificatesJSON} + */ + to_js_value(): CertificatesJSON; + + /** + * @param {string} json + * @returns {Certificates} + */ + static from_json(json: string): Certificates; + + /** + * @returns {Certificates} + */ + static new(): Certificates; + + /** + * @returns {number} + */ + len(): number; + + /** + * @param {number} index + * @returns {Certificate} + */ + get(index: number): Certificate; + + /** + * @param {Certificate} elem + */ + add(elem: Certificate): void; +} +/** + */ +declare export class ConstrPlutusData { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {ConstrPlutusData} + */ + static from_bytes(bytes: Uint8Array): ConstrPlutusData; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {ConstrPlutusData} + */ + static from_hex(hex_str: string): ConstrPlutusData; + + /** + * @returns {BigNum} + */ + alternative(): BigNum; + + /** + * @returns {PlutusList} + */ + data(): PlutusList; + + /** + * @param {BigNum} alternative + * @param {PlutusList} data + * @returns {ConstrPlutusData} + */ + static new(alternative: BigNum, data: PlutusList): ConstrPlutusData; +} +/** + */ +declare export class CostModel { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {CostModel} + */ + static from_bytes(bytes: Uint8Array): CostModel; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {CostModel} + */ + static from_hex(hex_str: string): CostModel; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {CostModelJSON} + */ + to_js_value(): CostModelJSON; + + /** + * @param {string} json + * @returns {CostModel} + */ + static from_json(json: string): CostModel; + + /** + * Creates a new CostModels instance of an unrestricted length + * @returns {CostModel} + */ + static new(): CostModel; + + /** + * Sets the cost at the specified index to the specified value. + * In case the operation index is larger than the previous largest used index, + * it will fill any inbetween indexes with zeroes + * @param {number} operation + * @param {Int} cost + * @returns {Int} + */ + set(operation: number, cost: Int): Int; + + /** + * @param {number} operation + * @returns {Int} + */ + get(operation: number): Int; + + /** + * @returns {number} + */ + len(): number; +} +/** + */ +declare export class Costmdls { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {Costmdls} + */ + static from_bytes(bytes: Uint8Array): Costmdls; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {Costmdls} + */ + static from_hex(hex_str: string): Costmdls; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {CostmdlsJSON} + */ + to_js_value(): CostmdlsJSON; + + /** + * @param {string} json + * @returns {Costmdls} + */ + static from_json(json: string): Costmdls; + + /** + * @returns {Costmdls} + */ + static new(): Costmdls; + + /** + * @returns {number} + */ + len(): number; + + /** + * @param {Language} key + * @param {CostModel} value + * @returns {CostModel | void} + */ + insert(key: Language, value: CostModel): CostModel | void; + + /** + * @param {Language} key + * @returns {CostModel | void} + */ + get(key: Language): CostModel | void; + + /** + * @returns {Languages} + */ + keys(): Languages; + + /** + * @param {Languages} languages + * @returns {Costmdls} + */ + retain_language_versions(languages: Languages): Costmdls; +} +/** + */ +declare export class DNSRecordAorAAAA { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {DNSRecordAorAAAA} + */ + static from_bytes(bytes: Uint8Array): DNSRecordAorAAAA; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {DNSRecordAorAAAA} + */ + static from_hex(hex_str: string): DNSRecordAorAAAA; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {DNSRecordAorAAAAJSON} + */ + to_js_value(): DNSRecordAorAAAAJSON; + + /** + * @param {string} json + * @returns {DNSRecordAorAAAA} + */ + static from_json(json: string): DNSRecordAorAAAA; + + /** + * @param {string} dns_name + * @returns {DNSRecordAorAAAA} + */ + static new(dns_name: string): DNSRecordAorAAAA; + + /** + * @returns {string} + */ + record(): string; +} +/** + */ +declare export class DNSRecordSRV { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {DNSRecordSRV} + */ + static from_bytes(bytes: Uint8Array): DNSRecordSRV; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {DNSRecordSRV} + */ + static from_hex(hex_str: string): DNSRecordSRV; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {DNSRecordSRVJSON} + */ + to_js_value(): DNSRecordSRVJSON; + + /** + * @param {string} json + * @returns {DNSRecordSRV} + */ + static from_json(json: string): DNSRecordSRV; + + /** + * @param {string} dns_name + * @returns {DNSRecordSRV} + */ + static new(dns_name: string): DNSRecordSRV; + + /** + * @returns {string} + */ + record(): string; +} +/** + */ +declare export class DataCost { + free(): void; + + /** + * !!! DEPRECATED !!! + * Since babbage era we should use coins per byte. Use `.new_coins_per_byte` instead. + * @param {BigNum} coins_per_word + * @returns {DataCost} + */ + static new_coins_per_word(coins_per_word: BigNum): DataCost; + + /** + * @param {BigNum} coins_per_byte + * @returns {DataCost} + */ + static new_coins_per_byte(coins_per_byte: BigNum): DataCost; + + /** + * @returns {BigNum} + */ + coins_per_byte(): BigNum; +} +/** + */ +declare export class DataHash { + free(): void; + + /** + * @param {Uint8Array} bytes + * @returns {DataHash} + */ + static from_bytes(bytes: Uint8Array): DataHash; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {string} prefix + * @returns {string} + */ + to_bech32(prefix: string): string; + + /** + * @param {string} bech_str + * @returns {DataHash} + */ + static from_bech32(bech_str: string): DataHash; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex + * @returns {DataHash} + */ + static from_hex(hex: string): DataHash; +} +/** + */ +declare export class DatumSource { + free(): void; + + /** + * @param {PlutusData} datum + * @returns {DatumSource} + */ + static new(datum: PlutusData): DatumSource; + + /** + * @param {TransactionInput} input + * @returns {DatumSource} + */ + static new_ref_input(input: TransactionInput): DatumSource; +} +/** + */ +declare export class Ed25519KeyHash { + free(): void; + + /** + * @param {Uint8Array} bytes + * @returns {Ed25519KeyHash} + */ + static from_bytes(bytes: Uint8Array): Ed25519KeyHash; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {string} prefix + * @returns {string} + */ + to_bech32(prefix: string): string; + + /** + * @param {string} bech_str + * @returns {Ed25519KeyHash} + */ + static from_bech32(bech_str: string): Ed25519KeyHash; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex + * @returns {Ed25519KeyHash} + */ + static from_hex(hex: string): Ed25519KeyHash; +} +/** + */ +declare export class Ed25519KeyHashes { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {Ed25519KeyHashes} + */ + static from_bytes(bytes: Uint8Array): Ed25519KeyHashes; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {Ed25519KeyHashes} + */ + static from_hex(hex_str: string): Ed25519KeyHashes; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {Ed25519KeyHashesJSON} + */ + to_js_value(): Ed25519KeyHashesJSON; + + /** + * @param {string} json + * @returns {Ed25519KeyHashes} + */ + static from_json(json: string): Ed25519KeyHashes; + + /** + * @returns {Ed25519KeyHashes} + */ + static new(): Ed25519KeyHashes; + + /** + * @returns {number} + */ + len(): number; + + /** + * @param {number} index + * @returns {Ed25519KeyHash} + */ + get(index: number): Ed25519KeyHash; + + /** + * @param {Ed25519KeyHash} elem + */ + add(elem: Ed25519KeyHash): void; + + /** + * @returns {Ed25519KeyHashes | void} + */ + to_option(): Ed25519KeyHashes | void; +} +/** + */ +declare export class Ed25519Signature { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @returns {string} + */ + to_bech32(): string; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} bech32_str + * @returns {Ed25519Signature} + */ + static from_bech32(bech32_str: string): Ed25519Signature; + + /** + * @param {string} input + * @returns {Ed25519Signature} + */ + static from_hex(input: string): Ed25519Signature; + + /** + * @param {Uint8Array} bytes + * @returns {Ed25519Signature} + */ + static from_bytes(bytes: Uint8Array): Ed25519Signature; +} +/** + */ +declare export class EnterpriseAddress { + free(): void; + + /** + * @param {number} network + * @param {StakeCredential} payment + * @returns {EnterpriseAddress} + */ + static new(network: number, payment: StakeCredential): EnterpriseAddress; + + /** + * @returns {StakeCredential} + */ + payment_cred(): StakeCredential; + + /** + * @returns {Address} + */ + to_address(): Address; + + /** + * @param {Address} addr + * @returns {EnterpriseAddress | void} + */ + static from_address(addr: Address): EnterpriseAddress | void; +} +/** + */ +declare export class ExUnitPrices { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {ExUnitPrices} + */ + static from_bytes(bytes: Uint8Array): ExUnitPrices; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {ExUnitPrices} + */ + static from_hex(hex_str: string): ExUnitPrices; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {ExUnitPricesJSON} + */ + to_js_value(): ExUnitPricesJSON; + + /** + * @param {string} json + * @returns {ExUnitPrices} + */ + static from_json(json: string): ExUnitPrices; + + /** + * @returns {UnitInterval} + */ + mem_price(): UnitInterval; + + /** + * @returns {UnitInterval} + */ + step_price(): UnitInterval; + + /** + * @param {UnitInterval} mem_price + * @param {UnitInterval} step_price + * @returns {ExUnitPrices} + */ + static new(mem_price: UnitInterval, step_price: UnitInterval): ExUnitPrices; +} +/** + */ +declare export class ExUnits { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {ExUnits} + */ + static from_bytes(bytes: Uint8Array): ExUnits; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {ExUnits} + */ + static from_hex(hex_str: string): ExUnits; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {ExUnitsJSON} + */ + to_js_value(): ExUnitsJSON; + + /** + * @param {string} json + * @returns {ExUnits} + */ + static from_json(json: string): ExUnits; + + /** + * @returns {BigNum} + */ + mem(): BigNum; + + /** + * @returns {BigNum} + */ + steps(): BigNum; + + /** + * @param {BigNum} mem + * @param {BigNum} steps + * @returns {ExUnits} + */ + static new(mem: BigNum, steps: BigNum): ExUnits; +} +/** + */ +declare export class GeneralTransactionMetadata { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {GeneralTransactionMetadata} + */ + static from_bytes(bytes: Uint8Array): GeneralTransactionMetadata; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {GeneralTransactionMetadata} + */ + static from_hex(hex_str: string): GeneralTransactionMetadata; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {GeneralTransactionMetadataJSON} + */ + to_js_value(): GeneralTransactionMetadataJSON; + + /** + * @param {string} json + * @returns {GeneralTransactionMetadata} + */ + static from_json(json: string): GeneralTransactionMetadata; + + /** + * @returns {GeneralTransactionMetadata} + */ + static new(): GeneralTransactionMetadata; + + /** + * @returns {number} + */ + len(): number; + + /** + * @param {BigNum} key + * @param {TransactionMetadatum} value + * @returns {TransactionMetadatum | void} + */ + insert(key: BigNum, value: TransactionMetadatum): TransactionMetadatum | void; + + /** + * @param {BigNum} key + * @returns {TransactionMetadatum | void} + */ + get(key: BigNum): TransactionMetadatum | void; + + /** + * @returns {TransactionMetadatumLabels} + */ + keys(): TransactionMetadatumLabels; +} +/** + */ +declare export class GenesisDelegateHash { + free(): void; + + /** + * @param {Uint8Array} bytes + * @returns {GenesisDelegateHash} + */ + static from_bytes(bytes: Uint8Array): GenesisDelegateHash; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {string} prefix + * @returns {string} + */ + to_bech32(prefix: string): string; + + /** + * @param {string} bech_str + * @returns {GenesisDelegateHash} + */ + static from_bech32(bech_str: string): GenesisDelegateHash; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex + * @returns {GenesisDelegateHash} + */ + static from_hex(hex: string): GenesisDelegateHash; +} +/** + */ +declare export class GenesisHash { + free(): void; + + /** + * @param {Uint8Array} bytes + * @returns {GenesisHash} + */ + static from_bytes(bytes: Uint8Array): GenesisHash; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {string} prefix + * @returns {string} + */ + to_bech32(prefix: string): string; + + /** + * @param {string} bech_str + * @returns {GenesisHash} + */ + static from_bech32(bech_str: string): GenesisHash; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex + * @returns {GenesisHash} + */ + static from_hex(hex: string): GenesisHash; +} +/** + */ +declare export class GenesisHashes { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {GenesisHashes} + */ + static from_bytes(bytes: Uint8Array): GenesisHashes; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {GenesisHashes} + */ + static from_hex(hex_str: string): GenesisHashes; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {GenesisHashesJSON} + */ + to_js_value(): GenesisHashesJSON; + + /** + * @param {string} json + * @returns {GenesisHashes} + */ + static from_json(json: string): GenesisHashes; + + /** + * @returns {GenesisHashes} + */ + static new(): GenesisHashes; + + /** + * @returns {number} + */ + len(): number; + + /** + * @param {number} index + * @returns {GenesisHash} + */ + get(index: number): GenesisHash; + + /** + * @param {GenesisHash} elem + */ + add(elem: GenesisHash): void; +} +/** + */ +declare export class GenesisKeyDelegation { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {GenesisKeyDelegation} + */ + static from_bytes(bytes: Uint8Array): GenesisKeyDelegation; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {GenesisKeyDelegation} + */ + static from_hex(hex_str: string): GenesisKeyDelegation; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {GenesisKeyDelegationJSON} + */ + to_js_value(): GenesisKeyDelegationJSON; + + /** + * @param {string} json + * @returns {GenesisKeyDelegation} + */ + static from_json(json: string): GenesisKeyDelegation; + + /** + * @returns {GenesisHash} + */ + genesishash(): GenesisHash; + + /** + * @returns {GenesisDelegateHash} + */ + genesis_delegate_hash(): GenesisDelegateHash; + + /** + * @returns {VRFKeyHash} + */ + vrf_keyhash(): VRFKeyHash; + + /** + * @param {GenesisHash} genesishash + * @param {GenesisDelegateHash} genesis_delegate_hash + * @param {VRFKeyHash} vrf_keyhash + * @returns {GenesisKeyDelegation} + */ + static new( + genesishash: GenesisHash, + genesis_delegate_hash: GenesisDelegateHash, + vrf_keyhash: VRFKeyHash + ): GenesisKeyDelegation; +} +/** + */ +declare export class Header { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {Header} + */ + static from_bytes(bytes: Uint8Array): Header; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {Header} + */ + static from_hex(hex_str: string): Header; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {HeaderJSON} + */ + to_js_value(): HeaderJSON; + + /** + * @param {string} json + * @returns {Header} + */ + static from_json(json: string): Header; + + /** + * @returns {HeaderBody} + */ + header_body(): HeaderBody; + + /** + * @returns {KESSignature} + */ + body_signature(): KESSignature; + + /** + * @param {HeaderBody} header_body + * @param {KESSignature} body_signature + * @returns {Header} + */ + static new(header_body: HeaderBody, body_signature: KESSignature): Header; +} +/** + */ +declare export class HeaderBody { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {HeaderBody} + */ + static from_bytes(bytes: Uint8Array): HeaderBody; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {HeaderBody} + */ + static from_hex(hex_str: string): HeaderBody; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {HeaderBodyJSON} + */ + to_js_value(): HeaderBodyJSON; + + /** + * @param {string} json + * @returns {HeaderBody} + */ + static from_json(json: string): HeaderBody; + + /** + * @returns {number} + */ + block_number(): number; + + /** + * !!! DEPRECATED !!! + * Returns a Slot32 (u32) value in case the underlying original BigNum (u64) value is within the limits. + * Otherwise will just raise an error. + * @returns {number} + */ + slot(): number; + + /** + * @returns {BigNum} + */ + slot_bignum(): BigNum; + + /** + * @returns {BlockHash | void} + */ + prev_hash(): BlockHash | void; + + /** + * @returns {Vkey} + */ + issuer_vkey(): Vkey; + + /** + * @returns {VRFVKey} + */ + vrf_vkey(): VRFVKey; + + /** + * If this function returns true, the `.nonce_vrf_or_nothing` + * and the `.leader_vrf_or_nothing` functions will return + * non-empty results + * @returns {boolean} + */ + has_nonce_and_leader_vrf(): boolean; + + /** + * Might return nothing in case `.has_nonce_and_leader_vrf` returns false + * @returns {VRFCert | void} + */ + nonce_vrf_or_nothing(): VRFCert | void; + + /** + * Might return nothing in case `.has_nonce_and_leader_vrf` returns false + * @returns {VRFCert | void} + */ + leader_vrf_or_nothing(): VRFCert | void; + + /** + * If this function returns true, the `.vrf_result_or_nothing` + * function will return a non-empty result + * @returns {boolean} + */ + has_vrf_result(): boolean; + + /** + * Might return nothing in case `.has_vrf_result` returns false + * @returns {VRFCert | void} + */ + vrf_result_or_nothing(): VRFCert | void; + + /** + * @returns {number} + */ + block_body_size(): number; + + /** + * @returns {BlockHash} + */ + block_body_hash(): BlockHash; + + /** + * @returns {OperationalCert} + */ + operational_cert(): OperationalCert; + + /** + * @returns {ProtocolVersion} + */ + protocol_version(): ProtocolVersion; + + /** + * !!! DEPRECATED !!! + * This constructor uses outdated slot number format. + * Use `.new_headerbody` instead + * @param {number} block_number + * @param {number} slot + * @param {BlockHash | void} prev_hash + * @param {Vkey} issuer_vkey + * @param {VRFVKey} vrf_vkey + * @param {VRFCert} vrf_result + * @param {number} block_body_size + * @param {BlockHash} block_body_hash + * @param {OperationalCert} operational_cert + * @param {ProtocolVersion} protocol_version + * @returns {HeaderBody} + */ + static new( + block_number: number, + slot: number, + prev_hash: BlockHash | void, + issuer_vkey: Vkey, + vrf_vkey: VRFVKey, + vrf_result: VRFCert, + block_body_size: number, + block_body_hash: BlockHash, + operational_cert: OperationalCert, + protocol_version: ProtocolVersion + ): HeaderBody; + + /** + * @param {number} block_number + * @param {BigNum} slot + * @param {BlockHash | void} prev_hash + * @param {Vkey} issuer_vkey + * @param {VRFVKey} vrf_vkey + * @param {VRFCert} vrf_result + * @param {number} block_body_size + * @param {BlockHash} block_body_hash + * @param {OperationalCert} operational_cert + * @param {ProtocolVersion} protocol_version + * @returns {HeaderBody} + */ + static new_headerbody( + block_number: number, + slot: BigNum, + prev_hash: BlockHash | void, + issuer_vkey: Vkey, + vrf_vkey: VRFVKey, + vrf_result: VRFCert, + block_body_size: number, + block_body_hash: BlockHash, + operational_cert: OperationalCert, + protocol_version: ProtocolVersion + ): HeaderBody; +} +/** + */ +declare export class Int { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {Int} + */ + static from_bytes(bytes: Uint8Array): Int; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {Int} + */ + static from_hex(hex_str: string): Int; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {IntJSON} + */ + to_js_value(): IntJSON; + + /** + * @param {string} json + * @returns {Int} + */ + static from_json(json: string): Int; + + /** + * @param {BigNum} x + * @returns {Int} + */ + static new(x: BigNum): Int; + + /** + * @param {BigNum} x + * @returns {Int} + */ + static new_negative(x: BigNum): Int; + + /** + * @param {number} x + * @returns {Int} + */ + static new_i32(x: number): Int; + + /** + * @returns {boolean} + */ + is_positive(): boolean; + + /** + * BigNum can only contain unsigned u64 values + * + * This function will return the BigNum representation + * only in case the underlying i128 value is positive. + * + * Otherwise nothing will be returned (undefined). + * @returns {BigNum | void} + */ + as_positive(): BigNum | void; + + /** + * BigNum can only contain unsigned u64 values + * + * This function will return the *absolute* BigNum representation + * only in case the underlying i128 value is negative. + * + * Otherwise nothing will be returned (undefined). + * @returns {BigNum | void} + */ + as_negative(): BigNum | void; + + /** + * !!! DEPRECATED !!! + * Returns an i32 value in case the underlying original i128 value is within the limits. + * Otherwise will just return an empty value (undefined). + * @returns {number | void} + */ + as_i32(): number | void; + + /** + * Returns the underlying value converted to i32 if possible (within limits) + * Otherwise will just return an empty value (undefined). + * @returns {number | void} + */ + as_i32_or_nothing(): number | void; + + /** + * Returns the underlying value converted to i32 if possible (within limits) + * JsError in case of out of boundary overflow + * @returns {number} + */ + as_i32_or_fail(): number; + + /** + * Returns string representation of the underlying i128 value directly. + * Might contain the minus sign (-) in case of negative value. + * @returns {string} + */ + to_str(): string; + + /** + * @param {string} string + * @returns {Int} + */ + static from_str(string: string): Int; +} +/** + */ +declare export class Ipv4 { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {Ipv4} + */ + static from_bytes(bytes: Uint8Array): Ipv4; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {Ipv4} + */ + static from_hex(hex_str: string): Ipv4; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {Ipv4JSON} + */ + to_js_value(): Ipv4JSON; + + /** + * @param {string} json + * @returns {Ipv4} + */ + static from_json(json: string): Ipv4; + + /** + * @param {Uint8Array} data + * @returns {Ipv4} + */ + static new(data: Uint8Array): Ipv4; + + /** + * @returns {Uint8Array} + */ + ip(): Uint8Array; +} +/** + */ +declare export class Ipv6 { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {Ipv6} + */ + static from_bytes(bytes: Uint8Array): Ipv6; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {Ipv6} + */ + static from_hex(hex_str: string): Ipv6; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {Ipv6JSON} + */ + to_js_value(): Ipv6JSON; + + /** + * @param {string} json + * @returns {Ipv6} + */ + static from_json(json: string): Ipv6; + + /** + * @param {Uint8Array} data + * @returns {Ipv6} + */ + static new(data: Uint8Array): Ipv6; + + /** + * @returns {Uint8Array} + */ + ip(): Uint8Array; +} +/** + */ +declare export class KESSignature { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {KESSignature} + */ + static from_bytes(bytes: Uint8Array): KESSignature; +} +/** + */ +declare export class KESVKey { + free(): void; + + /** + * @param {Uint8Array} bytes + * @returns {KESVKey} + */ + static from_bytes(bytes: Uint8Array): KESVKey; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {string} prefix + * @returns {string} + */ + to_bech32(prefix: string): string; + + /** + * @param {string} bech_str + * @returns {KESVKey} + */ + static from_bech32(bech_str: string): KESVKey; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex + * @returns {KESVKey} + */ + static from_hex(hex: string): KESVKey; +} +/** + */ +declare export class Language { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {Language} + */ + static from_bytes(bytes: Uint8Array): Language; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {Language} + */ + static from_hex(hex_str: string): Language; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {LanguageJSON} + */ + to_js_value(): LanguageJSON; + + /** + * @param {string} json + * @returns {Language} + */ + static from_json(json: string): Language; + + /** + * @returns {Language} + */ + static new_plutus_v1(): Language; + + /** + * @returns {Language} + */ + static new_plutus_v2(): Language; + + /** + * @returns {Language} + */ + static new_plutus_v3(): Language; + + /** + * @returns {number} + */ + kind(): number; +} +/** + */ +declare export class Languages { + free(): void; + + /** + * @returns {Languages} + */ + static new(): Languages; + + /** + * @returns {number} + */ + len(): number; + + /** + * @param {number} index + * @returns {Language} + */ + get(index: number): Language; + + /** + * @param {Language} elem + */ + add(elem: Language): void; +} +/** + */ +declare export class LegacyDaedalusPrivateKey { + free(): void; + + /** + * @param {Uint8Array} bytes + * @returns {LegacyDaedalusPrivateKey} + */ + static from_bytes(bytes: Uint8Array): LegacyDaedalusPrivateKey; + + /** + * @returns {Uint8Array} + */ + as_bytes(): Uint8Array; + + /** + * @returns {Uint8Array} + */ + chaincode(): Uint8Array; +} +/** + */ +declare export class LinearFee { + free(): void; + + /** + * @returns {BigNum} + */ + constant(): BigNum; + + /** + * @returns {BigNum} + */ + coefficient(): BigNum; + + /** + * @param {BigNum} coefficient + * @param {BigNum} constant + * @returns {LinearFee} + */ + static new(coefficient: BigNum, constant: BigNum): LinearFee; +} +/** + */ +declare export class MIRToStakeCredentials { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {MIRToStakeCredentials} + */ + static from_bytes(bytes: Uint8Array): MIRToStakeCredentials; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {MIRToStakeCredentials} + */ + static from_hex(hex_str: string): MIRToStakeCredentials; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {MIRToStakeCredentialsJSON} + */ + to_js_value(): MIRToStakeCredentialsJSON; + + /** + * @param {string} json + * @returns {MIRToStakeCredentials} + */ + static from_json(json: string): MIRToStakeCredentials; + + /** + * @returns {MIRToStakeCredentials} + */ + static new(): MIRToStakeCredentials; + + /** + * @returns {number} + */ + len(): number; + + /** + * @param {StakeCredential} cred + * @param {Int} delta + * @returns {Int | void} + */ + insert(cred: StakeCredential, delta: Int): Int | void; + + /** + * @param {StakeCredential} cred + * @returns {Int | void} + */ + get(cred: StakeCredential): Int | void; + + /** + * @returns {StakeCredentials} + */ + keys(): StakeCredentials; +} +/** + */ +declare export class MetadataList { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {MetadataList} + */ + static from_bytes(bytes: Uint8Array): MetadataList; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {MetadataList} + */ + static from_hex(hex_str: string): MetadataList; + + /** + * @returns {MetadataList} + */ + static new(): MetadataList; + + /** + * @returns {number} + */ + len(): number; + + /** + * @param {number} index + * @returns {TransactionMetadatum} + */ + get(index: number): TransactionMetadatum; + + /** + * @param {TransactionMetadatum} elem + */ + add(elem: TransactionMetadatum): void; +} +/** + */ +declare export class MetadataMap { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {MetadataMap} + */ + static from_bytes(bytes: Uint8Array): MetadataMap; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {MetadataMap} + */ + static from_hex(hex_str: string): MetadataMap; + + /** + * @returns {MetadataMap} + */ + static new(): MetadataMap; + + /** + * @returns {number} + */ + len(): number; + + /** + * @param {TransactionMetadatum} key + * @param {TransactionMetadatum} value + * @returns {TransactionMetadatum | void} + */ + insert( + key: TransactionMetadatum, + value: TransactionMetadatum + ): TransactionMetadatum | void; + + /** + * @param {string} key + * @param {TransactionMetadatum} value + * @returns {TransactionMetadatum | void} + */ + insert_str( + key: string, + value: TransactionMetadatum + ): TransactionMetadatum | void; + + /** + * @param {number} key + * @param {TransactionMetadatum} value + * @returns {TransactionMetadatum | void} + */ + insert_i32( + key: number, + value: TransactionMetadatum + ): TransactionMetadatum | void; + + /** + * @param {TransactionMetadatum} key + * @returns {TransactionMetadatum} + */ + get(key: TransactionMetadatum): TransactionMetadatum; + + /** + * @param {string} key + * @returns {TransactionMetadatum} + */ + get_str(key: string): TransactionMetadatum; + + /** + * @param {number} key + * @returns {TransactionMetadatum} + */ + get_i32(key: number): TransactionMetadatum; + + /** + * @param {TransactionMetadatum} key + * @returns {boolean} + */ + has(key: TransactionMetadatum): boolean; + + /** + * @returns {MetadataList} + */ + keys(): MetadataList; +} +/** + */ +declare export class Mint { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {Mint} + */ + static from_bytes(bytes: Uint8Array): Mint; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {Mint} + */ + static from_hex(hex_str: string): Mint; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {MintJSON} + */ + to_js_value(): MintJSON; + + /** + * @param {string} json + * @returns {Mint} + */ + static from_json(json: string): Mint; + + /** + * @returns {Mint} + */ + static new(): Mint; + + /** + * @param {ScriptHash} key + * @param {MintAssets} value + * @returns {Mint} + */ + static new_from_entry(key: ScriptHash, value: MintAssets): Mint; + + /** + * @returns {number} + */ + len(): number; + + /** + * @param {ScriptHash} key + * @param {MintAssets} value + * @returns {MintAssets | void} + */ + insert(key: ScriptHash, value: MintAssets): MintAssets | void; + + /** + * @param {ScriptHash} key + * @returns {MintAssets | void} + */ + get(key: ScriptHash): MintAssets | void; + + /** + * @returns {ScriptHashes} + */ + keys(): ScriptHashes; + + /** + * Returns the multiasset where only positive (minting) entries are present + * @returns {MultiAsset} + */ + as_positive_multiasset(): MultiAsset; + + /** + * Returns the multiasset where only negative (burning) entries are present + * @returns {MultiAsset} + */ + as_negative_multiasset(): MultiAsset; +} +/** + */ +declare export class MintAssets { + free(): void; + + /** + * @returns {MintAssets} + */ + static new(): 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 MoveInstantaneousReward { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {MoveInstantaneousReward} + */ + static from_bytes(bytes: Uint8Array): MoveInstantaneousReward; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {MoveInstantaneousReward} + */ + static from_hex(hex_str: string): MoveInstantaneousReward; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {MoveInstantaneousRewardJSON} + */ + to_js_value(): MoveInstantaneousRewardJSON; + + /** + * @param {string} json + * @returns {MoveInstantaneousReward} + */ + static from_json(json: string): MoveInstantaneousReward; + + /** + * @param {number} pot + * @param {BigNum} amount + * @returns {MoveInstantaneousReward} + */ + static new_to_other_pot(pot: number, amount: BigNum): MoveInstantaneousReward; + + /** + * @param {number} pot + * @param {MIRToStakeCredentials} amounts + * @returns {MoveInstantaneousReward} + */ + static new_to_stake_creds( + pot: number, + amounts: MIRToStakeCredentials + ): MoveInstantaneousReward; + + /** + * @returns {number} + */ + pot(): number; + + /** + * @returns {number} + */ + kind(): number; + + /** + * @returns {BigNum | void} + */ + as_to_other_pot(): BigNum | void; + + /** + * @returns {MIRToStakeCredentials | void} + */ + as_to_stake_creds(): MIRToStakeCredentials | void; +} +/** + */ +declare export class MoveInstantaneousRewardsCert { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {MoveInstantaneousRewardsCert} + */ + static from_bytes(bytes: Uint8Array): MoveInstantaneousRewardsCert; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {MoveInstantaneousRewardsCert} + */ + static from_hex(hex_str: string): MoveInstantaneousRewardsCert; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {MoveInstantaneousRewardsCertJSON} + */ + to_js_value(): MoveInstantaneousRewardsCertJSON; + + /** + * @param {string} json + * @returns {MoveInstantaneousRewardsCert} + */ + static from_json(json: string): MoveInstantaneousRewardsCert; + + /** + * @returns {MoveInstantaneousReward} + */ + move_instantaneous_reward(): MoveInstantaneousReward; + + /** + * @param {MoveInstantaneousReward} move_instantaneous_reward + * @returns {MoveInstantaneousRewardsCert} + */ + static new( + move_instantaneous_reward: MoveInstantaneousReward + ): MoveInstantaneousRewardsCert; +} +/** + */ +declare export class MultiAsset { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {MultiAsset} + */ + static from_bytes(bytes: Uint8Array): MultiAsset; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {MultiAsset} + */ + static from_hex(hex_str: string): MultiAsset; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {MultiAssetJSON} + */ + to_js_value(): MultiAssetJSON; + + /** + * @param {string} json + * @returns {MultiAsset} + */ + static from_json(json: string): MultiAsset; + + /** + * @returns {MultiAsset} + */ + static new(): MultiAsset; + + /** + * the number of unique policy IDs in the multiasset + * @returns {number} + */ + len(): number; + + /** + * set (and replace if it exists) all assets with policy {policy_id} to a copy of {assets} + * @param {ScriptHash} policy_id + * @param {Assets} assets + * @returns {Assets | void} + */ + insert(policy_id: ScriptHash, assets: Assets): Assets | void; + + /** + * all assets under {policy_id}, if any exist, or else None (undefined in JS) + * @param {ScriptHash} policy_id + * @returns {Assets | void} + */ + get(policy_id: ScriptHash): Assets | void; + + /** + * sets the asset {asset_name} to {value} under policy {policy_id} + * returns the previous amount if it was set, or else None (undefined in JS) + * @param {ScriptHash} policy_id + * @param {AssetName} asset_name + * @param {BigNum} value + * @returns {BigNum | void} + */ + set_asset( + policy_id: ScriptHash, + asset_name: AssetName, + value: BigNum + ): BigNum | void; + + /** + * returns the amount of asset {asset_name} under policy {policy_id} + * If such an asset does not exist, 0 is returned. + * @param {ScriptHash} policy_id + * @param {AssetName} asset_name + * @returns {BigNum} + */ + get_asset(policy_id: ScriptHash, asset_name: AssetName): BigNum; + + /** + * returns all policy IDs used by assets in this multiasset + * @returns {ScriptHashes} + */ + keys(): ScriptHashes; + + /** + * removes an asset from the list if the result is 0 or less + * does not modify this object, instead the result is returned + * @param {MultiAsset} rhs_ma + * @returns {MultiAsset} + */ + sub(rhs_ma: MultiAsset): MultiAsset; +} +/** + */ +declare export class MultiHostName { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {MultiHostName} + */ + static from_bytes(bytes: Uint8Array): MultiHostName; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {MultiHostName} + */ + static from_hex(hex_str: string): MultiHostName; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {MultiHostNameJSON} + */ + to_js_value(): MultiHostNameJSON; + + /** + * @param {string} json + * @returns {MultiHostName} + */ + static from_json(json: string): MultiHostName; + + /** + * @returns {DNSRecordSRV} + */ + dns_name(): DNSRecordSRV; + + /** + * @param {DNSRecordSRV} dns_name + * @returns {MultiHostName} + */ + static new(dns_name: DNSRecordSRV): MultiHostName; +} +/** + */ +declare export class NativeScript { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {NativeScript} + */ + static from_bytes(bytes: Uint8Array): NativeScript; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {NativeScript} + */ + static from_hex(hex_str: string): NativeScript; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {NativeScriptJSON} + */ + to_js_value(): NativeScriptJSON; + + /** + * @param {string} json + * @returns {NativeScript} + */ + static from_json(json: string): NativeScript; + + /** + * @returns {ScriptHash} + */ + hash(): ScriptHash; + + /** + * @param {ScriptPubkey} script_pubkey + * @returns {NativeScript} + */ + static new_script_pubkey(script_pubkey: ScriptPubkey): NativeScript; + + /** + * @param {ScriptAll} script_all + * @returns {NativeScript} + */ + static new_script_all(script_all: ScriptAll): NativeScript; + + /** + * @param {ScriptAny} script_any + * @returns {NativeScript} + */ + static new_script_any(script_any: ScriptAny): NativeScript; + + /** + * @param {ScriptNOfK} script_n_of_k + * @returns {NativeScript} + */ + static new_script_n_of_k(script_n_of_k: ScriptNOfK): NativeScript; + + /** + * @param {TimelockStart} timelock_start + * @returns {NativeScript} + */ + static new_timelock_start(timelock_start: TimelockStart): NativeScript; + + /** + * @param {TimelockExpiry} timelock_expiry + * @returns {NativeScript} + */ + static new_timelock_expiry(timelock_expiry: TimelockExpiry): NativeScript; + + /** + * @returns {number} + */ + kind(): number; + + /** + * @returns {ScriptPubkey | void} + */ + as_script_pubkey(): ScriptPubkey | void; + + /** + * @returns {ScriptAll | void} + */ + as_script_all(): ScriptAll | void; + + /** + * @returns {ScriptAny | void} + */ + as_script_any(): ScriptAny | void; + + /** + * @returns {ScriptNOfK | void} + */ + as_script_n_of_k(): ScriptNOfK | void; + + /** + * @returns {TimelockStart | void} + */ + as_timelock_start(): TimelockStart | void; + + /** + * @returns {TimelockExpiry | void} + */ + as_timelock_expiry(): TimelockExpiry | void; + + /** + * Returns an array of unique Ed25519KeyHashes + * contained within this script recursively on any depth level. + * The order of the keys in the result is not determined in any way. + * @returns {Ed25519KeyHashes} + */ + get_required_signers(): Ed25519KeyHashes; +} +/** + */ +declare export class NativeScripts { + free(): void; + + /** + * @returns {NativeScripts} + */ + static new(): NativeScripts; + + /** + * @returns {number} + */ + len(): number; + + /** + * @param {number} index + * @returns {NativeScript} + */ + get(index: number): NativeScript; + + /** + * @param {NativeScript} elem + */ + add(elem: NativeScript): void; +} +/** + */ +declare export class NetworkId { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {NetworkId} + */ + static from_bytes(bytes: Uint8Array): NetworkId; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {NetworkId} + */ + static from_hex(hex_str: string): NetworkId; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {NetworkIdJSON} + */ + to_js_value(): NetworkIdJSON; + + /** + * @param {string} json + * @returns {NetworkId} + */ + static from_json(json: string): NetworkId; + + /** + * @returns {NetworkId} + */ + static testnet(): NetworkId; + + /** + * @returns {NetworkId} + */ + static mainnet(): NetworkId; + + /** + * @returns {number} + */ + kind(): number; +} +/** + */ +declare export class NetworkInfo { + free(): void; + + /** + * @param {number} network_id + * @param {number} protocol_magic + * @returns {NetworkInfo} + */ + static new(network_id: number, protocol_magic: number): NetworkInfo; + + /** + * @returns {number} + */ + network_id(): number; + + /** + * @returns {number} + */ + protocol_magic(): number; + + /** + * @returns {NetworkInfo} + */ + static testnet(): NetworkInfo; + + /** + * @returns {NetworkInfo} + */ + static mainnet(): NetworkInfo; +} +/** + */ +declare export class Nonce { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {Nonce} + */ + static from_bytes(bytes: Uint8Array): Nonce; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {Nonce} + */ + static from_hex(hex_str: string): Nonce; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {NonceJSON} + */ + to_js_value(): NonceJSON; + + /** + * @param {string} json + * @returns {Nonce} + */ + static from_json(json: string): Nonce; + + /** + * @returns {Nonce} + */ + static new_identity(): Nonce; + + /** + * @param {Uint8Array} hash + * @returns {Nonce} + */ + static new_from_hash(hash: Uint8Array): Nonce; + + /** + * @returns {Uint8Array | void} + */ + get_hash(): Uint8Array | void; +} +/** + */ +declare export class OperationalCert { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {OperationalCert} + */ + static from_bytes(bytes: Uint8Array): OperationalCert; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {OperationalCert} + */ + static from_hex(hex_str: string): OperationalCert; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {OperationalCertJSON} + */ + to_js_value(): OperationalCertJSON; + + /** + * @param {string} json + * @returns {OperationalCert} + */ + static from_json(json: string): OperationalCert; + + /** + * @returns {KESVKey} + */ + hot_vkey(): KESVKey; + + /** + * @returns {number} + */ + sequence_number(): number; + + /** + * @returns {number} + */ + kes_period(): number; + + /** + * @returns {Ed25519Signature} + */ + sigma(): Ed25519Signature; + + /** + * @param {KESVKey} hot_vkey + * @param {number} sequence_number + * @param {number} kes_period + * @param {Ed25519Signature} sigma + * @returns {OperationalCert} + */ + static new( + hot_vkey: KESVKey, + sequence_number: number, + kes_period: number, + sigma: Ed25519Signature + ): OperationalCert; +} +/** + */ +declare export class PlutusData { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {PlutusData} + */ + static from_bytes(bytes: Uint8Array): PlutusData; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {PlutusData} + */ + static from_hex(hex_str: string): PlutusData; + + /** + * @param {ConstrPlutusData} constr_plutus_data + * @returns {PlutusData} + */ + static new_constr_plutus_data( + constr_plutus_data: ConstrPlutusData + ): PlutusData; + + /** + * Same as `.new_constr_plutus_data` but creates constr with empty data list + * @param {BigNum} alternative + * @returns {PlutusData} + */ + static new_empty_constr_plutus_data(alternative: BigNum): PlutusData; + + /** + * @param {PlutusMap} map + * @returns {PlutusData} + */ + static new_map(map: PlutusMap): PlutusData; + + /** + * @param {PlutusList} list + * @returns {PlutusData} + */ + static new_list(list: PlutusList): PlutusData; + + /** + * @param {BigInt} integer + * @returns {PlutusData} + */ + static new_integer(integer: BigInt): PlutusData; + + /** + * @param {Uint8Array} bytes + * @returns {PlutusData} + */ + static new_bytes(bytes: Uint8Array): PlutusData; + + /** + * @returns {number} + */ + kind(): number; + + /** + * @returns {ConstrPlutusData | void} + */ + as_constr_plutus_data(): ConstrPlutusData | void; + + /** + * @returns {PlutusMap | void} + */ + as_map(): PlutusMap | void; + + /** + * @returns {PlutusList | void} + */ + as_list(): PlutusList | void; + + /** + * @returns {BigInt | void} + */ + as_integer(): BigInt | void; + + /** + * @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; +} +/** + */ +declare export class PlutusList { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {PlutusList} + */ + static from_bytes(bytes: Uint8Array): PlutusList; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {PlutusList} + */ + static from_hex(hex_str: string): PlutusList; + + /** + * @returns {PlutusList} + */ + static new(): PlutusList; + + /** + * @returns {number} + */ + len(): number; + + /** + * @param {number} index + * @returns {PlutusData} + */ + get(index: number): PlutusData; + + /** + * @param {PlutusData} elem + */ + add(elem: PlutusData): void; +} +/** + */ +declare export class PlutusMap { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {PlutusMap} + */ + static from_bytes(bytes: Uint8Array): PlutusMap; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {PlutusMap} + */ + static from_hex(hex_str: string): PlutusMap; + + /** + * @returns {PlutusMap} + */ + static new(): PlutusMap; + + /** + * @returns {number} + */ + len(): number; + + /** + * @param {PlutusData} key + * @param {PlutusData} value + * @returns {PlutusData | void} + */ + insert(key: PlutusData, value: PlutusData): PlutusData | void; + + /** + * @param {PlutusData} key + * @returns {PlutusData | void} + */ + get(key: PlutusData): PlutusData | void; + + /** + * @returns {PlutusList} + */ + keys(): PlutusList; +} +/** + */ +declare export class PlutusScript { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {PlutusScript} + */ + static from_bytes(bytes: Uint8Array): PlutusScript; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {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. + * @param {Uint8Array} bytes + * @returns {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. + * @param {Uint8Array} bytes + * @returns {PlutusScript} + */ + static new_v2(bytes: Uint8Array): PlutusScript; + + /** + * @param {Uint8Array} bytes + * @returns {PlutusScript} + */ + static new_v3(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. + * @param {Uint8Array} bytes + * @param {Language} language + * @returns {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} + */ + bytes(): Uint8Array; + + /** + * Same as `.from_bytes` but will consider the script as requiring the Plutus Language V2 + * @param {Uint8Array} bytes + * @returns {PlutusScript} + */ + static from_bytes_v2(bytes: Uint8Array): PlutusScript; + + /** + * @param {Uint8Array} bytes + * @returns {PlutusScript} + */ + static from_bytes_v3(bytes: Uint8Array): PlutusScript; + + /** + * Same as `.from_bytes` but will consider the script as requiring the specified language version + * @param {Uint8Array} bytes + * @param {Language} language + * @returns {PlutusScript} + */ + static from_bytes_with_version( + bytes: Uint8Array, + 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} + */ + hash(): ScriptHash; + + /** + * @returns {Language} + */ + language_version(): Language; +} +/** + */ +declare export class PlutusScriptSource { + free(): void; + + /** + * @param {PlutusScript} script + * @returns {PlutusScriptSource} + */ + static new(script: PlutusScript): PlutusScriptSource; + + /** + * @param {ScriptHash} script_hash + * @param {TransactionInput} input + * @returns {PlutusScriptSource} + */ + static new_ref_input( + script_hash: ScriptHash, + input: TransactionInput + ): PlutusScriptSource; +} +/** + */ +declare export class PlutusScripts { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {PlutusScripts} + */ + static from_bytes(bytes: Uint8Array): PlutusScripts; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {PlutusScripts} + */ + static from_hex(hex_str: string): PlutusScripts; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {PlutusScriptsJSON} + */ + to_js_value(): PlutusScriptsJSON; + + /** + * @param {string} json + * @returns {PlutusScripts} + */ + static from_json(json: string): PlutusScripts; + + /** + * @returns {PlutusScripts} + */ + static new(): PlutusScripts; + + /** + * @returns {number} + */ + len(): number; + + /** + * @param {number} index + * @returns {PlutusScript} + */ + get(index: number): PlutusScript; + + /** + * @param {PlutusScript} elem + */ + add(elem: PlutusScript): void; +} +/** + */ +declare export class PlutusWitness { + free(): void; + + /** + * @param {PlutusScript} script + * @param {PlutusData} datum + * @param {Redeemer} redeemer + * @returns {PlutusWitness} + */ + static new( + script: PlutusScript, + datum: PlutusData, + redeemer: Redeemer + ): PlutusWitness; + + /** + * @param {PlutusScriptSource} script + * @param {DatumSource} datum + * @param {Redeemer} redeemer + * @returns {PlutusWitness} + */ + static new_with_ref( + script: PlutusScriptSource, + datum: DatumSource, + redeemer: Redeemer + ): PlutusWitness; + + /** + * @returns {PlutusScript | void} + */ + script(): PlutusScript | void; + + /** + * @returns {PlutusData | void} + */ + datum(): PlutusData | void; + + /** + * @returns {Redeemer} + */ + redeemer(): Redeemer; +} +/** + */ +declare export class PlutusWitnesses { + free(): void; + + /** + * @returns {PlutusWitnesses} + */ + static new(): PlutusWitnesses; + + /** + * @returns {number} + */ + len(): number; + + /** + * @param {number} index + * @returns {PlutusWitness} + */ + get(index: number): PlutusWitness; + + /** + * @param {PlutusWitness} elem + */ + add(elem: PlutusWitness): void; +} +/** + */ +declare export class Pointer { + free(): void; + + /** + * !!! DEPRECATED !!! + * This constructor uses outdated slot number format for the ttl value, tx_index and cert_index. + * Use `.new_pointer` instead + * @param {number} slot + * @param {number} tx_index + * @param {number} cert_index + * @returns {Pointer} + */ + static new(slot: number, tx_index: number, cert_index: number): Pointer; + + /** + * @param {BigNum} slot + * @param {BigNum} tx_index + * @param {BigNum} cert_index + * @returns {Pointer} + */ + static new_pointer( + slot: BigNum, + tx_index: BigNum, + cert_index: BigNum + ): Pointer; + + /** + * @returns {number} + */ + slot(): number; + + /** + * @returns {number} + */ + tx_index(): number; + + /** + * @returns {number} + */ + cert_index(): number; + + /** + * @returns {BigNum} + */ + slot_bignum(): BigNum; + + /** + * @returns {BigNum} + */ + tx_index_bignum(): BigNum; + + /** + * @returns {BigNum} + */ + cert_index_bignum(): BigNum; +} +/** + */ +declare export class PointerAddress { + free(): void; + + /** + * @param {number} network + * @param {StakeCredential} payment + * @param {Pointer} stake + * @returns {PointerAddress} + */ + static new( + network: number, + payment: StakeCredential, + stake: Pointer + ): PointerAddress; + + /** + * @returns {StakeCredential} + */ + payment_cred(): StakeCredential; + + /** + * @returns {Pointer} + */ + stake_pointer(): Pointer; + + /** + * @returns {Address} + */ + to_address(): Address; + + /** + * @param {Address} addr + * @returns {PointerAddress | void} + */ + static from_address(addr: Address): PointerAddress | void; +} +/** + */ +declare export class PoolMetadata { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {PoolMetadata} + */ + static from_bytes(bytes: Uint8Array): PoolMetadata; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {PoolMetadata} + */ + static from_hex(hex_str: string): PoolMetadata; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {PoolMetadataJSON} + */ + to_js_value(): PoolMetadataJSON; + + /** + * @param {string} json + * @returns {PoolMetadata} + */ + static from_json(json: string): PoolMetadata; + + /** + * @returns {URL} + */ + url(): URL; + + /** + * @returns {PoolMetadataHash} + */ + pool_metadata_hash(): PoolMetadataHash; + + /** + * @param {URL} url + * @param {PoolMetadataHash} pool_metadata_hash + * @returns {PoolMetadata} + */ + static new(url: URL, pool_metadata_hash: PoolMetadataHash): PoolMetadata; +} +/** + */ +declare export class PoolMetadataHash { + free(): void; + + /** + * @param {Uint8Array} bytes + * @returns {PoolMetadataHash} + */ + static from_bytes(bytes: Uint8Array): PoolMetadataHash; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {string} prefix + * @returns {string} + */ + to_bech32(prefix: string): string; + + /** + * @param {string} bech_str + * @returns {PoolMetadataHash} + */ + static from_bech32(bech_str: string): PoolMetadataHash; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex + * @returns {PoolMetadataHash} + */ + static from_hex(hex: string): PoolMetadataHash; +} +/** + */ +declare export class PoolParams { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {PoolParams} + */ + static from_bytes(bytes: Uint8Array): PoolParams; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {PoolParams} + */ + static from_hex(hex_str: string): PoolParams; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {PoolParamsJSON} + */ + to_js_value(): PoolParamsJSON; + + /** + * @param {string} json + * @returns {PoolParams} + */ + static from_json(json: string): PoolParams; + + /** + * @returns {Ed25519KeyHash} + */ + operator(): Ed25519KeyHash; + + /** + * @returns {VRFKeyHash} + */ + vrf_keyhash(): VRFKeyHash; + + /** + * @returns {BigNum} + */ + pledge(): BigNum; + + /** + * @returns {BigNum} + */ + cost(): BigNum; + + /** + * @returns {UnitInterval} + */ + margin(): UnitInterval; + + /** + * @returns {RewardAddress} + */ + reward_account(): RewardAddress; + + /** + * @returns {Ed25519KeyHashes} + */ + pool_owners(): Ed25519KeyHashes; + + /** + * @returns {Relays} + */ + relays(): Relays; + + /** + * @returns {PoolMetadata | void} + */ + pool_metadata(): PoolMetadata | void; + + /** + * @param {Ed25519KeyHash} operator + * @param {VRFKeyHash} vrf_keyhash + * @param {BigNum} pledge + * @param {BigNum} cost + * @param {UnitInterval} margin + * @param {RewardAddress} reward_account + * @param {Ed25519KeyHashes} pool_owners + * @param {Relays} relays + * @param {PoolMetadata | void} pool_metadata + * @returns {PoolParams} + */ + static new( + operator: Ed25519KeyHash, + vrf_keyhash: VRFKeyHash, + pledge: BigNum, + cost: BigNum, + margin: UnitInterval, + reward_account: RewardAddress, + pool_owners: Ed25519KeyHashes, + relays: Relays, + pool_metadata?: PoolMetadata + ): PoolParams; +} +/** + */ +declare export class PoolRegistration { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {PoolRegistration} + */ + static from_bytes(bytes: Uint8Array): PoolRegistration; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {PoolRegistration} + */ + static from_hex(hex_str: string): PoolRegistration; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {PoolRegistrationJSON} + */ + to_js_value(): PoolRegistrationJSON; + + /** + * @param {string} json + * @returns {PoolRegistration} + */ + static from_json(json: string): PoolRegistration; + + /** + * @returns {PoolParams} + */ + pool_params(): PoolParams; + + /** + * @param {PoolParams} pool_params + * @returns {PoolRegistration} + */ + static new(pool_params: PoolParams): PoolRegistration; +} +/** + */ +declare export class PoolRetirement { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {PoolRetirement} + */ + static from_bytes(bytes: Uint8Array): PoolRetirement; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {PoolRetirement} + */ + static from_hex(hex_str: string): PoolRetirement; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {PoolRetirementJSON} + */ + to_js_value(): PoolRetirementJSON; + + /** + * @param {string} json + * @returns {PoolRetirement} + */ + static from_json(json: string): PoolRetirement; + + /** + * @returns {Ed25519KeyHash} + */ + pool_keyhash(): Ed25519KeyHash; + + /** + * @returns {number} + */ + epoch(): number; + + /** + * @param {Ed25519KeyHash} pool_keyhash + * @param {number} epoch + * @returns {PoolRetirement} + */ + static new(pool_keyhash: Ed25519KeyHash, epoch: number): PoolRetirement; +} +/** + */ +declare export class PrivateKey { + free(): void; + + /** + * @returns {PublicKey} + */ + to_public(): PublicKey; + + /** + * @returns {PrivateKey} + */ + static generate_ed25519(): PrivateKey; + + /** + * @returns {PrivateKey} + */ + static generate_ed25519extended(): PrivateKey; + + /** + * Get private key from its bech32 representation + * ```javascript + * PrivateKey.from_bech32('ed25519_sk1ahfetf02qwwg4dkq7mgp4a25lx5vh9920cr5wnxmpzz9906qvm8qwvlts0'); + * ``` + * For an extended 25519 key + * ```javascript + * PrivateKey.from_bech32('ed25519e_sk1gqwl4szuwwh6d0yk3nsqcc6xxc3fpvjlevgwvt60df59v8zd8f8prazt8ln3lmz096ux3xvhhvm3ca9wj2yctdh3pnw0szrma07rt5gl748fp'); + * ``` + * @param {string} bech32_str + * @returns {PrivateKey} + */ + static from_bech32(bech32_str: string): PrivateKey; + + /** + * @returns {string} + */ + to_bech32(): string; + + /** + * @returns {Uint8Array} + */ + as_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {PrivateKey} + */ + static from_extended_bytes(bytes: Uint8Array): PrivateKey; + + /** + * @param {Uint8Array} bytes + * @returns {PrivateKey} + */ + static from_normal_bytes(bytes: Uint8Array): PrivateKey; + + /** + * @param {Uint8Array} message + * @returns {Ed25519Signature} + */ + sign(message: Uint8Array): Ed25519Signature; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {PrivateKey} + */ + static from_hex(hex_str: string): PrivateKey; +} +/** + */ +declare export class ProposedProtocolParameterUpdates { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {ProposedProtocolParameterUpdates} + */ + static from_bytes(bytes: Uint8Array): ProposedProtocolParameterUpdates; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {ProposedProtocolParameterUpdates} + */ + static from_hex(hex_str: string): ProposedProtocolParameterUpdates; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {ProposedProtocolParameterUpdatesJSON} + */ + to_js_value(): ProposedProtocolParameterUpdatesJSON; + + /** + * @param {string} json + * @returns {ProposedProtocolParameterUpdates} + */ + static from_json(json: string): ProposedProtocolParameterUpdates; + + /** + * @returns {ProposedProtocolParameterUpdates} + */ + static new(): ProposedProtocolParameterUpdates; + + /** + * @returns {number} + */ + len(): number; + + /** + * @param {GenesisHash} key + * @param {ProtocolParamUpdate} value + * @returns {ProtocolParamUpdate | void} + */ + insert( + key: GenesisHash, + value: ProtocolParamUpdate + ): ProtocolParamUpdate | void; + + /** + * @param {GenesisHash} key + * @returns {ProtocolParamUpdate | void} + */ + get(key: GenesisHash): ProtocolParamUpdate | void; + + /** + * @returns {GenesisHashes} + */ + keys(): GenesisHashes; +} +/** + */ +declare export class ProtocolParamUpdate { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {ProtocolParamUpdate} + */ + static from_bytes(bytes: Uint8Array): ProtocolParamUpdate; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {ProtocolParamUpdate} + */ + static from_hex(hex_str: string): ProtocolParamUpdate; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {ProtocolParamUpdateJSON} + */ + to_js_value(): ProtocolParamUpdateJSON; + + /** + * @param {string} json + * @returns {ProtocolParamUpdate} + */ + static from_json(json: string): ProtocolParamUpdate; + + /** + * @param {BigNum} minfee_a + */ + set_minfee_a(minfee_a: BigNum): void; + + /** + * @returns {BigNum | void} + */ + minfee_a(): BigNum | void; + + /** + * @param {BigNum} minfee_b + */ + set_minfee_b(minfee_b: BigNum): void; + + /** + * @returns {BigNum | void} + */ + minfee_b(): BigNum | void; + + /** + * @param {number} max_block_body_size + */ + set_max_block_body_size(max_block_body_size: number): void; + + /** + * @returns {number | void} + */ + max_block_body_size(): number | void; + + /** + * @param {number} max_tx_size + */ + set_max_tx_size(max_tx_size: number): void; + + /** + * @returns {number | void} + */ + max_tx_size(): number | void; + + /** + * @param {number} max_block_header_size + */ + set_max_block_header_size(max_block_header_size: number): void; + + /** + * @returns {number | void} + */ + max_block_header_size(): number | void; + + /** + * @param {BigNum} key_deposit + */ + set_key_deposit(key_deposit: BigNum): void; + + /** + * @returns {BigNum | void} + */ + key_deposit(): BigNum | void; + + /** + * @param {BigNum} pool_deposit + */ + set_pool_deposit(pool_deposit: BigNum): void; + + /** + * @returns {BigNum | void} + */ + pool_deposit(): BigNum | void; + + /** + * @param {number} max_epoch + */ + set_max_epoch(max_epoch: number): void; + + /** + * @returns {number | void} + */ + max_epoch(): number | void; + + /** + * @param {number} n_opt + */ + set_n_opt(n_opt: number): void; + + /** + * @returns {number | void} + */ + n_opt(): number | void; + + /** + * @param {UnitInterval} pool_pledge_influence + */ + set_pool_pledge_influence(pool_pledge_influence: UnitInterval): void; + + /** + * @returns {UnitInterval | void} + */ + pool_pledge_influence(): UnitInterval | void; + + /** + * @param {UnitInterval} expansion_rate + */ + set_expansion_rate(expansion_rate: UnitInterval): void; + + /** + * @returns {UnitInterval | void} + */ + expansion_rate(): UnitInterval | void; + + /** + * @param {UnitInterval} treasury_growth_rate + */ + set_treasury_growth_rate(treasury_growth_rate: UnitInterval): void; + + /** + * @returns {UnitInterval | void} + */ + treasury_growth_rate(): UnitInterval | void; + + /** + * !!! DEPRECATED !!! + * Since babbage era this param is outdated. But this param you can meet in a pre-babbage block. + * @returns {UnitInterval | void} + */ + d(): UnitInterval | void; + + /** + * !!! DEPRECATED !!! + * Since babbage era this param is outdated. But this param you can meet in a pre-babbage block. + * @returns {Nonce | void} + */ + extra_entropy(): Nonce | void; + + /** + * @param {ProtocolVersion} protocol_version + */ + set_protocol_version(protocol_version: ProtocolVersion): void; + + /** + * @returns {ProtocolVersion | void} + */ + protocol_version(): ProtocolVersion | void; + + /** + * @param {BigNum} min_pool_cost + */ + set_min_pool_cost(min_pool_cost: BigNum): void; + + /** + * @returns {BigNum | void} + */ + min_pool_cost(): BigNum | void; + + /** + * @param {BigNum} ada_per_utxo_byte + */ + set_ada_per_utxo_byte(ada_per_utxo_byte: BigNum): void; + + /** + * @returns {BigNum | void} + */ + ada_per_utxo_byte(): BigNum | void; + + /** + * @param {Costmdls} cost_models + */ + set_cost_models(cost_models: Costmdls): void; + + /** + * @returns {Costmdls | void} + */ + cost_models(): Costmdls | void; + + /** + * @param {ExUnitPrices} execution_costs + */ + set_execution_costs(execution_costs: ExUnitPrices): void; + + /** + * @returns {ExUnitPrices | void} + */ + execution_costs(): ExUnitPrices | void; + + /** + * @param {ExUnits} max_tx_ex_units + */ + set_max_tx_ex_units(max_tx_ex_units: ExUnits): void; + + /** + * @returns {ExUnits | void} + */ + max_tx_ex_units(): ExUnits | void; + + /** + * @param {ExUnits} max_block_ex_units + */ + set_max_block_ex_units(max_block_ex_units: ExUnits): void; + + /** + * @returns {ExUnits | void} + */ + max_block_ex_units(): ExUnits | void; + + /** + * @param {number} max_value_size + */ + set_max_value_size(max_value_size: number): void; + + /** + * @returns {number | void} + */ + max_value_size(): number | void; + + /** + * @param {number} collateral_percentage + */ + set_collateral_percentage(collateral_percentage: number): void; + + /** + * @returns {number | void} + */ + collateral_percentage(): number | void; + + /** + * @param {number} max_collateral_inputs + */ + set_max_collateral_inputs(max_collateral_inputs: number): void; + + /** + * @returns {number | void} + */ + max_collateral_inputs(): number | void; + + /** + * @returns {ProtocolParamUpdate} + */ + static new(): ProtocolParamUpdate; +} +/** + */ +declare export class ProtocolVersion { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {ProtocolVersion} + */ + static from_bytes(bytes: Uint8Array): ProtocolVersion; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {ProtocolVersion} + */ + static from_hex(hex_str: string): ProtocolVersion; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {ProtocolVersionJSON} + */ + to_js_value(): ProtocolVersionJSON; + + /** + * @param {string} json + * @returns {ProtocolVersion} + */ + static from_json(json: string): ProtocolVersion; + + /** + * @returns {number} + */ + major(): number; + + /** + * @returns {number} + */ + minor(): number; + + /** + * @param {number} major + * @param {number} minor + * @returns {ProtocolVersion} + */ + static new(major: number, minor: number): ProtocolVersion; +} +/** + * ED25519 key used as public key + */ +declare export class PublicKey { + free(): void; + + /** + * Get public key from its bech32 representation + * Example: + * ```javascript + * const pkey = PublicKey.from_bech32('ed25519_pk1dgaagyh470y66p899txcl3r0jaeaxu6yd7z2dxyk55qcycdml8gszkxze2'); + * ``` + * @param {string} bech32_str + * @returns {PublicKey} + */ + static from_bech32(bech32_str: string): PublicKey; + + /** + * @returns {string} + */ + to_bech32(): string; + + /** + * @returns {Uint8Array} + */ + as_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {PublicKey} + */ + static from_bytes(bytes: Uint8Array): PublicKey; + + /** + * @param {Uint8Array} data + * @param {Ed25519Signature} signature + * @returns {boolean} + */ + verify(data: Uint8Array, signature: Ed25519Signature): boolean; + + /** + * @returns {Ed25519KeyHash} + */ + hash(): Ed25519KeyHash; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {PublicKey} + */ + static from_hex(hex_str: string): PublicKey; +} +/** + */ +declare export class PublicKeys { + free(): void; + + /** + */ + constructor(): this; + + /** + * @returns {number} + */ + size(): number; + + /** + * @param {number} index + * @returns {PublicKey} + */ + get(index: number): PublicKey; + + /** + * @param {PublicKey} key + */ + add(key: PublicKey): void; +} +/** + */ +declare export class Redeemer { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {Redeemer} + */ + static from_bytes(bytes: Uint8Array): Redeemer; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {Redeemer} + */ + static from_hex(hex_str: string): Redeemer; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {RedeemerJSON} + */ + to_js_value(): RedeemerJSON; + + /** + * @param {string} json + * @returns {Redeemer} + */ + static from_json(json: string): Redeemer; + + /** + * @returns {RedeemerTag} + */ + tag(): RedeemerTag; + + /** + * @returns {BigNum} + */ + index(): BigNum; + + /** + * @returns {PlutusData} + */ + data(): PlutusData; + + /** + * @returns {ExUnits} + */ + ex_units(): ExUnits; + + /** + * @param {RedeemerTag} tag + * @param {BigNum} index + * @param {PlutusData} data + * @param {ExUnits} ex_units + * @returns {Redeemer} + */ + static new( + tag: RedeemerTag, + index: BigNum, + data: PlutusData, + ex_units: ExUnits + ): Redeemer; +} +/** + */ +declare export class RedeemerTag { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {RedeemerTag} + */ + static from_bytes(bytes: Uint8Array): RedeemerTag; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {RedeemerTag} + */ + static from_hex(hex_str: string): RedeemerTag; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {RedeemerTagJSON} + */ + to_js_value(): RedeemerTagJSON; + + /** + * @param {string} json + * @returns {RedeemerTag} + */ + static from_json(json: string): RedeemerTag; + + /** + * @returns {RedeemerTag} + */ + static new_spend(): RedeemerTag; + + /** + * @returns {RedeemerTag} + */ + static new_mint(): RedeemerTag; + + /** + * @returns {RedeemerTag} + */ + static new_cert(): RedeemerTag; + + /** + * @returns {RedeemerTag} + */ + static new_reward(): RedeemerTag; + + /** + * @returns {number} + */ + kind(): number; +} +/** + */ +declare export class Redeemers { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {Redeemers} + */ + static from_bytes(bytes: Uint8Array): Redeemers; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {Redeemers} + */ + static from_hex(hex_str: string): Redeemers; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {RedeemersJSON} + */ + to_js_value(): RedeemersJSON; + + /** + * @param {string} json + * @returns {Redeemers} + */ + static from_json(json: string): Redeemers; + + /** + * @returns {Redeemers} + */ + static new(): Redeemers; + + /** + * @returns {number} + */ + len(): number; + + /** + * @param {number} index + * @returns {Redeemer} + */ + get(index: number): Redeemer; + + /** + * @param {Redeemer} elem + */ + add(elem: Redeemer): void; + + /** + * @returns {ExUnits} + */ + total_ex_units(): ExUnits; +} +/** + */ +declare export class Relay { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {Relay} + */ + static from_bytes(bytes: Uint8Array): Relay; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {Relay} + */ + static from_hex(hex_str: string): Relay; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {RelayJSON} + */ + to_js_value(): RelayJSON; + + /** + * @param {string} json + * @returns {Relay} + */ + static from_json(json: string): Relay; + + /** + * @param {SingleHostAddr} single_host_addr + * @returns {Relay} + */ + static new_single_host_addr(single_host_addr: SingleHostAddr): Relay; + + /** + * @param {SingleHostName} single_host_name + * @returns {Relay} + */ + static new_single_host_name(single_host_name: SingleHostName): Relay; + + /** + * @param {MultiHostName} multi_host_name + * @returns {Relay} + */ + static new_multi_host_name(multi_host_name: MultiHostName): Relay; + + /** + * @returns {number} + */ + kind(): number; + + /** + * @returns {SingleHostAddr | void} + */ + as_single_host_addr(): SingleHostAddr | void; + + /** + * @returns {SingleHostName | void} + */ + as_single_host_name(): SingleHostName | void; + + /** + * @returns {MultiHostName | void} + */ + as_multi_host_name(): MultiHostName | void; +} +/** + */ +declare export class Relays { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {Relays} + */ + static from_bytes(bytes: Uint8Array): Relays; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {Relays} + */ + static from_hex(hex_str: string): Relays; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {RelaysJSON} + */ + to_js_value(): RelaysJSON; + + /** + * @param {string} json + * @returns {Relays} + */ + static from_json(json: string): Relays; + + /** + * @returns {Relays} + */ + static new(): Relays; + + /** + * @returns {number} + */ + len(): number; + + /** + * @param {number} index + * @returns {Relay} + */ + get(index: number): Relay; + + /** + * @param {Relay} elem + */ + add(elem: Relay): void; +} +/** + */ +declare export class RewardAddress { + free(): void; + + /** + * @param {number} network + * @param {StakeCredential} payment + * @returns {RewardAddress} + */ + static new(network: number, payment: StakeCredential): RewardAddress; + + /** + * @returns {StakeCredential} + */ + payment_cred(): StakeCredential; + + /** + * @returns {Address} + */ + to_address(): Address; + + /** + * @param {Address} addr + * @returns {RewardAddress | void} + */ + static from_address(addr: Address): RewardAddress | void; +} +/** + */ +declare export class RewardAddresses { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {RewardAddresses} + */ + static from_bytes(bytes: Uint8Array): RewardAddresses; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {RewardAddresses} + */ + static from_hex(hex_str: string): RewardAddresses; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {RewardAddressesJSON} + */ + to_js_value(): RewardAddressesJSON; + + /** + * @param {string} json + * @returns {RewardAddresses} + */ + static from_json(json: string): RewardAddresses; + + /** + * @returns {RewardAddresses} + */ + static new(): RewardAddresses; + + /** + * @returns {number} + */ + len(): number; + + /** + * @param {number} index + * @returns {RewardAddress} + */ + get(index: number): RewardAddress; + + /** + * @param {RewardAddress} elem + */ + add(elem: RewardAddress): void; +} +/** + */ +declare export class Script { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {Script} + */ + static from_bytes(bytes: Uint8Array): Script; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {Script} + */ + static from_hex(hex_str: string): Script; + + /** + * @param {NativeScript} native_script + * @returns {Script} + */ + static new_native(native_script: NativeScript): Script; + + /** + * @param {PlutusScript} plutus_script + * @returns {Script} + */ + static new_plutus_v1(plutus_script: PlutusScript): Script; + + /** + * @param {PlutusScript} plutus_script + * @returns {Script} + */ + static new_plutus_v2(plutus_script: PlutusScript): Script; + + /** + * @param {PlutusScript} plutus_script + * @returns {Script} + */ + static new_plutus_v3(plutus_script: PlutusScript): Script; + + /** + * @returns {number} + */ + kind(): number; + + /** + * @returns {NativeScript | void} + */ + as_native(): NativeScript | void; + + /** + * @returns {PlutusScript | void} + */ + as_plutus(): PlutusScript | void; + + /** + * @returns {PlutusScript | void} + */ + as_plutus_v1(): PlutusScript | void; + + /** + * @returns {PlutusScript | void} + */ + as_plutus_v2(): PlutusScript | void; +} +/** + */ +declare export class ScriptAll { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {ScriptAll} + */ + static from_bytes(bytes: Uint8Array): ScriptAll; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {ScriptAll} + */ + static from_hex(hex_str: string): ScriptAll; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {ScriptAllJSON} + */ + to_js_value(): ScriptAllJSON; + + /** + * @param {string} json + * @returns {ScriptAll} + */ + static from_json(json: string): ScriptAll; + + /** + * @returns {NativeScripts} + */ + native_scripts(): NativeScripts; + + /** + * @param {NativeScripts} native_scripts + * @returns {ScriptAll} + */ + static new(native_scripts: NativeScripts): ScriptAll; +} +/** + */ +declare export class ScriptAny { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {ScriptAny} + */ + static from_bytes(bytes: Uint8Array): ScriptAny; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {ScriptAny} + */ + static from_hex(hex_str: string): ScriptAny; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {ScriptAnyJSON} + */ + to_js_value(): ScriptAnyJSON; + + /** + * @param {string} json + * @returns {ScriptAny} + */ + static from_json(json: string): ScriptAny; + + /** + * @returns {NativeScripts} + */ + native_scripts(): NativeScripts; + + /** + * @param {NativeScripts} native_scripts + * @returns {ScriptAny} + */ + static new(native_scripts: NativeScripts): ScriptAny; +} +/** + */ +declare export class ScriptDataHash { + free(): void; + + /** + * @param {Uint8Array} bytes + * @returns {ScriptDataHash} + */ + static from_bytes(bytes: Uint8Array): ScriptDataHash; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {string} prefix + * @returns {string} + */ + to_bech32(prefix: string): string; + + /** + * @param {string} bech_str + * @returns {ScriptDataHash} + */ + static from_bech32(bech_str: string): ScriptDataHash; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex + * @returns {ScriptDataHash} + */ + static from_hex(hex: string): ScriptDataHash; +} +/** + */ +declare export class ScriptHash { + free(): void; + + /** + * @param {Uint8Array} bytes + * @returns {ScriptHash} + */ + static from_bytes(bytes: Uint8Array): ScriptHash; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {string} prefix + * @returns {string} + */ + to_bech32(prefix: string): string; + + /** + * @param {string} bech_str + * @returns {ScriptHash} + */ + static from_bech32(bech_str: string): ScriptHash; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex + * @returns {ScriptHash} + */ + static from_hex(hex: string): ScriptHash; +} +/** + */ +declare export class ScriptHashes { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {ScriptHashes} + */ + static from_bytes(bytes: Uint8Array): ScriptHashes; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {ScriptHashes} + */ + static from_hex(hex_str: string): ScriptHashes; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {ScriptHashesJSON} + */ + to_js_value(): ScriptHashesJSON; + + /** + * @param {string} json + * @returns {ScriptHashes} + */ + static from_json(json: string): ScriptHashes; + + /** + * @returns {ScriptHashes} + */ + static new(): ScriptHashes; + + /** + * @returns {number} + */ + len(): number; + + /** + * @param {number} index + * @returns {ScriptHash} + */ + get(index: number): ScriptHash; + + /** + * @param {ScriptHash} elem + */ + add(elem: ScriptHash): void; +} +/** + */ +declare export class ScriptNOfK { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {ScriptNOfK} + */ + static from_bytes(bytes: Uint8Array): ScriptNOfK; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {ScriptNOfK} + */ + static from_hex(hex_str: string): ScriptNOfK; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {ScriptNOfKJSON} + */ + to_js_value(): ScriptNOfKJSON; + + /** + * @param {string} json + * @returns {ScriptNOfK} + */ + static from_json(json: string): ScriptNOfK; + + /** + * @returns {number} + */ + n(): number; + + /** + * @returns {NativeScripts} + */ + native_scripts(): NativeScripts; + + /** + * @param {number} n + * @param {NativeScripts} native_scripts + * @returns {ScriptNOfK} + */ + static new(n: number, native_scripts: NativeScripts): ScriptNOfK; +} +/** + */ +declare export class ScriptPubkey { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {ScriptPubkey} + */ + static from_bytes(bytes: Uint8Array): ScriptPubkey; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {ScriptPubkey} + */ + static from_hex(hex_str: string): ScriptPubkey; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {ScriptPubkeyJSON} + */ + to_js_value(): ScriptPubkeyJSON; + + /** + * @param {string} json + * @returns {ScriptPubkey} + */ + static from_json(json: string): ScriptPubkey; + + /** + * @returns {Ed25519KeyHash} + */ + addr_keyhash(): Ed25519KeyHash; + + /** + * @param {Ed25519KeyHash} addr_keyhash + * @returns {ScriptPubkey} + */ + static new(addr_keyhash: Ed25519KeyHash): ScriptPubkey; +} +/** + */ +declare export class ScriptRef { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {ScriptRef} + */ + static from_bytes(bytes: Uint8Array): ScriptRef; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {ScriptRef} + */ + static from_hex(hex_str: string): ScriptRef; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {ScriptRefJSON} + */ + to_js_value(): ScriptRefJSON; + + /** + * @param {string} json + * @returns {ScriptRef} + */ + static from_json(json: string): ScriptRef; + + /** + * @param {Script} script + * @returns {ScriptRef} + */ + static new(script: Script): ScriptRef; + + /** + * @param {NativeScript} native_script + * @returns {ScriptRef} + */ + static new_native_script(native_script: NativeScript): ScriptRef; + + /** + * @param {PlutusScript} plutus_script + * @returns {ScriptRef} + */ + static new_plutus_script(plutus_script: PlutusScript): ScriptRef; + + /** + * @returns {PlutusScript | void} + */ + plutus_script(): PlutusScript | void; + + /** + * @returns {Script} + */ + script(): Script; +} +/** + */ +declare export class SingleHostAddr { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {SingleHostAddr} + */ + static from_bytes(bytes: Uint8Array): SingleHostAddr; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {SingleHostAddr} + */ + static from_hex(hex_str: string): SingleHostAddr; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {SingleHostAddrJSON} + */ + to_js_value(): SingleHostAddrJSON; + + /** + * @param {string} json + * @returns {SingleHostAddr} + */ + static from_json(json: string): SingleHostAddr; + + /** + * @returns {number | void} + */ + port(): number | void; + + /** + * @returns {Ipv4 | void} + */ + ipv4(): Ipv4 | void; + + /** + * @returns {Ipv6 | void} + */ + ipv6(): Ipv6 | void; + + /** + * @param {number | void} port + * @param {Ipv4 | void} ipv4 + * @param {Ipv6 | void} ipv6 + * @returns {SingleHostAddr} + */ + static new(port?: number, ipv4?: Ipv4, ipv6?: Ipv6): SingleHostAddr; +} +/** + */ +declare export class SingleHostName { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {SingleHostName} + */ + static from_bytes(bytes: Uint8Array): SingleHostName; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {SingleHostName} + */ + static from_hex(hex_str: string): SingleHostName; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {SingleHostNameJSON} + */ + to_js_value(): SingleHostNameJSON; + + /** + * @param {string} json + * @returns {SingleHostName} + */ + static from_json(json: string): SingleHostName; + + /** + * @returns {number | void} + */ + port(): number | void; + + /** + * @returns {DNSRecordAorAAAA} + */ + dns_name(): DNSRecordAorAAAA; + + /** + * @param {number | void} port + * @param {DNSRecordAorAAAA} dns_name + * @returns {SingleHostName} + */ + static new(port: number | void, dns_name: DNSRecordAorAAAA): SingleHostName; +} +/** + */ +declare export class StakeCredential { + free(): void; + + /** + * @param {Ed25519KeyHash} hash + * @returns {StakeCredential} + */ + static from_keyhash(hash: Ed25519KeyHash): StakeCredential; + + /** + * @param {ScriptHash} hash + * @returns {StakeCredential} + */ + static from_scripthash(hash: ScriptHash): StakeCredential; + + /** + * @returns {Ed25519KeyHash | void} + */ + to_keyhash(): Ed25519KeyHash | void; + + /** + * @returns {ScriptHash | void} + */ + to_scripthash(): ScriptHash | void; + + /** + * @returns {number} + */ + kind(): number; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {StakeCredential} + */ + static from_bytes(bytes: Uint8Array): StakeCredential; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {StakeCredential} + */ + static from_hex(hex_str: string): StakeCredential; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {StakeCredentialJSON} + */ + to_js_value(): StakeCredentialJSON; + + /** + * @param {string} json + * @returns {StakeCredential} + */ + static from_json(json: string): StakeCredential; +} +/** + */ +declare export class StakeCredentials { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {StakeCredentials} + */ + static from_bytes(bytes: Uint8Array): StakeCredentials; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {StakeCredentials} + */ + static from_hex(hex_str: string): StakeCredentials; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {StakeCredentialsJSON} + */ + to_js_value(): StakeCredentialsJSON; + + /** + * @param {string} json + * @returns {StakeCredentials} + */ + static from_json(json: string): StakeCredentials; + + /** + * @returns {StakeCredentials} + */ + static new(): StakeCredentials; + + /** + * @returns {number} + */ + len(): number; + + /** + * @param {number} index + * @returns {StakeCredential} + */ + get(index: number): StakeCredential; + + /** + * @param {StakeCredential} elem + */ + add(elem: StakeCredential): void; +} +/** + */ +declare export class StakeDelegation { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {StakeDelegation} + */ + static from_bytes(bytes: Uint8Array): StakeDelegation; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {StakeDelegation} + */ + static from_hex(hex_str: string): StakeDelegation; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {StakeDelegationJSON} + */ + to_js_value(): StakeDelegationJSON; + + /** + * @param {string} json + * @returns {StakeDelegation} + */ + static from_json(json: string): StakeDelegation; + + /** + * @returns {StakeCredential} + */ + stake_credential(): StakeCredential; + + /** + * @returns {Ed25519KeyHash} + */ + pool_keyhash(): Ed25519KeyHash; + + /** + * @param {StakeCredential} stake_credential + * @param {Ed25519KeyHash} pool_keyhash + * @returns {StakeDelegation} + */ + static new( + stake_credential: StakeCredential, + pool_keyhash: Ed25519KeyHash + ): StakeDelegation; +} +/** + */ +declare export class StakeDeregistration { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {StakeDeregistration} + */ + static from_bytes(bytes: Uint8Array): StakeDeregistration; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {StakeDeregistration} + */ + static from_hex(hex_str: string): StakeDeregistration; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {StakeDeregistrationJSON} + */ + to_js_value(): StakeDeregistrationJSON; + + /** + * @param {string} json + * @returns {StakeDeregistration} + */ + static from_json(json: string): StakeDeregistration; + + /** + * @returns {StakeCredential} + */ + stake_credential(): StakeCredential; + + /** + * @param {StakeCredential} stake_credential + * @returns {StakeDeregistration} + */ + static new(stake_credential: StakeCredential): StakeDeregistration; +} +/** + */ +declare export class StakeRegistration { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {StakeRegistration} + */ + static from_bytes(bytes: Uint8Array): StakeRegistration; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {StakeRegistration} + */ + static from_hex(hex_str: string): StakeRegistration; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {StakeRegistrationJSON} + */ + to_js_value(): StakeRegistrationJSON; + + /** + * @param {string} json + * @returns {StakeRegistration} + */ + static from_json(json: string): StakeRegistration; + + /** + * @returns {StakeCredential} + */ + stake_credential(): StakeCredential; + + /** + * @param {StakeCredential} stake_credential + * @returns {StakeRegistration} + */ + static new(stake_credential: StakeCredential): StakeRegistration; +} +/** + */ +declare export class Strings { + free(): void; + + /** + * @returns {Strings} + */ + static new(): Strings; + + /** + * @returns {number} + */ + len(): number; + + /** + * @param {number} index + * @returns {string} + */ + get(index: number): string; + + /** + * @param {string} elem + */ + add(elem: string): void; +} +/** + */ +declare export class TimelockExpiry { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {TimelockExpiry} + */ + static from_bytes(bytes: Uint8Array): TimelockExpiry; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {TimelockExpiry} + */ + static from_hex(hex_str: string): TimelockExpiry; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {TimelockExpiryJSON} + */ + to_js_value(): TimelockExpiryJSON; + + /** + * @param {string} json + * @returns {TimelockExpiry} + */ + static from_json(json: string): TimelockExpiry; + + /** + * @returns {number} + */ + slot(): number; + + /** + * @returns {BigNum} + */ + slot_bignum(): BigNum; + + /** + * !!! DEPRECATED !!! + * This constructor uses outdated slot number format. + * Use `.new_timelockexpiry` instead + * @param {number} slot + * @returns {TimelockExpiry} + */ + static new(slot: number): TimelockExpiry; + + /** + * @param {BigNum} slot + * @returns {TimelockExpiry} + */ + static new_timelockexpiry(slot: BigNum): TimelockExpiry; +} +/** + */ +declare export class TimelockStart { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {TimelockStart} + */ + static from_bytes(bytes: Uint8Array): TimelockStart; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {TimelockStart} + */ + static from_hex(hex_str: string): TimelockStart; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {TimelockStartJSON} + */ + to_js_value(): TimelockStartJSON; + + /** + * @param {string} json + * @returns {TimelockStart} + */ + static from_json(json: string): TimelockStart; + + /** + * !!! DEPRECATED !!! + * Returns a Slot32 (u32) value in case the underlying original BigNum (u64) value is within the limits. + * Otherwise will just raise an error. + * Use `.slot_bignum` instead + * @returns {number} + */ + slot(): number; + + /** + * @returns {BigNum} + */ + slot_bignum(): BigNum; + + /** + * !!! DEPRECATED !!! + * This constructor uses outdated slot number format. + * Use `.new_timelockstart` instead. + * @param {number} slot + * @returns {TimelockStart} + */ + static new(slot: number): TimelockStart; + + /** + * @param {BigNum} slot + * @returns {TimelockStart} + */ + static new_timelockstart(slot: BigNum): TimelockStart; +} +/** + */ +declare export class Transaction { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {Transaction} + */ + static from_bytes(bytes: Uint8Array): Transaction; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {Transaction} + */ + static from_hex(hex_str: string): Transaction; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {TransactionJSON} + */ + to_js_value(): TransactionJSON; + + /** + * @param {string} json + * @returns {Transaction} + */ + static from_json(json: string): Transaction; + + /** + * @returns {TransactionBody} + */ + body(): TransactionBody; + + /** + * @returns {TransactionWitnessSet} + */ + witness_set(): TransactionWitnessSet; + + /** + * @returns {boolean} + */ + is_valid(): boolean; + + /** + * @returns {AuxiliaryData | void} + */ + auxiliary_data(): AuxiliaryData | void; + + /** + * @param {boolean} valid + */ + set_is_valid(valid: boolean): void; + + /** + * @param {AuxiliaryData} auxiliary_data + */ + set_auxiliary_data(auxiliary_data: AuxiliaryData): void; + + /** + * @param {TransactionBody} body + * @param {TransactionWitnessSet} witness_set + * @returns {Transaction} + */ + static new( + body: TransactionBody, + witness_set: TransactionWitnessSet + ): Transaction; +} +/** + */ +declare export class TransactionBodies { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {TransactionBodies} + */ + static from_bytes(bytes: Uint8Array): TransactionBodies; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {TransactionBodies} + */ + static from_hex(hex_str: string): TransactionBodies; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {TransactionBodiesJSON} + */ + to_js_value(): TransactionBodiesJSON; + + /** + * @param {string} json + * @returns {TransactionBodies} + */ + static from_json(json: string): TransactionBodies; + + /** + * @returns {TransactionBodies} + */ + static new(): TransactionBodies; + + /** + * @returns {number} + */ + len(): number; + + /** + * @param {number} index + * @returns {TransactionBody} + */ + get(index: number): TransactionBody; + + /** + * @param {TransactionBody} elem + */ + add(elem: TransactionBody): void; +} +/** + */ +declare export class TransactionBody { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {TransactionBody} + */ + static from_bytes(bytes: Uint8Array): TransactionBody; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {TransactionBody} + */ + static from_hex(hex_str: string): TransactionBody; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {TransactionBodyJSON} + */ + to_js_value(): TransactionBodyJSON; + + /** + * @param {string} json + * @returns {TransactionBody} + */ + static from_json(json: string): TransactionBody; + + /** + * @returns {TransactionInputs} + */ + inputs(): TransactionInputs; + + /** + * @returns {TransactionOutputs} + */ + outputs(): TransactionOutputs; + + /** + * @returns {BigNum} + */ + fee(): BigNum; + + /** + * !!! DEPRECATED !!! + * Returns a Slot32 (u32) value in case the underlying original BigNum (u64) value is within the limits. + * Otherwise will just raise an error. + * @returns {number | void} + */ + ttl(): number | void; + + /** + * @returns {BigNum | void} + */ + ttl_bignum(): BigNum | void; + + /** + * @param {BigNum} ttl + */ + set_ttl(ttl: BigNum): void; + + /** + */ + remove_ttl(): void; + + /** + * @param {Certificates} certs + */ + set_certs(certs: Certificates): void; + + /** + * @returns {Certificates | void} + */ + certs(): Certificates | void; + + /** + * @param {Withdrawals} withdrawals + */ + set_withdrawals(withdrawals: Withdrawals): void; + + /** + * @returns {Withdrawals | void} + */ + withdrawals(): Withdrawals | void; + + /** + * @param {Update} update + */ + set_update(update: Update): void; + + /** + * @returns {Update | void} + */ + update(): Update | void; + + /** + * @param {AuxiliaryDataHash} auxiliary_data_hash + */ + set_auxiliary_data_hash(auxiliary_data_hash: AuxiliaryDataHash): void; + + /** + * @returns {AuxiliaryDataHash | void} + */ + auxiliary_data_hash(): AuxiliaryDataHash | void; + + /** + * !!! DEPRECATED !!! + * Uses outdated slot number format. + * @param {number} validity_start_interval + */ + set_validity_start_interval(validity_start_interval: number): void; + + /** + * @param {BigNum} validity_start_interval + */ + set_validity_start_interval_bignum(validity_start_interval: BigNum): void; + + /** + * @returns {BigNum | void} + */ + validity_start_interval_bignum(): BigNum | void; + + /** + * !!! DEPRECATED !!! + * Returns a Option (u32) value in case the underlying original Option (u64) value is within the limits. + * Otherwise will just raise an error. + * Use `.validity_start_interval_bignum` instead. + * @returns {number | void} + */ + validity_start_interval(): number | void; + + /** + * @param {Mint} mint + */ + set_mint(mint: Mint): void; + + /** + * @returns {Mint | void} + */ + mint(): Mint | void; + + /** + * This function returns the mint value of the transaction + * Use `.mint()` instead. + * @returns {Mint | void} + */ + multiassets(): Mint | void; + + /** + * @param {TransactionInputs} reference_inputs + */ + set_reference_inputs(reference_inputs: TransactionInputs): void; + + /** + * @returns {TransactionInputs | void} + */ + reference_inputs(): TransactionInputs | void; + + /** + * @param {ScriptDataHash} script_data_hash + */ + set_script_data_hash(script_data_hash: ScriptDataHash): void; + + /** + * @returns {ScriptDataHash | void} + */ + script_data_hash(): ScriptDataHash | void; + + /** + * @param {TransactionInputs} collateral + */ + set_collateral(collateral: TransactionInputs): void; + + /** + * @returns {TransactionInputs | void} + */ + collateral(): TransactionInputs | void; + + /** + * @param {Ed25519KeyHashes} required_signers + */ + set_required_signers(required_signers: Ed25519KeyHashes): void; + + /** + * @returns {Ed25519KeyHashes | void} + */ + required_signers(): Ed25519KeyHashes | void; + + /** + * @param {NetworkId} network_id + */ + set_network_id(network_id: NetworkId): void; + + /** + * @returns {NetworkId | void} + */ + network_id(): NetworkId | void; + + /** + * @param {TransactionOutput} collateral_return + */ + set_collateral_return(collateral_return: TransactionOutput): void; + + /** + * @returns {TransactionOutput | void} + */ + collateral_return(): TransactionOutput | void; + + /** + * @param {BigNum} total_collateral + */ + set_total_collateral(total_collateral: BigNum): void; + + /** + * @returns {BigNum | void} + */ + total_collateral(): BigNum | void; + + /** + * !!! DEPRECATED !!! + * This constructor uses outdated slot number format for the ttl value. + * Use `.new_tx_body` and then `.set_ttl` instead + * @param {TransactionInputs} inputs + * @param {TransactionOutputs} outputs + * @param {BigNum} fee + * @param {number | void} ttl + * @returns {TransactionBody} + */ + static new( + inputs: TransactionInputs, + outputs: TransactionOutputs, + fee: BigNum, + ttl?: number + ): TransactionBody; + + /** + * Returns a new TransactionBody. + * In the new version of "new" we removed optional ttl for support it by wasm_bingen. + * Your can use "set_ttl" and "remove_ttl" to set a new value for ttl or set it as None. + * @param {TransactionInputs} inputs + * @param {TransactionOutputs} outputs + * @param {BigNum} fee + * @returns {TransactionBody} + */ + static new_tx_body( + inputs: TransactionInputs, + outputs: TransactionOutputs, + fee: BigNum + ): TransactionBody; +} +/** + */ +declare export class TransactionBuilder { + free(): void; + + /** + * This automatically selects and adds inputs from {inputs} consisting of just enough to cover + * the outputs that have already been added. + * This should be called after adding all certs/outputs/etc and will be an error otherwise. + * Uses CIP2: https://github.com/cardano-foundation/CIPs/blob/master/CIP-0002/CIP-0002.md + * Adding a change output must be called after via TransactionBuilder::add_change_if_needed() + * This function, diverging from CIP2, takes into account fees and will attempt to add additional + * inputs to cover the minimum fees. This does not, however, set the txbuilder's fee. + * @param {TransactionUnspentOutputs} inputs + * @param {number} strategy + */ + add_inputs_from(inputs: TransactionUnspentOutputs, strategy: number): void; + + /** + * @param {TxInputsBuilder} inputs + */ + set_inputs(inputs: TxInputsBuilder): void; + + /** + * @returns {TransactionOutputs} + */ + reset_outputs(): TransactionOutputs; + + /** + * @param {TxInputsBuilder} collateral + */ + set_collateral(collateral: TxInputsBuilder): void; + + /** + * @param {TransactionOutput} collateral_return + */ + set_collateral_return(collateral_return: TransactionOutput): void; + + /** + * This function will set the collateral-return value and then auto-calculate and assign + * the total collateral coin value. Will raise an error in case no collateral inputs are set + * or in case the total collateral value will have any assets in it except coin. + * @param {TransactionOutput} collateral_return + */ + set_collateral_return_and_total(collateral_return: TransactionOutput): void; + + /** + * @param {BigNum} total_collateral + */ + set_total_collateral(total_collateral: BigNum): void; + + /** + * This function will set the total-collateral coin and then auto-calculate and assign + * the collateral return value. Will raise an error in case no collateral inputs are set. + * The specified address will be the received of the collateral return + * @param {BigNum} total_collateral + * @param {Address} return_address + */ + set_total_collateral_and_return( + total_collateral: BigNum, + return_address: Address + ): void; + + /** + * @param {TransactionInput} reference_input + */ + add_reference_input(reference_input: TransactionInput): void; + + /** + * We have to know what kind of inputs these are to know what kind of mock witnesses to create since + * 1) mock witnesses have different lengths depending on the type which changes the expecting fee + * 2) Witnesses are a set so we need to get rid of duplicates to avoid over-estimating the fee + * @param {Ed25519KeyHash} hash + * @param {TransactionInput} input + * @param {Value} amount + */ + add_key_input( + hash: Ed25519KeyHash, + input: TransactionInput, + amount: Value + ): void; + + /** + * 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` + * and `.add_required_plutus_input_scripts` to add the witness scripts + * + * Or instead use `.add_native_script_input` and `.add_plutus_script_input` + * to add inputs right along with the script, instead of the script hash + * @param {ScriptHash} hash + * @param {TransactionInput} input + * @param {Value} amount + */ + add_script_input( + hash: ScriptHash, + input: TransactionInput, + amount: Value + ): void; + + /** + * This method will add the input to the builder and also register the required native script witness + * @param {NativeScript} script + * @param {TransactionInput} input + * @param {Value} amount + */ + add_native_script_input( + script: NativeScript, + input: TransactionInput, + amount: Value + ): void; + + /** + * This method will add the input to the builder and also register the required plutus witness + * @param {PlutusWitness} witness + * @param {TransactionInput} input + * @param {Value} amount + */ + add_plutus_script_input( + witness: PlutusWitness, + input: TransactionInput, + amount: Value + ): void; + + /** + * @param {ByronAddress} hash + * @param {TransactionInput} input + * @param {Value} amount + */ + add_bootstrap_input( + hash: ByronAddress, + input: TransactionInput, + amount: Value + ): void; + + /** + * Note that for script inputs this method will use underlying generic `.add_script_input` + * which leaves a required empty spot for the script witness (or witnesses in case of Plutus). + * You can use `.add_native_script_input` or `.add_plutus_script_input` directly to register the input along with the witness. + * @param {Address} address + * @param {TransactionInput} input + * @param {Value} amount + */ + add_input(address: Address, input: TransactionInput, amount: Value): void; + + /** + * Returns the number of still missing input scripts (either native or plutus) + * Use `.add_required_native_input_scripts` or `.add_required_plutus_input_scripts` to add the missing scripts + * @returns {number} + */ + count_missing_input_scripts(): 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 {NativeScripts} scripts + * @returns {number} + */ + add_required_native_input_scripts(scripts: NativeScripts): 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 {PlutusWitnesses} scripts + * @returns {number} + */ + add_required_plutus_input_scripts(scripts: PlutusWitnesses): number; + + /** + * Returns a copy of the current script input witness scripts in the builder + * @returns {NativeScripts | void} + */ + get_native_input_scripts(): NativeScripts | void; + + /** + * Returns a copy of the current plutus input witness scripts in the builder. + * NOTE: each plutus witness will be cloned with a specific corresponding input index + * @returns {PlutusWitnesses | void} + */ + get_plutus_input_scripts(): PlutusWitnesses | void; + + /** + * calculates how much the fee would increase if you added a given output + * @param {Address} address + * @param {TransactionInput} input + * @param {Value} amount + * @returns {BigNum} + */ + fee_for_input( + address: Address, + input: TransactionInput, + amount: Value + ): BigNum; + + /** + * Add explicit output via a TransactionOutput object + * @param {TransactionOutput} output + */ + add_output(output: TransactionOutput): void; + + /** + * calculates how much the fee would increase if you added a given output + * @param {TransactionOutput} output + * @returns {BigNum} + */ + fee_for_output(output: TransactionOutput): BigNum; + + /** + * @param {BigNum} fee + */ + set_fee(fee: BigNum): void; + + /** + * !!! DEPRECATED !!! + * Set ttl value. + * @param {number} ttl + */ + set_ttl(ttl: number): void; + + /** + * @param {BigNum} ttl + */ + set_ttl_bignum(ttl: BigNum): void; + + /** + * !!! DEPRECATED !!! + * Uses outdated slot number format. + * @param {number} validity_start_interval + */ + set_validity_start_interval(validity_start_interval: number): void; + + /** + * @param {BigNum} validity_start_interval + */ + set_validity_start_interval_bignum(validity_start_interval: BigNum): void; + + /** + * @param {Certificates} certs + */ + set_certs(certs: Certificates): void; + + /** + * @param {Withdrawals} withdrawals + */ + set_withdrawals(withdrawals: Withdrawals): void; + + /** + * @param {RewardAddress} reward_address + * @returns {number | void} + */ + get_index_of_withdrawal(reward_address: RewardAddress): number | void; + + /** + * @returns {AuxiliaryData | void} + */ + get_auxiliary_data(): AuxiliaryData | void; + + /** + * Set explicit auxiliary data via an AuxiliaryData object + * It might contain some metadata plus native or Plutus scripts + * @param {AuxiliaryData} auxiliary_data + */ + set_auxiliary_data(auxiliary_data: AuxiliaryData): void; + + /** + * Set metadata using a GeneralTransactionMetadata object + * It will be set to the existing or new auxiliary data in this builder + * @param {GeneralTransactionMetadata} metadata + */ + set_metadata(metadata: GeneralTransactionMetadata): void; + + /** + * Add a single metadatum using TransactionMetadatumLabel and TransactionMetadatum objects + * It will be securely added to existing or new metadata in this builder + * @param {BigNum} key + * @param {TransactionMetadatum} val + */ + add_metadatum(key: BigNum, val: TransactionMetadatum): void; + + /** + * Add a single JSON metadatum using a TransactionMetadatumLabel and a String + * It will be securely added to existing or new metadata in this builder + * @param {BigNum} key + * @param {string} val + */ + add_json_metadatum(key: BigNum, val: string): void; + + /** + * Add a single JSON metadatum using a TransactionMetadatumLabel, a String, and a MetadataJsonSchema object + * It will be securely added to existing or new metadata in this builder + * @param {BigNum} key + * @param {string} val + * @param {number} schema + */ + add_json_metadatum_with_schema( + key: BigNum, + val: string, + schema: number + ): void; + + /** + * @returns {PlutusScripts | void} + */ + get_plutus_scripts(): PlutusScripts | void; + + /** + * @param {PlutusScripts} plutus_scripts + */ + set_plutus_scripts(plutus_scripts: PlutusScripts): void; + + /** + * @returns {PlutusList | void} + */ + get_plutus_data(): PlutusList | void; + + /** + * @param {PlutusList} plutus_data + */ + set_plutus_data(plutus_data: PlutusList): void; + + /** + * @returns {Redeemers | void} + */ + get_redeemers(): Redeemers | void; + + /** + * @param {Redeemers} redeemers + */ + set_redeemers(redeemers: Redeemers): void; + + /** + * @param {TransactionInput} input + * @returns {number} + */ + index_of_input(input: TransactionInput): number; + + /** + * @returns {TransactionInputs} + */ + get_inputs(): TransactionInputs; + + /** + * 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 + * @param {Mint} mint + * @param {NativeScripts} mint_scripts + */ + set_mint(mint: Mint, mint_scripts: NativeScripts): void; + + /** + * Returns a copy of the current mint state in the builder + * @returns {Mint | void} + */ + get_mint(): Mint | void; + + /** + * Returns a copy of the current mint witness scripts in the builder + * @returns {NativeScripts | void} + */ + get_mint_scripts(): NativeScripts | void; + + /** + * 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 + * @param {NativeScript} policy_script + * @param {MintAssets} mint_assets + */ + set_mint_asset(policy_script: NativeScript, mint_assets: MintAssets): void; + + /** + * 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 + * @param {NativeScript} policy_script + * @param {AssetName} asset_name + * @param {Int} amount + */ + add_mint_asset( + policy_script: NativeScript, + asset_name: AssetName, + amount: Int + ): void; + + /** + * Add a mint entry together with an output to this builder + * Using a PolicyID, AssetName, Int for amount, Address, and Coin (BigNum) objects + * The asset will be securely added to existing or new Mint in this builder + * A new output will be added with the specified Address, the Coin value, and the minted asset + * @param {NativeScript} policy_script + * @param {AssetName} asset_name + * @param {Int} amount + * @param {TransactionOutputAmountBuilder} output_builder + * @param {BigNum} output_coin + */ + add_mint_asset_and_output( + policy_script: NativeScript, + asset_name: AssetName, + amount: Int, + output_builder: TransactionOutputAmountBuilder, + output_coin: BigNum + ): void; + + /** + * Add a mint entry together with an output to this builder + * Using a PolicyID, AssetName, Int for amount, and Address objects + * The asset will be securely added to existing or new Mint in this builder + * A new output will be added with the specified Address and the minted asset + * The output will be set to contain the minimum required amount of Coin + * @param {NativeScript} policy_script + * @param {AssetName} asset_name + * @param {Int} amount + * @param {TransactionOutputAmountBuilder} output_builder + */ + add_mint_asset_and_output_min_required_coin( + policy_script: NativeScript, + asset_name: AssetName, + amount: Int, + output_builder: TransactionOutputAmountBuilder + ): void; + + /** + * @param {TransactionBuilderConfig} cfg + * @returns {TransactionBuilder} + */ + static new(cfg: TransactionBuilderConfig): TransactionBuilder; + + /** + * @returns {TransactionInputs} + */ + get_reference_inputs(): TransactionInputs; + + /** + * does not include refunds or withdrawals + * @returns {Value} + */ + get_explicit_input(): Value; + + /** + * withdrawals and refunds + * @returns {Value} + */ + get_implicit_input(): Value; + + /** + * Return explicit input plus implicit input plus mint + * @returns {Value} + */ + get_total_input(): Value; + + /** + * Return explicit output plus deposit plus burn + * @returns {Value} + */ + get_total_output(): Value; + + /** + * does not include fee + * @returns {Value} + */ + get_explicit_output(): Value; + + /** + * @returns {BigNum} + */ + get_deposit(): BigNum; + + /** + * @returns {BigNum | void} + */ + get_fee_if_set(): BigNum | void; + + /** + * Warning: this function will mutate the /fee/ field + * Make sure to call this function last after setting all other tx-body properties + * Editing inputs, outputs, mint, etc. after change been calculated + * might cause a mismatch in calculated fee versus the required fee + * @param {Address} address + * @returns {boolean} + */ + add_change_if_needed(address: Address): boolean; + + /** + * This method will calculate the script hash data + * using the plutus datums and redeemers already present in the builder + * along with the provided cost model, and will register the calculated value + * in the builder to be used when building the tx body. + * In case there are no plutus input witnesses present - nothing will change + * You can set specific hash value using `.set_script_data_hash` + * NOTE: this function will check which language versions are used in the present scripts + * and will assert and require for a corresponding cost-model to be present in the passed map. + * Only the cost-models for the present language versions will be used in the hash calculation. + * @param {Costmdls} cost_models + */ + calc_script_data_hash(cost_models: Costmdls): void; + + /** + * Sets the specified hash value. + * Alternatively you can use `.calc_script_data_hash` to calculate the hash automatically. + * Or use `.remove_script_data_hash` to delete the previously set value + * @param {ScriptDataHash} hash + */ + set_script_data_hash(hash: ScriptDataHash): void; + + /** + * Deletes any previously set plutus data hash value. + * Use `.set_script_data_hash` or `.calc_script_data_hash` to set it. + */ + remove_script_data_hash(): void; + + /** + * @param {Ed25519KeyHash} key + */ + add_required_signer(key: Ed25519KeyHash): void; + + /** + * @returns {number} + */ + full_size(): number; + + /** + * @returns {Uint32Array} + */ + output_sizes(): Uint32Array; + + /** + * @returns {Uint32Array} + */ + input_sizes(): Uint32Array; + + /** + * @returns {LinearFee} + */ + fee_algo(): LinearFee; + + /** + * Returns object the body of the new transaction + * Auxiliary data itself is not included + * You can use `get_auxiliary_data` or `build_tx` + * @returns {TransactionBody} + */ + build(): TransactionBody; + + /** + * Returns full Transaction object with the body and the auxiliary data + * NOTE: witness_set will contain all mint_scripts if any been added or set + * NOTE: is_valid set to true + * NOTE: Will fail in case there are any script inputs added with no corresponding witness + * @returns {Transaction} + */ + build_tx(): Transaction; + + /** + * Similar to `.build_tx()` but will NOT fail in case there are missing script witnesses + * @returns {Transaction} + */ + build_tx_unsafe(): Transaction; + + /** + * warning: sum of all parts of a transaction must equal 0. You cannot just set the fee to the min value and forget about it + * warning: min_fee may be slightly larger than the actual minimum fee (ex: a few lovelaces) + * this is done to simplify the library code, but can be fixed later + * @returns {BigNum} + */ + min_fee(): BigNum; + + /** + * @returns {number} + */ + fake_tx_full_size(): number; +} +/** + */ +declare export class TransactionBuilderConfig { + free(): void; +} +/** + */ +declare export class TransactionBuilderConfigBuilder { + free(): void; + + /** + * @returns {TransactionBuilderConfigBuilder} + */ + static new(): TransactionBuilderConfigBuilder; + + /** + * @param {LinearFee} fee_algo + * @returns {TransactionBuilderConfigBuilder} + */ + fee_algo(fee_algo: LinearFee): TransactionBuilderConfigBuilder; + + /** + * !!! DEPRECATED !!! + * Since babbage era cardano nodes use coins per byte. Use '.coins_per_utxo_byte' instead. + * @param {BigNum} coins_per_utxo_word + * @returns {TransactionBuilderConfigBuilder} + */ + coins_per_utxo_word( + coins_per_utxo_word: BigNum + ): TransactionBuilderConfigBuilder; + + /** + * @param {BigNum} coins_per_utxo_byte + * @returns {TransactionBuilderConfigBuilder} + */ + coins_per_utxo_byte( + coins_per_utxo_byte: BigNum + ): TransactionBuilderConfigBuilder; + + /** + * @param {ExUnitPrices} ex_unit_prices + * @returns {TransactionBuilderConfigBuilder} + */ + ex_unit_prices(ex_unit_prices: ExUnitPrices): TransactionBuilderConfigBuilder; + + /** + * @param {BigNum} pool_deposit + * @returns {TransactionBuilderConfigBuilder} + */ + pool_deposit(pool_deposit: BigNum): TransactionBuilderConfigBuilder; + + /** + * @param {BigNum} key_deposit + * @returns {TransactionBuilderConfigBuilder} + */ + key_deposit(key_deposit: BigNum): TransactionBuilderConfigBuilder; + + /** + * @param {number} max_value_size + * @returns {TransactionBuilderConfigBuilder} + */ + max_value_size(max_value_size: number): TransactionBuilderConfigBuilder; + + /** + * @param {number} max_tx_size + * @returns {TransactionBuilderConfigBuilder} + */ + max_tx_size(max_tx_size: number): TransactionBuilderConfigBuilder; + + /** + * @param {boolean} prefer_pure_change + * @returns {TransactionBuilderConfigBuilder} + */ + prefer_pure_change( + prefer_pure_change: boolean + ): TransactionBuilderConfigBuilder; + + /** + * @param {boolean} minswap_mode + * @returns {TransactionBuilderConfigBuilder} + */ + minswap_mode(minswap_mode: boolean): TransactionBuilderConfigBuilder; + + /** + * @returns {TransactionBuilderConfig} + */ + build(): TransactionBuilderConfig; +} +/** + */ +declare export class TransactionHash { + free(): void; + + /** + * @param {Uint8Array} bytes + * @returns {TransactionHash} + */ + static from_bytes(bytes: Uint8Array): TransactionHash; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {string} prefix + * @returns {string} + */ + to_bech32(prefix: string): string; + + /** + * @param {string} bech_str + * @returns {TransactionHash} + */ + static from_bech32(bech_str: string): TransactionHash; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex + * @returns {TransactionHash} + */ + static from_hex(hex: string): TransactionHash; +} +/** + */ +declare export class TransactionInput { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {TransactionInput} + */ + static from_bytes(bytes: Uint8Array): TransactionInput; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {TransactionInput} + */ + static from_hex(hex_str: string): TransactionInput; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {TransactionInputJSON} + */ + to_js_value(): TransactionInputJSON; + + /** + * @param {string} json + * @returns {TransactionInput} + */ + static from_json(json: string): TransactionInput; + + /** + * @returns {TransactionHash} + */ + transaction_id(): TransactionHash; + + /** + * @returns {number} + */ + index(): number; + + /** + * @param {TransactionHash} transaction_id + * @param {number} index + * @returns {TransactionInput} + */ + static new(transaction_id: TransactionHash, index: number): TransactionInput; +} +/** + */ +declare export class TransactionInputs { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {TransactionInputs} + */ + static from_bytes(bytes: Uint8Array): TransactionInputs; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {TransactionInputs} + */ + static from_hex(hex_str: string): TransactionInputs; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {TransactionInputsJSON} + */ + to_js_value(): TransactionInputsJSON; + + /** + * @param {string} json + * @returns {TransactionInputs} + */ + static from_json(json: string): TransactionInputs; + + /** + * @returns {TransactionInputs} + */ + static new(): TransactionInputs; + + /** + * @returns {number} + */ + len(): number; + + /** + * @param {number} index + * @returns {TransactionInput} + */ + get(index: number): TransactionInput; + + /** + * @param {TransactionInput} elem + */ + add(elem: TransactionInput): void; + + /** + * @returns {TransactionInputs | void} + */ + to_option(): TransactionInputs | void; +} +/** + */ +declare export class TransactionMetadatum { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {TransactionMetadatum} + */ + static from_bytes(bytes: Uint8Array): TransactionMetadatum; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {TransactionMetadatum} + */ + static from_hex(hex_str: string): TransactionMetadatum; + + /** + * @param {MetadataMap} map + * @returns {TransactionMetadatum} + */ + static new_map(map: MetadataMap): TransactionMetadatum; + + /** + * @param {MetadataList} list + * @returns {TransactionMetadatum} + */ + static new_list(list: MetadataList): TransactionMetadatum; + + /** + * @param {Int} int + * @returns {TransactionMetadatum} + */ + static new_int(int: Int): TransactionMetadatum; + + /** + * @param {Uint8Array} bytes + * @returns {TransactionMetadatum} + */ + static new_bytes(bytes: Uint8Array): TransactionMetadatum; + + /** + * @param {string} text + * @returns {TransactionMetadatum} + */ + static new_text(text: string): TransactionMetadatum; + + /** + * @returns {number} + */ + kind(): number; + + /** + * @returns {MetadataMap} + */ + as_map(): MetadataMap; + + /** + * @returns {MetadataList} + */ + as_list(): MetadataList; + + /** + * @returns {Int} + */ + as_int(): Int; + + /** + * @returns {Uint8Array} + */ + as_bytes(): Uint8Array; + + /** + * @returns {string} + */ + as_text(): string; +} +/** + */ +declare export class TransactionMetadatumLabels { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {TransactionMetadatumLabels} + */ + static from_bytes(bytes: Uint8Array): TransactionMetadatumLabels; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {TransactionMetadatumLabels} + */ + static from_hex(hex_str: string): TransactionMetadatumLabels; + + /** + * @returns {TransactionMetadatumLabels} + */ + static new(): TransactionMetadatumLabels; + + /** + * @returns {number} + */ + len(): number; + + /** + * @param {number} index + * @returns {BigNum} + */ + get(index: number): BigNum; + + /** + * @param {BigNum} elem + */ + add(elem: BigNum): void; +} +/** + */ +declare export class TransactionOutput { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {TransactionOutput} + */ + static from_bytes(bytes: Uint8Array): TransactionOutput; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {TransactionOutput} + */ + static from_hex(hex_str: string): TransactionOutput; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {TransactionOutputJSON} + */ + to_js_value(): TransactionOutputJSON; + + /** + * @param {string} json + * @returns {TransactionOutput} + */ + static from_json(json: string): TransactionOutput; + + /** + * @returns {Address} + */ + address(): Address; + + /** + * @returns {Value} + */ + amount(): Value; + + /** + * @returns {DataHash | void} + */ + data_hash(): DataHash | void; + + /** + * @returns {PlutusData | void} + */ + plutus_data(): PlutusData | void; + + /** + * @returns {ScriptRef | void} + */ + script_ref(): ScriptRef | void; + + /** + * @param {ScriptRef} script_ref + */ + set_script_ref(script_ref: ScriptRef): void; + + /** + * @param {PlutusData} data + */ + set_plutus_data(data: PlutusData): void; + + /** + * @param {DataHash} data_hash + */ + set_data_hash(data_hash: DataHash): void; + + /** + * @returns {boolean} + */ + has_plutus_data(): boolean; + + /** + * @returns {boolean} + */ + has_data_hash(): boolean; + + /** + * @returns {boolean} + */ + has_script_ref(): boolean; + + /** + * @param {Address} address + * @param {Value} amount + * @returns {TransactionOutput} + */ + static new(address: Address, amount: Value): TransactionOutput; +} +/** + */ +declare export class TransactionOutputAmountBuilder { + free(): void; + + /** + * @param {Value} amount + * @returns {TransactionOutputAmountBuilder} + */ + with_value(amount: Value): TransactionOutputAmountBuilder; + + /** + * @param {BigNum} coin + * @returns {TransactionOutputAmountBuilder} + */ + with_coin(coin: BigNum): TransactionOutputAmountBuilder; + + /** + * @param {BigNum} coin + * @param {MultiAsset} multiasset + * @returns {TransactionOutputAmountBuilder} + */ + with_coin_and_asset( + coin: BigNum, + multiasset: MultiAsset + ): TransactionOutputAmountBuilder; + + /** + * !!! DEPRECATED !!! + * Since babbage era cardano nodes use coins per byte. Use '.with_asset_and_min_required_coin_by_utxo_cost' instead. + * @param {MultiAsset} multiasset + * @param {BigNum} coins_per_utxo_word + * @returns {TransactionOutputAmountBuilder} + */ + with_asset_and_min_required_coin( + multiasset: MultiAsset, + coins_per_utxo_word: BigNum + ): TransactionOutputAmountBuilder; + + /** + * @param {MultiAsset} multiasset + * @param {DataCost} data_cost + * @returns {TransactionOutputAmountBuilder} + */ + with_asset_and_min_required_coin_by_utxo_cost( + multiasset: MultiAsset, + data_cost: DataCost + ): TransactionOutputAmountBuilder; + + /** + * @returns {TransactionOutput} + */ + build(): TransactionOutput; +} +/** + * We introduce a builder-pattern format for creating transaction outputs + * This is because: + * 1. Some fields (i.e. data hash) are optional, and we can't easily expose Option<> in WASM + * 2. Some fields like amounts have many ways it could be set (some depending on other field values being known) + * 3. Easier to adapt as the output format gets more complicated in future Cardano releases + */ +declare export class TransactionOutputBuilder { + free(): void; + + /** + * @returns {TransactionOutputBuilder} + */ + static new(): TransactionOutputBuilder; + + /** + * @param {Address} address + * @returns {TransactionOutputBuilder} + */ + with_address(address: Address): TransactionOutputBuilder; + + /** + * @param {DataHash} data_hash + * @returns {TransactionOutputBuilder} + */ + with_data_hash(data_hash: DataHash): TransactionOutputBuilder; + + /** + * @param {PlutusData} data + * @returns {TransactionOutputBuilder} + */ + with_plutus_data(data: PlutusData): TransactionOutputBuilder; + + /** + * @param {ScriptRef} script_ref + * @returns {TransactionOutputBuilder} + */ + with_script_ref(script_ref: ScriptRef): TransactionOutputBuilder; + + /** + * @returns {TransactionOutputAmountBuilder} + */ + next(): TransactionOutputAmountBuilder; +} +/** + */ +declare export class TransactionOutputs { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {TransactionOutputs} + */ + static from_bytes(bytes: Uint8Array): TransactionOutputs; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {TransactionOutputs} + */ + static from_hex(hex_str: string): TransactionOutputs; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {TransactionOutputsJSON} + */ + to_js_value(): TransactionOutputsJSON; + + /** + * @param {string} json + * @returns {TransactionOutputs} + */ + static from_json(json: string): TransactionOutputs; + + /** + * @returns {TransactionOutputs} + */ + static new(): TransactionOutputs; + + /** + * @returns {number} + */ + len(): number; + + /** + * @param {number} index + * @returns {TransactionOutput} + */ + get(index: number): TransactionOutput; + + /** + * @param {TransactionOutput} elem + */ + add(elem: TransactionOutput): void; +} +/** + */ +declare export class TransactionUnspentOutput { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {TransactionUnspentOutput} + */ + static from_bytes(bytes: Uint8Array): TransactionUnspentOutput; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {TransactionUnspentOutput} + */ + static from_hex(hex_str: string): TransactionUnspentOutput; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {TransactionUnspentOutputJSON} + */ + to_js_value(): TransactionUnspentOutputJSON; + + /** + * @param {string} json + * @returns {TransactionUnspentOutput} + */ + static from_json(json: string): TransactionUnspentOutput; + + /** + * @param {TransactionInput} input + * @param {TransactionOutput} output + * @returns {TransactionUnspentOutput} + */ + static new( + input: TransactionInput, + output: TransactionOutput + ): TransactionUnspentOutput; + + /** + * @returns {TransactionInput} + */ + input(): TransactionInput; + + /** + * @returns {TransactionOutput} + */ + output(): TransactionOutput; +} +/** + */ +declare export class TransactionUnspentOutputs { + free(): void; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {TransactionUnspentOutputsJSON} + */ + to_js_value(): TransactionUnspentOutputsJSON; + + /** + * @param {string} json + * @returns {TransactionUnspentOutputs} + */ + static from_json(json: string): TransactionUnspentOutputs; + + /** + * @returns {TransactionUnspentOutputs} + */ + static new(): TransactionUnspentOutputs; + + /** + * @returns {number} + */ + len(): number; + + /** + * @param {number} index + * @returns {TransactionUnspentOutput} + */ + get(index: number): TransactionUnspentOutput; + + /** + * @param {TransactionUnspentOutput} elem + */ + add(elem: TransactionUnspentOutput): void; +} +/** + */ +declare export class TransactionWitnessSet { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {TransactionWitnessSet} + */ + static from_bytes(bytes: Uint8Array): TransactionWitnessSet; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {TransactionWitnessSet} + */ + static from_hex(hex_str: string): TransactionWitnessSet; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {TransactionWitnessSetJSON} + */ + to_js_value(): TransactionWitnessSetJSON; + + /** + * @param {string} json + * @returns {TransactionWitnessSet} + */ + static from_json(json: string): TransactionWitnessSet; + + /** + * @param {Vkeywitnesses} vkeys + */ + set_vkeys(vkeys: Vkeywitnesses): void; + + /** + * @returns {Vkeywitnesses | void} + */ + vkeys(): Vkeywitnesses | void; + + /** + * @param {NativeScripts} native_scripts + */ + set_native_scripts(native_scripts: NativeScripts): void; + + /** + * @returns {NativeScripts | void} + */ + native_scripts(): NativeScripts | void; + + /** + * @param {BootstrapWitnesses} bootstraps + */ + set_bootstraps(bootstraps: BootstrapWitnesses): void; + + /** + * @returns {BootstrapWitnesses | void} + */ + bootstraps(): BootstrapWitnesses | void; + + /** + * @param {PlutusScripts} plutus_scripts + */ + set_plutus_scripts(plutus_scripts: PlutusScripts): void; + + /** + * @returns {PlutusScripts | void} + */ + plutus_scripts(): PlutusScripts | void; + + /** + * @param {PlutusList} plutus_data + */ + set_plutus_data(plutus_data: PlutusList): void; + + /** + * @returns {PlutusList | void} + */ + plutus_data(): PlutusList | void; + + /** + * @param {Redeemers} redeemers + */ + set_redeemers(redeemers: Redeemers): void; + + /** + * @returns {Redeemers | void} + */ + redeemers(): Redeemers | void; + + /** + * @returns {TransactionWitnessSet} + */ + static new(): TransactionWitnessSet; +} +/** + */ +declare export class TransactionWitnessSets { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {TransactionWitnessSets} + */ + static from_bytes(bytes: Uint8Array): TransactionWitnessSets; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {TransactionWitnessSets} + */ + static from_hex(hex_str: string): TransactionWitnessSets; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {TransactionWitnessSetsJSON} + */ + to_js_value(): TransactionWitnessSetsJSON; + + /** + * @param {string} json + * @returns {TransactionWitnessSets} + */ + static from_json(json: string): TransactionWitnessSets; + + /** + * @returns {TransactionWitnessSets} + */ + static new(): TransactionWitnessSets; + + /** + * @returns {number} + */ + len(): number; + + /** + * @param {number} index + * @returns {TransactionWitnessSet} + */ + get(index: number): TransactionWitnessSet; + + /** + * @param {TransactionWitnessSet} elem + */ + add(elem: TransactionWitnessSet): void; +} +/** + */ +declare export class TxBuilderConstants { + free(): void; + + /** + * @returns {Costmdls} + */ + static plutus_default_cost_models(): Costmdls; + + /** + * @returns {Costmdls} + */ + static plutus_alonzo_cost_models(): Costmdls; + + /** + * @returns {Costmdls} + */ + static plutus_vasil_cost_models(): Costmdls; +} +/** + */ +declare export class TxInputsBuilder { + free(): void; + + /** + * @returns {TxInputsBuilder} + */ + static new(): TxInputsBuilder; + + /** + * We have to know what kind of inputs these are to know what kind of mock witnesses to create since + * 1) mock witnesses have different lengths depending on the type which changes the expecting fee + * 2) Witnesses are a set so we need to get rid of duplicates to avoid over-estimating the fee + * @param {Ed25519KeyHash} hash + * @param {TransactionInput} input + * @param {Value} amount + */ + add_key_input( + hash: Ed25519KeyHash, + input: TransactionInput, + amount: Value + ): void; + + /** + * 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` + * and `.add_required_plutus_input_scripts` to add the witness scripts + * + * Or instead use `.add_native_script_input` and `.add_plutus_script_input` + * to add inputs right along with the script, instead of the script hash + * @param {ScriptHash} hash + * @param {TransactionInput} input + * @param {Value} amount + */ + add_script_input( + hash: ScriptHash, + input: TransactionInput, + amount: Value + ): void; + + /** + * This method will add the input to the builder and also register the required native script witness + * @param {NativeScript} script + * @param {TransactionInput} input + * @param {Value} amount + */ + add_native_script_input( + script: NativeScript, + input: TransactionInput, + amount: Value + ): void; + + /** + * This method will add the input to the builder and also register the required plutus witness + * @param {PlutusWitness} witness + * @param {TransactionInput} input + * @param {Value} amount + */ + add_plutus_script_input( + witness: PlutusWitness, + input: TransactionInput, + amount: Value + ): void; + + /** + * @param {ByronAddress} hash + * @param {TransactionInput} input + * @param {Value} amount + */ + add_bootstrap_input( + hash: ByronAddress, + input: TransactionInput, + amount: Value + ): void; + + /** + * Note that for script inputs this method will use underlying generic `.add_script_input` + * which leaves a required empty spot for the script witness (or witnesses in case of Plutus). + * You can use `.add_native_script_input` or `.add_plutus_script_input` directly to register the input along with the witness. + * @param {Address} address + * @param {TransactionInput} input + * @param {Value} amount + */ + add_input(address: Address, input: TransactionInput, amount: Value): void; + + /** + * Returns the number of still missing input scripts (either native or plutus) + * Use `.add_required_native_input_scripts` or `.add_required_plutus_input_scripts` to add the missing scripts + * @returns {number} + */ + count_missing_input_scripts(): 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 {NativeScripts} scripts + * @returns {number} + */ + add_required_native_input_scripts(scripts: NativeScripts): 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 {PlutusWitnesses} scripts + * @returns {number} + */ + add_required_plutus_input_scripts(scripts: PlutusWitnesses): number; + + /** + * @returns {TransactionInputs} + */ + get_ref_inputs(): TransactionInputs; + + /** + * Returns a copy of the current script input witness scripts in the builder + * @returns {NativeScripts | void} + */ + get_native_input_scripts(): NativeScripts | void; + + /** + * Returns a copy of the current plutus input witness scripts in the builder. + * NOTE: each plutus witness will be cloned with a specific corresponding input index + * @returns {PlutusWitnesses | void} + */ + get_plutus_input_scripts(): PlutusWitnesses | void; + + /** + * @returns {number} + */ + len(): number; + + /** + * @param {Ed25519KeyHash} key + */ + add_required_signer(key: Ed25519KeyHash): void; + + /** + * @param {Ed25519KeyHashes} keys + */ + add_required_signers(keys: Ed25519KeyHashes): void; + + /** + * @returns {Value} + */ + total_value(): Value; + + /** + * @returns {TransactionInputs} + */ + inputs(): TransactionInputs; + + /** + * @returns {TransactionInputs | void} + */ + inputs_option(): TransactionInputs | void; +} +/** + */ +declare export class URL { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {URL} + */ + static from_bytes(bytes: Uint8Array): URL; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {URL} + */ + static from_hex(hex_str: string): URL; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {URLJSON} + */ + to_js_value(): URLJSON; + + /** + * @param {string} json + * @returns {URL} + */ + static from_json(json: string): URL; + + /** + * @param {string} url + * @returns {URL} + */ + static new(url: string): URL; + + /** + * @returns {string} + */ + url(): string; +} +/** + */ +declare export class UnitInterval { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {UnitInterval} + */ + static from_bytes(bytes: Uint8Array): UnitInterval; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {UnitInterval} + */ + static from_hex(hex_str: string): UnitInterval; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {UnitIntervalJSON} + */ + to_js_value(): UnitIntervalJSON; + + /** + * @param {string} json + * @returns {UnitInterval} + */ + static from_json(json: string): UnitInterval; + + /** + * @returns {BigNum} + */ + numerator(): BigNum; + + /** + * @returns {BigNum} + */ + denominator(): BigNum; + + /** + * @param {BigNum} numerator + * @param {BigNum} denominator + * @returns {UnitInterval} + */ + static new(numerator: BigNum, denominator: BigNum): UnitInterval; +} +/** + */ +declare export class Update { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {Update} + */ + static from_bytes(bytes: Uint8Array): Update; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {Update} + */ + static from_hex(hex_str: string): Update; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {UpdateJSON} + */ + to_js_value(): UpdateJSON; + + /** + * @param {string} json + * @returns {Update} + */ + static from_json(json: string): Update; + + /** + * @returns {ProposedProtocolParameterUpdates} + */ + proposed_protocol_parameter_updates(): ProposedProtocolParameterUpdates; + + /** + * @returns {number} + */ + epoch(): number; + + /** + * @param {ProposedProtocolParameterUpdates} proposed_protocol_parameter_updates + * @param {number} epoch + * @returns {Update} + */ + static new( + proposed_protocol_parameter_updates: ProposedProtocolParameterUpdates, + epoch: number + ): Update; +} +/** + */ +declare export class VRFCert { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {VRFCert} + */ + static from_bytes(bytes: Uint8Array): VRFCert; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {VRFCert} + */ + static from_hex(hex_str: string): VRFCert; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {VRFCertJSON} + */ + to_js_value(): VRFCertJSON; + + /** + * @param {string} json + * @returns {VRFCert} + */ + static from_json(json: string): VRFCert; + + /** + * @returns {Uint8Array} + */ + output(): Uint8Array; + + /** + * @returns {Uint8Array} + */ + proof(): Uint8Array; + + /** + * @param {Uint8Array} output + * @param {Uint8Array} proof + * @returns {VRFCert} + */ + static new(output: Uint8Array, proof: Uint8Array): VRFCert; +} +/** + */ +declare export class VRFKeyHash { + free(): void; + + /** + * @param {Uint8Array} bytes + * @returns {VRFKeyHash} + */ + static from_bytes(bytes: Uint8Array): VRFKeyHash; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {string} prefix + * @returns {string} + */ + to_bech32(prefix: string): string; + + /** + * @param {string} bech_str + * @returns {VRFKeyHash} + */ + static from_bech32(bech_str: string): VRFKeyHash; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex + * @returns {VRFKeyHash} + */ + static from_hex(hex: string): VRFKeyHash; +} +/** + */ +declare export class VRFVKey { + free(): void; + + /** + * @param {Uint8Array} bytes + * @returns {VRFVKey} + */ + static from_bytes(bytes: Uint8Array): VRFVKey; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {string} prefix + * @returns {string} + */ + to_bech32(prefix: string): string; + + /** + * @param {string} bech_str + * @returns {VRFVKey} + */ + static from_bech32(bech_str: string): VRFVKey; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex + * @returns {VRFVKey} + */ + static from_hex(hex: string): VRFVKey; +} +/** + */ +declare export class Value { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {Value} + */ + static from_bytes(bytes: Uint8Array): Value; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {Value} + */ + static from_hex(hex_str: string): Value; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {ValueJSON} + */ + to_js_value(): ValueJSON; + + /** + * @param {string} json + * @returns {Value} + */ + static from_json(json: string): Value; + + /** + * @param {BigNum} coin + * @returns {Value} + */ + static new(coin: BigNum): Value; + + /** + * @param {MultiAsset} multiasset + * @returns {Value} + */ + static new_from_assets(multiasset: MultiAsset): Value; + + /** + * @param {BigNum} coin + * @param {MultiAsset} multiasset + * @returns {Value} + */ + static new_with_assets(coin: BigNum, multiasset: MultiAsset): Value; + + /** + * @returns {Value} + */ + static zero(): Value; + + /** + * @returns {boolean} + */ + is_zero(): boolean; + + /** + * @returns {BigNum} + */ + coin(): BigNum; + + /** + * @param {BigNum} coin + */ + set_coin(coin: BigNum): void; + + /** + * @returns {MultiAsset | void} + */ + multiasset(): MultiAsset | void; + + /** + * @param {MultiAsset} multiasset + */ + set_multiasset(multiasset: MultiAsset): void; + + /** + * @param {Value} rhs + * @returns {Value} + */ + checked_add(rhs: Value): Value; + + /** + * @param {Value} rhs_value + * @returns {Value} + */ + checked_sub(rhs_value: Value): Value; + + /** + * @param {Value} rhs_value + * @returns {Value} + */ + clamped_sub(rhs_value: Value): Value; + + /** + * note: values are only partially comparable + * @param {Value} rhs_value + * @returns {number | void} + */ + compare(rhs_value: Value): number | void; +} +/** + */ +declare export class Vkey { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {Vkey} + */ + static from_bytes(bytes: Uint8Array): Vkey; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {Vkey} + */ + static from_hex(hex_str: string): Vkey; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {VkeyJSON} + */ + to_js_value(): VkeyJSON; + + /** + * @param {string} json + * @returns {Vkey} + */ + static from_json(json: string): Vkey; + + /** + * @param {PublicKey} pk + * @returns {Vkey} + */ + static new(pk: PublicKey): Vkey; + + /** + * @returns {PublicKey} + */ + public_key(): PublicKey; +} +/** + */ +declare export class Vkeys { + free(): void; + + /** + * @returns {Vkeys} + */ + static new(): Vkeys; + + /** + * @returns {number} + */ + len(): number; + + /** + * @param {number} index + * @returns {Vkey} + */ + get(index: number): Vkey; + + /** + * @param {Vkey} elem + */ + add(elem: Vkey): void; +} +/** + */ +declare export class Vkeywitness { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {Vkeywitness} + */ + static from_bytes(bytes: Uint8Array): Vkeywitness; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {Vkeywitness} + */ + static from_hex(hex_str: string): Vkeywitness; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {VkeywitnessJSON} + */ + to_js_value(): VkeywitnessJSON; + + /** + * @param {string} json + * @returns {Vkeywitness} + */ + static from_json(json: string): Vkeywitness; + + /** + * @param {Vkey} vkey + * @param {Ed25519Signature} signature + * @returns {Vkeywitness} + */ + static new(vkey: Vkey, signature: Ed25519Signature): Vkeywitness; + + /** + * @returns {Vkey} + */ + vkey(): Vkey; + + /** + * @returns {Ed25519Signature} + */ + signature(): Ed25519Signature; +} +/** + */ +declare export class Vkeywitnesses { + free(): void; + + /** + * @returns {Vkeywitnesses} + */ + static new(): Vkeywitnesses; + + /** + * @returns {number} + */ + len(): number; + + /** + * @param {number} index + * @returns {Vkeywitness} + */ + get(index: number): Vkeywitness; + + /** + * @param {Vkeywitness} elem + */ + add(elem: Vkeywitness): void; +} +/** + */ +declare export class Withdrawals { + free(): void; + + /** + * @returns {Uint8Array} + */ + to_bytes(): Uint8Array; + + /** + * @param {Uint8Array} bytes + * @returns {Withdrawals} + */ + static from_bytes(bytes: Uint8Array): Withdrawals; + + /** + * @returns {string} + */ + to_hex(): string; + + /** + * @param {string} hex_str + * @returns {Withdrawals} + */ + static from_hex(hex_str: string): Withdrawals; + + /** + * @returns {string} + */ + to_json(): string; + + /** + * @returns {WithdrawalsJSON} + */ + to_js_value(): WithdrawalsJSON; + + /** + * @param {string} json + * @returns {Withdrawals} + */ + static from_json(json: string): Withdrawals; + + /** + * @returns {Withdrawals} + */ + static new(): Withdrawals; + + /** + * @returns {number} + */ + len(): number; + + /** + * @param {RewardAddress} key + * @param {BigNum} value + * @returns {BigNum | void} + */ + insert(key: RewardAddress, value: BigNum): BigNum | void; + + /** + * @param {RewardAddress} key + * @returns {BigNum | void} + */ + get(key: RewardAddress): BigNum | void; + + /** + * @returns {RewardAddresses} + */ + keys(): RewardAddresses; +} +export type AddressJSON = string; +export type AssetNameJSON = string; +export type AssetNamesJSON = string[]; +export interface AssetsJSON { + [k: string]: string; +} +export interface AuxiliaryDataJSON { + metadata?: { + [k: string]: string, + ... + } | null; + native_scripts?: NativeScriptsJSON | null; + plutus_scripts?: PlutusScriptsJSON | null; + prefer_alonzo_format: boolean; +} +export type AuxiliaryDataHashJSON = string; +export interface AuxiliaryDataSetJSON { + [k: string]: AuxiliaryDataJSON; +} +export type BigIntJSON = string; +export type BigNumJSON = string; +export interface BlockJSON { + auxiliary_data_set: { + [k: string]: AuxiliaryDataJSON, + ... + }; + header: HeaderJSON; + invalid_transactions: number[]; + transaction_bodies: TransactionBodiesJSON; + transaction_witness_sets: TransactionWitnessSetsJSON; +} +export type BlockHashJSON = string; +export interface BootstrapWitnessJSON { + attributes: number[]; + chain_code: number[]; + signature: string; + vkey: VkeyJSON; +} +export type BootstrapWitnessesJSON = BootstrapWitnessJSON[]; +export type CertificateJSON = CertificateEnumJSON; +export type CertificateEnumJSON = + | { + StakeRegistrationJSON: StakeRegistration, + ... + } + | { + StakeDeregistrationJSON: StakeDeregistration, + ... + } + | { + StakeDelegationJSON: StakeDelegation, + ... + } + | { + PoolRegistrationJSON: PoolRegistration, + ... + } + | { + PoolRetirementJSON: PoolRetirement, + ... + } + | { + GenesisKeyDelegationJSON: GenesisKeyDelegation, + ... + } + | { + MoveInstantaneousRewardsCertJSON: MoveInstantaneousRewardsCert, + ... + }; +export type CertificatesJSON = CertificateJSON[]; +export type CostModelJSON = string[]; +export interface CostmdlsJSON { + [k: string]: CostModelJSON; +} +export type DNSRecordAorAAAAJSON = string; +export type DNSRecordSRVJSON = string; +export type DataHashJSON = string; +export type DataOptionJSON = + | { + DataHashJSON: string, + ... + } + | { + Data: string, + ... + }; +export type Ed25519KeyHashJSON = string; +export type Ed25519KeyHashesJSON = string[]; +export type Ed25519SignatureJSON = string; +export interface ExUnitPricesJSON { + mem_price: UnitIntervalJSON; + step_price: UnitIntervalJSON; +} +export interface ExUnitsJSON { + mem: string; + steps: string; +} +export interface GeneralTransactionMetadataJSON { + [k: string]: string; +} +export type GenesisDelegateHashJSON = string; +export type GenesisHashJSON = string; +export type GenesisHashesJSON = string[]; +export interface GenesisKeyDelegationJSON { + genesis_delegate_hash: string; + genesishash: string; + vrf_keyhash: string; +} +export interface HeaderJSON { + body_signature: string; + header_body: HeaderBodyJSON; +} +export interface HeaderBodyJSON { + block_body_hash: string; + block_body_size: number; + block_number: number; + issuer_vkey: VkeyJSON; + leader_cert: HeaderLeaderCertEnumJSON; + operational_cert: OperationalCertJSON; + prev_hash?: string | null; + protocol_version: ProtocolVersionJSON; + slot: string; + vrf_vkey: string; +} +export type HeaderLeaderCertEnumJSON = + | { + NonceAndLeader: [VRFCertJSON, VRFCert], + ... + } + | { + VrfResult: VRFCertJSON, + ... + }; +export type IntJSON = string; +export type Ipv4JSON = [number, number, number, number]; +export type Ipv6JSON = [ + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number +]; +export type KESVKeyJSON = string; +export type LanguageJSON = LanguageKindJSON; +export type LanguageKindJSON = "PlutusV1" | "PlutusV2" | "PlutusV3"; +export type LanguagesJSON = LanguageJSON[]; +export type MIREnumJSON = + | { + ToOtherPot: string, + ... + } + | { + ToStakeCredentials: { + [k: string]: ProtocolParamUpdateJSON, + ... + }, + ... + }; +export type MIRPotJSON = "Reserves" | "Treasury"; +export interface MIRToStakeCredentialsJSON { + [k: string]: ProtocolParamUpdateJSON; +} +export interface MintJSON { + [k: string]: MintAssetsJSON; +} +export interface MintAssetsJSON { + [k: string]: string; +} +export interface MoveInstantaneousRewardJSON { + pot: MIRPotJSON; + variant: MIREnumJSON; +} +export interface MoveInstantaneousRewardsCertJSON { + move_instantaneous_reward: MoveInstantaneousRewardJSON; +} +export interface MultiAssetJSON { + [k: string]: AssetsJSON; +} +export interface MultiHostNameJSON { + dns_name: DNSRecordSRVJSON; +} +export type NativeScriptJSON = NativeScript1JSON; +export type NativeScript1JSON = + | { + ScriptPubkeyJSON: ScriptPubkey, + ... + } + | { + ScriptAllJSON: ScriptAll, + ... + } + | { + ScriptAnyJSON: ScriptAny, + ... + } + | { + ScriptNOfKJSON: ScriptNOfK, + ... + } + | { + TimelockStartJSON: TimelockStart, + ... + } + | { + TimelockExpiryJSON: TimelockExpiry, + ... + }; +export type NativeScriptsJSON = NativeScriptJSON[]; +export type NetworkIdJSON = NetworkIdKindJSON; +export type NetworkIdKindJSON = "Testnet" | "Mainnet"; +export interface NonceJSON { + hash?: + | [ + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number + ] + | null; +} +export interface OperationalCertJSON { + hot_vkey: string; + kes_period: number; + sequence_number: number; + sigma: string; +} +export type PlutusScriptJSON = string; +export type PlutusScriptsJSON = string[]; +export interface PoolMetadataJSON { + pool_metadata_hash: string; + url: URLJSON; +} +export type PoolMetadataHashJSON = string; +export interface PoolParamsJSON { + cost: string; + margin: UnitIntervalJSON; + operator: string; + pledge: string; + pool_metadata?: PoolMetadataJSON | null; + pool_owners: Ed25519KeyHashesJSON; + relays: RelaysJSON; + reward_account: string; + vrf_keyhash: string; +} +export interface PoolRegistrationJSON { + pool_params: PoolParamsJSON; +} +export interface PoolRetirementJSON { + epoch: number; + pool_keyhash: string; +} +export interface ProposedProtocolParameterUpdatesJSON { + [k: string]: ProtocolParamUpdateJSON; +} +export interface ProtocolParamUpdateJSON { + ada_per_utxo_byte?: string | null; + collateral_percentage?: number | null; + cost_models?: CostmdlsJSON | null; + d?: UnitIntervalJSON | null; + execution_costs?: ExUnitPricesJSON | null; + expansion_rate?: UnitIntervalJSON | null; + extra_entropy?: NonceJSON | null; + key_deposit?: string | null; + max_block_body_size?: number | null; + max_block_ex_units?: ExUnitsJSON | null; + max_block_header_size?: number | null; + max_collateral_inputs?: number | null; + max_epoch?: number | null; + max_tx_ex_units?: ExUnitsJSON | null; + max_tx_size?: number | null; + max_value_size?: number | null; + min_pool_cost?: string | null; + minfee_a?: string | null; + minfee_b?: string | null; + n_opt?: number | null; + pool_deposit?: string | null; + pool_pledge_influence?: UnitIntervalJSON | null; + protocol_version?: ProtocolVersionJSON | null; + treasury_growth_rate?: UnitIntervalJSON | null; +} +export interface ProtocolVersionJSON { + major: number; + minor: number; +} +export type PublicKeyJSON = string; +export interface RedeemerJSON { + data: string; + ex_units: ExUnitsJSON; + index: string; + tag: RedeemerTagJSON; +} +export type RedeemerTagJSON = RedeemerTagKindJSON; +export type RedeemerTagKindJSON = "Spend" | "MintJSON" | "Cert" | "Reward"; +export type RedeemersJSON = RedeemerJSON[]; +export type RelayJSON = RelayEnumJSON; +export type RelayEnumJSON = + | { + SingleHostAddrJSON: SingleHostAddr, + ... + } + | { + SingleHostNameJSON: SingleHostName, + ... + } + | { + MultiHostNameJSON: MultiHostName, + ... + }; +export type RelaysJSON = RelayJSON[]; +export type RewardAddressJSON = string; +export type RewardAddressesJSON = string[]; +export interface ScriptAllJSON { + native_scripts: NativeScriptsJSON; +} +export interface ScriptAnyJSON { + native_scripts: NativeScriptsJSON; +} +export type ScriptDataHashJSON = string; +export type ScriptHashJSON = string; +export type ScriptHashesJSON = string[]; +export interface ScriptNOfKJSON { + n: number; + native_scripts: NativeScriptsJSON; +} +export interface ScriptPubkeyJSON { + addr_keyhash: string; +} +export type ScriptRefJSON = ScriptJSON; +export type ScriptJSON = + | { + NativeScriptJSON: NativeScript, + ... + } + | { + PlutusScriptV1: string, + ... + } + | { + PlutusScriptV2: string, + ... + } + | { + PlutusScriptV3: string, + ... + }; +export interface SingleHostAddrJSON { + ipv4?: Ipv4JSON | null; + ipv6?: Ipv6JSON | null; + port?: number | null; +} +export interface SingleHostNameJSON { + dns_name: DNSRecordAorAAAAJSON; + port?: number | null; +} +export type StakeCredTypeJSON = + | { + Key: string, + ... + } + | { + ScriptJSON: string, + ... + }; +export type StakeCredentialJSON = StakeCredTypeJSON; +export type StakeCredentialsJSON = StakeCredTypeJSON[]; +export interface StakeDelegationJSON { + pool_keyhash: string; + stake_credential: StakeCredTypeJSON; +} +export interface StakeDeregistrationJSON { + stake_credential: StakeCredTypeJSON; +} +export interface StakeRegistrationJSON { + stake_credential: StakeCredTypeJSON; +} +export interface TimelockExpiryJSON { + slot: string; +} +export interface TimelockStartJSON { + slot: string; +} +export interface TransactionJSON { + auxiliary_data?: AuxiliaryDataJSON | null; + body: TransactionBodyJSON; + is_valid: boolean; + witness_set: TransactionWitnessSetJSON; +} +export type TransactionBodiesJSON = TransactionBodyJSON[]; +export interface TransactionBodyJSON { + auxiliary_data_hash?: string | null; + certs?: CertificatesJSON | null; + collateral?: TransactionInputsJSON | null; + collateral_return?: TransactionOutputJSON | null; + fee: string; + inputs: TransactionInputsJSON; + mint?: MintJSON | null; + network_id?: NetworkIdJSON | null; + outputs: TransactionOutputsJSON; + reference_inputs?: TransactionInputsJSON | null; + required_signers?: Ed25519KeyHashesJSON | null; + script_data_hash?: string | null; + total_collateral?: string | null; + ttl?: string | null; + update?: UpdateJSON | null; + validity_start_interval?: string | null; + withdrawals?: { + [k: string]: ProtocolParamUpdateJSON, + ... + } | null; +} +export type TransactionHashJSON = string; +export interface TransactionInputJSON { + index: number; + transaction_id: string; +} +export type TransactionInputsJSON = TransactionInputJSON[]; +export type TransactionMetadatumJSON = string; +export interface TransactionOutputJSON { + address: string; + amount: ValueJSON; + plutus_data?: DataOptionJSON | null; + script_ref?: ScriptJSON | null; +} +export type TransactionOutputsJSON = TransactionOutputJSON[]; +export interface TransactionUnspentOutputJSON { + input: TransactionInputJSON; + output: TransactionOutputJSON; +} +export type TransactionUnspentOutputsJSON = TransactionUnspentOutputJSON[]; +export interface TransactionWitnessSetJSON { + bootstraps?: BootstrapWitnessesJSON | null; + native_scripts?: NativeScriptsJSON | null; + plutus_data?: PlutusList | null; + plutus_scripts?: PlutusScriptsJSON | null; + redeemers?: RedeemersJSON | null; + vkeys?: VkeywitnessesJSON | null; +} +export type TransactionWitnessSetsJSON = TransactionWitnessSetJSON[]; +export type URLJSON = string; +export interface UnitIntervalJSON { + denominator: string; + numerator: string; +} +export interface UpdateJSON { + epoch: number; + proposed_protocol_parameter_updates: { + [k: string]: ProtocolParamUpdateJSON, + ... + }; +} +export interface VRFCertJSON { + output: number[]; + proof: number[]; +} +export type VRFKeyHashJSON = string; +export type VRFVKeyJSON = string; +export interface ValueJSON { + coin: string; + multiasset?: MultiAssetJSON | null; +} +export type VkeyJSON = string; +export interface VkeywitnessJSON { + signature: string; + vkey: VkeyJSON; +} +export type VkeywitnessesJSON = VkeywitnessJSON[]; +export interface WithdrawalsJSON { + [k: string]: ProtocolParamUpdateJSON; +} From 5eb27b35a0ecef139af6eb69423686093a00de3b Mon Sep 17 00:00:00 2001 From: tony Date: Mon, 30 Jun 2025 20:25:56 +0700 Subject: [PATCH 4/7] fix typo --- rust/src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/rust/src/lib.rs b/rust/src/lib.rs index cf67944..764f16e 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -1089,6 +1089,7 @@ pub enum DRepKind { AlwaysNoConfidence, } +#[wasm_bindgen] #[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize, JsonSchema)] pub struct DRep(DRepEnum); From 44e13dba77e561af2e066c2ea1a5c9baf55ec65c Mon Sep 17 00:00:00 2001 From: tony Date: Mon, 30 Jun 2025 22:16:01 +0700 Subject: [PATCH 5/7] fix bug --- rust/src/serialization.rs | 9 ++++----- rust/src/tx_builder.rs | 7 +++++++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/rust/src/serialization.rs b/rust/src/serialization.rs index e5ed862..5dc84f2 100644 --- a/rust/src/serialization.rs +++ b/rust/src/serialization.rs @@ -1730,25 +1730,24 @@ impl cbor_event::se::Serialize for DRep { &self, serializer: &'se mut Serializer, ) -> cbor_event::Result<&'se mut Serializer> { - serializer.write_array(cbor_event::Len::Len(2))?; match &self.0 { DRepEnum::KeyHash(key_hash) => { serializer.write_array(cbor_event::Len::Len(2))?; serializer.write_unsigned_integer(0u64)?; - key_hash.serialize(serializer); + key_hash.serialize(serializer)?; } DRepEnum::ScriptHash(script_hash) => { serializer.write_array(cbor_event::Len::Len(2))?; serializer.write_unsigned_integer(1u64)?; - script_hash.serialize(serializer); + script_hash.serialize(serializer)?; } DRepEnum::AlwaysAbstain => { serializer.write_array(cbor_event::Len::Len(1))?; - serializer.write_unsigned_integer(2u64); + serializer.write_unsigned_integer(2u64)?; } DRepEnum::AlwaysNoConfidence => { serializer.write_array(cbor_event::Len::Len(1))?; - serializer.write_unsigned_integer(3u64); + serializer.write_unsigned_integer(3u64)?; } } Ok(serializer) diff --git a/rust/src/tx_builder.rs b/rust/src/tx_builder.rs index 1dab18b..4f46ec3 100644 --- a/rust/src/tx_builder.rs +++ b/rust/src/tx_builder.rs @@ -2049,6 +2049,13 @@ mod tests { index | 0x80_00_00_00 } + #[test] + fn round_trip_drep() { + let drep= DRep::new_always_abstain(); + let drep_hex = drep.to_hex(); + assert_eq!(drep_hex, "8102"); + } + #[test] fn check_fake_private_key() { let fpk = fake_private_key(); From 5793bfc3d2fb951e0ea7591dd53624e517b3a2e3 Mon Sep 17 00:00:00 2001 From: tony Date: Mon, 30 Jun 2025 22:32:16 +0700 Subject: [PATCH 6/7] add more test --- rust/src/tx_builder.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/rust/src/tx_builder.rs b/rust/src/tx_builder.rs index 4f46ec3..895b0b7 100644 --- a/rust/src/tx_builder.rs +++ b/rust/src/tx_builder.rs @@ -2056,6 +2056,25 @@ mod tests { assert_eq!(drep_hex, "8102"); } + #[test] + fn round_trip_vote_delegation() { + let key_hash = Ed25519KeyHash::from_hex("508f5c55f14d9ed00070eb9fb2f65b238b389af5bb881d5cbe1829e2").unwrap(); + let drep = &DRep::new_key_hash(&key_hash); + + let owner_key_hash = Ed25519KeyHash::from_hex("75ee8ab1dc2ccf6ad5929cd24b10e7be81a64662ae958a409e9bf5e3").unwrap(); + let stake_credential = StakeCredential::from_keyhash(&owner_key_hash); + + let vote_delegation = VoteDelegation::new( + &stake_credential, + drep, + ); + + let cert = Certificate::new_vote_delegation(&vote_delegation); + + let cert_hex = cert.to_hex(); + assert_eq!(cert_hex, "83098200581c75ee8ab1dc2ccf6ad5929cd24b10e7be81a64662ae958a409e9bf5e38200581c508f5c55f14d9ed00070eb9fb2f65b238b389af5bb881d5cbe1829e2"); + } + #[test] fn check_fake_private_key() { let fpk = fake_private_key(); From ca4eb146fe71f3cfe80815539b7de533a4903ac3 Mon Sep 17 00:00:00 2001 From: tony Date: Tue, 1 Jul 2025 11:01:10 +0700 Subject: [PATCH 7/7] Fix Review --- rust/src/lib.rs | 18 ++++++++++++------ rust/src/serialization.rs | 3 +-- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/rust/src/lib.rs b/rust/src/lib.rs index 764f16e..8050b46 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -1072,6 +1072,9 @@ pub struct StakeRegistrationAndDelegation; #[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize, JsonSchema)] pub struct StakeVoteRegistrationAndDelegation; +#[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize, JsonSchema)] +pub struct VoteRegistrationAndDelegation; + #[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize, JsonSchema)] pub enum DRepEnum { KeyHash(Ed25519KeyHash), @@ -1170,10 +1173,6 @@ impl VoteDelegation { } } - -#[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize, JsonSchema)] -pub struct VoteRegistrationAndDelegation; - #[wasm_bindgen] #[derive( Clone, Debug, Eq, Ord, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize, JsonSchema, @@ -1238,8 +1237,15 @@ impl Certificate { CertificateKind::MoveInstantaneousRewardsCert } CertificateEnum::VoteDelegation(_) => CertificateKind::VoteDelegation, - // For all other variants, return a default or placeholder value, or handle as needed. - _ => panic!("CertificateKind not defined for this certificate variant"), + CertificateEnum::CommitteeHotAuth(_) => CertificateKind::CommitteeHotAuth, + CertificateEnum::CommitteeColdResign(_) => CertificateKind::CommitteeColdResign, + CertificateEnum::DRepDeregistration(_) => CertificateKind::DRepDeregistration, + CertificateEnum::DRepRegistration(_) => CertificateKind::DRepRegistration, + CertificateEnum::DRepUpdate(_) => CertificateKind::DRepUpdate, + CertificateEnum::StakeAndVoteDelegation(_) => CertificateKind::StakeAndVoteDelegation, + CertificateEnum::StakeRegistrationAndDelegation(_) => CertificateKind::StakeRegistrationAndDelegation, + CertificateEnum::StakeVoteRegistrationAndDelegation(_) => CertificateKind::StakeVoteRegistrationAndDelegation, + CertificateEnum::VoteRegistrationAndDelegation(_) => CertificateKind::VoteRegistrationAndDelegation, } } diff --git a/rust/src/serialization.rs b/rust/src/serialization.rs index 5dc84f2..2804dc1 100644 --- a/rust/src/serialization.rs +++ b/rust/src/serialization.rs @@ -3,7 +3,6 @@ use crate::utils::*; use address::*; use crypto::*; use error::*; -use core::panic; use std::io::{Seek, SeekFrom}; // This file was code-generated using an experimental CDDL to rust tool: @@ -1913,7 +1912,7 @@ impl SerializeEmbeddedGroup for VoteDelegation { &self, serializer: &'se mut Serializer, ) -> cbor_event::Result<&'se mut Serializer> { - serializer.write_unsigned_integer(15u64)?; + serializer.write_unsigned_integer(9u64)?; self.stake_credential.serialize(serializer)?; self.drep.serialize(serializer)?; Ok(serializer)