From a345872d133c26e41d36b68c6f51e66473eeba5c Mon Sep 17 00:00:00 2001 From: lisicky Date: Wed, 5 Jul 2023 13:42:04 +0400 Subject: [PATCH 1/4] update binaryen version --- binaryen | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/binaryen b/binaryen index 547e2be1..1fb1a2e2 160000 --- a/binaryen +++ b/binaryen @@ -1 +1 @@ -Subproject commit 547e2be14d1f8f9b21905baee87b1946045b0fe7 +Subproject commit 1fb1a2e2970472e9e93f9de94c8a2c674d0a0581 From c502fd0e634dce5b3d536aa7d9ffd342b62c2878 Mon Sep 17 00:00:00 2001 From: lisicky Date: Thu, 6 Jul 2023 01:19:15 +0400 Subject: [PATCH 2/4] update bingen version --- rust/Cargo.toml | 2 +- rust/json-gen/Cargo.lock | 57 ++++++++++++++++++++++++++-------------- 2 files changed, 38 insertions(+), 21 deletions(-) diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 998ae790..fd6ad2c8 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -45,7 +45,7 @@ getrandom = "0.2.3" # wasm [target.'cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))'.dependencies] serde-wasm-bindgen = "0.4.5" -wasm-bindgen = "=0.2.83" +wasm-bindgen = "=0.2.87" rand_os = { version = "0.1", features = ["wasm-bindgen"] } js-sys = "0.3.51" getrandom = { version = "0.2.3", features = ["js"] } diff --git a/rust/json-gen/Cargo.lock b/rust/json-gen/Cargo.lock index 5deadb5e..42ff9e72 100644 --- a/rust/json-gen/Cargo.lock +++ b/rust/json-gen/Cargo.lock @@ -290,18 +290,18 @@ checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" [[package]] name = "proc-macro2" -version = "1.0.36" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029" +checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" dependencies = [ - "unicode-xid", + "unicode-ident", ] [[package]] name = "quote" -version = "1.0.14" +version = "1.0.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47aa80447ce4daf1717500037052af176af5d38cc3e571d9ec1c7353fc10c87d" +checksum = "573015e8ab27661678357f27dc26460738fd2b6c86e46f386fde94cb5d913105" dependencies = [ "proc-macro2", ] @@ -412,7 +412,7 @@ dependencies = [ "proc-macro2", "quote", "serde_derive_internals", - "syn", + "syn 1.0.85", ] [[package]] @@ -443,7 +443,7 @@ checksum = "ed201699328568d8d08208fdd080e3ff594e6c422e438b6705905da01005d537" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.85", ] [[package]] @@ -454,7 +454,7 @@ checksum = "1dbab34ca63057a1f15280bdf3c39f2b1eb1b54c17e98360e511637aef7418c6" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.85", ] [[package]] @@ -492,12 +492,29 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "syn" +version = "2.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59fb7d6d8281a51045d62b8eb3a7d1ce347b76f312af50cd3dc0af39c87c1737" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "typenum" version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" +[[package]] +name = "unicode-ident" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22049a19f4a68748a168c0fc439f9516686aa045927ff767eca0a85101fb6e73" + [[package]] name = "unicode-xid" version = "0.2.2" @@ -518,9 +535,9 @@ checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" [[package]] name = "wasm-bindgen" -version = "0.2.83" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -528,24 +545,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.83" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn", + "syn 2.0.23", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.83" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -553,22 +570,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.83" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.23", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.83" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] name = "winapi" From 75f4a3c6cd3eebaea05bfdd649de2958b6e570e6 Mon Sep 17 00:00:00 2001 From: lisicky Date: Thu, 6 Jul 2023 01:19:59 +0400 Subject: [PATCH 3/4] add asmjs buffer check fix script --- package.json | 2 +- scripts/fix-buffer-ref.js | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 scripts/fix-buffer-ref.js diff --git a/package.json b/package.json index 934d2039..c132d556 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "rust:build-web": "(rimraf ./rust/pkg && cd rust; wasm-pack build --target=web; cd ..; npm run js:ts-json-gen; cd rust; wasm-pack pack) && npm run js:flowgen", "rust:build-asm": "(rimraf ./rust/pkg && cd rust; wasm-pack build --target=browser; cd ..; npm run js:ts-json-gen; cd rust; wasm-pack pack) && npm run asm:build && npm run js:flowgen", "rust:publish": "cd rust && cargo publish && cd ../", - "asm:build": "./binaryen/bin/wasm2js ./rust/pkg/cardano_serialization_lib_bg.wasm --output ./rust/pkg/cardano_serialization_lib.asm.js && node ./scripts/wasm-to-asm", + "asm:build": "./binaryen/bin/wasm2js ./rust/pkg/cardano_serialization_lib_bg.wasm --output ./rust/pkg/cardano_serialization_lib.asm.js && node ./scripts/wasm-to-asm && node ./scripts/fix-buffer-ref.js", "rust:check-warnings": "(cd rust; RUSTFLAGS=\"-D warnings\" cargo +stable build)", "rust:test": "(cd rust; cargo test)", "js:flowgen": "flowgen ./rust/pkg/cardano_serialization_lib.d.ts -o ./rust/pkg/cardano_serialization_lib.js.flow --add-flow-header", diff --git a/scripts/fix-buffer-ref.js b/scripts/fix-buffer-ref.js new file mode 100644 index 00000000..292138a1 --- /dev/null +++ b/scripts/fix-buffer-ref.js @@ -0,0 +1,21 @@ +const fs = require('fs'); + +const inputFile = fs.readFileSync('./rust/pkg/cardano_serialization_lib_bg.js', 'utf8').split(/\r?\n/); + +const regex = /(\s*if \(cached[A-Za-z0-9]+Memory[0-9]* === null ||) (cached[A-Za-z0-9]+Memory[0-9]*)\.byteLength === 0\) {/; +const replacer = '$1 $2.buffer !== wasm.memory.buffer) {'; + +for (let i = 0; i < inputFile.length; ++i) { + let line = inputFile[i]; + inputFile[i] = line.replace(regex, replacer); +} + +fs.writeFile( + './rust/pkg/cardano_serialization_lib_bg.js', + inputFile.join('\n'), + (err) => { + if (err != null) { + console.log(`err writing file: ${err}`) + } + } +); From 820c9f22c019ff49d80f2f057f7554dd1046e820 Mon Sep 17 00:00:00 2001 From: lisicky Date: Thu, 6 Jul 2023 01:20:18 +0400 Subject: [PATCH 4/4] update flowgen version --- package-lock.json | 137 +++++++++---- package.json | 2 +- rust/pkg/cardano_serialization_lib.js.flow | 215 ++++++++++----------- 3 files changed, 212 insertions(+), 142 deletions(-) diff --git a/package-lock.json b/package-lock.json index c257dec5..1f3789ae 100644 --- a/package-lock.json +++ b/package-lock.json @@ -249,9 +249,9 @@ "dev": true }, "commander": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-5.1.0.tgz", - "integrity": "sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz", + "integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==", "dev": true }, "compare-versions": { @@ -385,19 +385,58 @@ } }, "flowgen": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/flowgen/-/flowgen-1.11.0.tgz", - "integrity": "sha512-WpoBjzcZadnAw5FatlUbvFWUWXkI2/LjrwTl5fl3MVDh+KdvYgFzgRXDDKH/O2uUlwjfpveiJJJx8TwL7Se84A==", + "version": "1.21.0", + "resolved": "https://registry.npmjs.org/flowgen/-/flowgen-1.21.0.tgz", + "integrity": "sha512-pFNFFyMLRmW6njhOIm5TrbGUDTv64aujmys2KrkRE2NYD8sXwJUyicQRwU5SPRBRJnFSD/FNlnHo2NnHI5eJSw==", "dev": true, "requires": { - "@babel/code-frame": "^7.8.3", - "@babel/highlight": "^7.9.0", - "commander": "^5.1.0", - "lodash": "^4.17.15", - "prettier": "^2.0.5", + "@babel/code-frame": "^7.16.7", + "@babel/highlight": "^7.16.7", + "commander": "^6.1.0", + "lodash": "^4.17.20", + "prettier": "^2.5.1", "shelljs": "^0.8.4", - "typescript": "^3.4", + "typescript": "~4.4.4", "typescript-compiler": "^1.4.1-2" + }, + "dependencies": { + "@babel/code-frame": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.22.5.tgz", + "integrity": "sha512-Xmwn266vad+6DAqEB2A6V/CcZVp62BbwVmcOJc2RPuwih1kw02TjQvWVWlcKGbBPd+8/0V5DEkOcizRGYsspYQ==", + "dev": true, + "requires": { + "@babel/highlight": "^7.22.5" + } + }, + "@babel/helper-validator-identifier": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.5.tgz", + "integrity": "sha512-aJXu+6lErq8ltp+JhkJUfk1MTGyuA4v7f3pA+BJ5HLfNC6nAQ0Cpi9uOquUj8Hehg0aUiHzWQbOVJGao6ztBAQ==", + "dev": true + }, + "@babel/highlight": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.5.tgz", + "integrity": "sha512-BSKlD1hgnedS5XRnGOljZawtag7H1yPfQp0tdNJCHoH6AZ+Pcm9VvkrK59/Yy593Ypg0zMxH2BxD1VPYUQ7UIw==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.22.5", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + } } }, "fs.realpath": { @@ -406,6 +445,12 @@ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, "get-stdin": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-8.0.0.tgz", @@ -435,6 +480,15 @@ "@types/glob": "*" } }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1" + } + }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", @@ -497,6 +551,15 @@ "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", "dev": true }, + "is-core-module": { + "version": "2.12.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.1.tgz", + "integrity": "sha512-Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg==", + "dev": true, + "requires": { + "has": "^1.0.3" + } + }, "is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", @@ -598,9 +661,9 @@ "dev": true }, "lodash": { - "version": "4.17.19", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz", - "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==", + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "dev": true }, "lru-queue": { @@ -738,9 +801,9 @@ "dev": true }, "path-parse": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", - "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", "dev": true }, "path-type": { @@ -804,27 +867,29 @@ } }, "prettier": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.5.tgz", - "integrity": "sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg==", + "version": "2.8.8", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", + "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", "dev": true }, "rechoir": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", - "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", + "integrity": "sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==", "dev": true, "requires": { "resolve": "^1.1.6" } }, "resolve": { - "version": "1.17.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", - "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", + "version": "1.22.2", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", + "integrity": "sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g==", "dev": true, "requires": { - "path-parse": "^1.0.6" + "is-core-module": "^2.11.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" } }, "resolve-from": { @@ -855,9 +920,9 @@ "dev": true }, "shelljs": { - "version": "0.8.4", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.4.tgz", - "integrity": "sha512-7gk3UZ9kOfPLIAbslLzyWeGiEqx9e3rxwZM0KE6EL8GlGwjym9Mrlx5/p33bWTu9YG6vcS4MBxYZDHYr5lr8BQ==", + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.5.tgz", + "integrity": "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==", "dev": true, "requires": { "glob": "^7.0.0", @@ -880,6 +945,12 @@ "has-flag": "^3.0.0" } }, + "supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true + }, "thenify": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz", @@ -915,15 +986,15 @@ "dev": true }, "typescript": { - "version": "3.9.7", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.7.tgz", - "integrity": "sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw==", + "version": "4.4.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.4.tgz", + "integrity": "sha512-DqGhF5IKoBl8WNf8C1gu8q0xZSInh9j1kJJMqT3a94w1JzVaBU4EXOSMrz9yDqMT0xt3selp83fuFMQ0uzv6qA==", "dev": true }, "typescript-compiler": { "version": "1.4.1-2", "resolved": "https://registry.npmjs.org/typescript-compiler/-/typescript-compiler-1.4.1-2.tgz", - "integrity": "sha1-uk99si2RU0oZKdkACdzhYety/T8=", + "integrity": "sha512-EMopKmoAEJqA4XXRFGOb7eSBhmQMbBahW6P1Koayeatp0b4AW2q/bBqYWkpG7QVQc9HGQUiS4trx2ZHcnAaZUg==", "dev": true }, "which-pm-runs": { diff --git a/package.json b/package.json index c132d556..02f98417 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "url": "git+https://github.com/Emurgo/cardano-serialization-lib.git" }, "devDependencies": { - "flowgen": "1.11.0", + "flowgen": "1.21.0", "husky": "4.2.5", "json-schema-to-typescript": "^10.1.5", "rimraf": "3.0.2" diff --git a/rust/pkg/cardano_serialization_lib.js.flow b/rust/pkg/cardano_serialization_lib.js.flow index 02e51771..ac2ed81e 100644 --- a/rust/pkg/cardano_serialization_lib.js.flow +++ b/rust/pkg/cardano_serialization_lib.js.flow @@ -1,93 +1,10 @@ /** * Flowtype definitions for cardano_serialization_lib * Generated by Flowgen from a Typescript Definition - * Flowgen v1.11.0 + * Flowgen v1.21.0 * @flow */ -/** - * @param {string} json - * @param {number} schema - * @returns {PlutusData} - */ -declare export function encode_json_str_to_plutus_datum( - json: string, - schema: number -): PlutusData; - -/** - * @param {PlutusData} datum - * @param {number} schema - * @returns {string} - */ -declare export function decode_plutus_datum_to_json_str( - datum: PlutusData, - schema: number -): string; - -/** - * @param {Uint8Array} bytes - * @returns {TransactionMetadatum} - */ -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 {Transaction} tx - * @param {LinearFee} linear_fee - * @returns {BigNum} - */ -declare export function min_fee(tx: Transaction, linear_fee: LinearFee): BigNum; - -/** - * @param {ExUnits} ex_units - * @param {ExUnitPrices} ex_unit_prices - * @returns {BigNum} - */ -declare export function calculate_ex_units_ceil_cost( - ex_units: ExUnits, - ex_unit_prices: ExUnitPrices -): BigNum; - -/** - * @param {Transaction} tx - * @param {ExUnitPrices} ex_unit_prices - * @returns {BigNum} - */ -declare export function min_script_fee( - tx: Transaction, - ex_unit_prices: ExUnitPrices -): BigNum; - /** * @param {string} password * @param {string} salt @@ -262,6 +179,89 @@ declare export function encode_json_str_to_native_script( schema: number ): NativeScript; +/** + * @param {string} json + * @param {number} schema + * @returns {PlutusData} + */ +declare export function encode_json_str_to_plutus_datum( + json: string, + schema: number +): PlutusData; + +/** + * @param {PlutusData} datum + * @param {number} schema + * @returns {string} + */ +declare export function decode_plutus_datum_to_json_str( + datum: PlutusData, + schema: number +): string; + +/** + * @param {Uint8Array} bytes + * @returns {TransactionMetadatum} + */ +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 {Transaction} tx + * @param {LinearFee} linear_fee + * @returns {BigNum} + */ +declare export function min_fee(tx: Transaction, linear_fee: LinearFee): BigNum; + +/** + * @param {ExUnits} ex_units + * @param {ExUnitPrices} ex_unit_prices + * @returns {BigNum} + */ +declare export function calculate_ex_units_ceil_cost( + ex_units: ExUnits, + ex_unit_prices: ExUnitPrices +): BigNum; + +/** + * @param {Transaction} tx + * @param {ExUnitPrices} ex_unit_prices + * @returns {BigNum} + */ +declare export function min_script_fee( + tx: Transaction, + ex_unit_prices: ExUnitPrices +): BigNum; + /** */ @@ -333,6 +333,15 @@ declare export var NetworkIdKind: {| +Mainnet: 1, // 1 |}; +/** + * Used to choosed the schema for a script JSON string + */ + +declare export var ScriptSchema: {| + +Wallet: 0, // 0 + +Node: 1, // 1 +|}; + /** */ @@ -370,8 +379,8 @@ declare export var RedeemerTagKind: {| * All methods here have the following restrictions due to limitations on dependencies: * * JSON numbers above u64::MAX (positive) or below i64::MIN (negative) will throw errors * * Hex strings for bytes don't accept odd-length (half-byte) strings. - * cardano-cli seems to support these however but it seems to be different than just 0-padding - * on either side when tested so proceed with caution + * cardano-cli seems to support these however but it seems to be different than just 0-padding + * on either side when tested so proceed with caution */ declare export var PlutusDatumSchema: {| @@ -399,6 +408,14 @@ declare export var MetadataJsonSchema: {| +DetailedSchema: 2, // 2 |}; +/** + */ + +declare export var CborContainerType: {| + +Array: 0, // 0 + +Map: 1, // 1 +|}; + /** */ @@ -417,23 +434,6 @@ declare export var StakeCredKind: {| +Script: 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 CborContainerType: {| - +Array: 0, // 0 - +Map: 1, // 1 -|}; - /** */ declare export class Address { @@ -4951,6 +4951,7 @@ declare export class PlutusScript { static from_hex(hex_str: string): PlutusScript; /** + * * * Creates a new Plutus script from the RAW bytes of the compiled script. * * This does NOT include any CBOR encoding around these bytes (e.g. from "cborBytes" in cardano-cli) * * If you creating this from those you should use PlutusScript::from_bytes() instead. @@ -4960,6 +4961,7 @@ declare export class PlutusScript { static new(bytes: Uint8Array): PlutusScript; /** + * * * Creates a new Plutus script from the RAW bytes of the compiled script. * * This does NOT include any CBOR encoding around these bytes (e.g. from "cborBytes" in cardano-cli) * * If you creating this from those you should use PlutusScript::from_bytes() instead. @@ -4969,6 +4971,7 @@ declare export class PlutusScript { static new_v2(bytes: Uint8Array): PlutusScript; /** + * * * Creates a new Plutus script from the RAW bytes of the compiled script. * * This does NOT include any CBOR encoding around these bytes (e.g. from "cborBytes" in cardano-cli) * * If you creating this from those you should use PlutusScript::from_bytes() instead. @@ -4979,6 +4982,7 @@ declare export class PlutusScript { static new_with_version(bytes: Uint8Array, language: Language): PlutusScript; /** + * * * The raw bytes of this compiled Plutus script. * * If you need "cborBytes" for cardano-cli use PlutusScript::to_bytes() instead. * @returns {Uint8Array} @@ -10513,7 +10517,6 @@ export interface AssetsJSON { export interface AuxiliaryDataJSON { metadata?: { [k: string]: string, - ... } | null; native_scripts?: NativeScriptsJSON | null; plutus_scripts?: PlutusScriptsJSON | null; @@ -10528,7 +10531,6 @@ export type BigNumJSON = string; export interface BlockJSON { auxiliary_data_set: { [k: string]: AuxiliaryDataJSON, - ... }; header: HeaderJSON; invalid_transactions: number[]; @@ -10669,7 +10671,6 @@ export type MIREnumJSON = | { ToStakeCredentials: { [k: string]: ProtocolParamUpdateJSON, - ... }, ... }; @@ -10940,7 +10941,6 @@ export interface TransactionBodyJSON { validity_start_interval?: string | null; withdrawals?: { [k: string]: ProtocolParamUpdateJSON, - ... } | null; } export type TransactionHashJSON = string; @@ -10980,7 +10980,6 @@ export interface UpdateJSON { epoch: number; proposed_protocol_parameter_updates: { [k: string]: ProtocolParamUpdateJSON, - ... }; } export interface VRFCertJSON {