diff --git a/Cargo.lock b/Cargo.lock index 11d57c5..a6d997f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "addr2line" @@ -44,21 +44,6 @@ version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" -[[package]] -name = "android-tzdata" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" - -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - [[package]] name = "anyhow" version = "1.0.86" @@ -149,6 +134,19 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" +[[package]] +name = "bigdecimal" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f31f3af01c5c65a07985c804d3366560e6fa7883d640a122819b14ec327482c" +dependencies = [ + "autocfg", + "libm", + "num-bigint", + "num-integer", + "num-traits", +] + [[package]] name = "bip39" version = "2.0.0" @@ -193,12 +191,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "bumpalo" -version = "3.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" - [[package]] name = "byteorder" version = "1.5.0" @@ -225,17 +217,19 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chia" -version = "0.12.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "270de4ca88b9fde1b2136823c3f131be16ba8c24effb6d77efa2f5dffd46b28c" +checksum = "074bbad06d32754e00ea5f10ac31314f18cad9254ca52ca413475a1ad4f55d75" dependencies = [ - "chia-bls 0.11.0", + "chia-bls 0.17.0", "chia-client", "chia-consensus", "chia-protocol", "chia-puzzles", + "chia-secp", + "chia-sha2", "chia-ssl", - "chia-traits 0.11.0", + "chia-traits 0.17.0", "clvm-traits", "clvm-utils", "clvmr", @@ -259,48 +253,47 @@ dependencies = [ [[package]] name = "chia-bls" -version = "0.11.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d8e74e25653f9c8b9437e26bc9e0e989ee2ba978a8634a64dab9824e413bb69" +checksum = "49bdd93d625cc003092aadadeb0bf06b2f9b49a991bd9ad4a354a5a0fe9e4dfc" dependencies = [ - "anyhow", "blst", - "chia-traits 0.11.0", - "clvmr", + "chia-sha2", + "chia-traits 0.17.0", "hex", "hkdf", - "lru", + "linked-hash-map", "sha2", "thiserror", ] [[package]] name = "chia-client" -version = "0.11.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8c759008594127494101816947c2f2e2fb843d472f8831fdc7fbfa0f3989f45" +checksum = "e76ded1f46fa4c6493791a63d385dc7889a17086151fef5ad11f649f3c686174" dependencies = [ "chia-protocol", - "chia-traits 0.11.0", + "chia-traits 0.17.0", "futures-util", "thiserror", "tokio", - "tokio-tungstenite", - "tungstenite", + "tokio-tungstenite 0.24.0", + "tungstenite 0.24.0", ] [[package]] name = "chia-consensus" -version = "0.12.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21337fe65bc27e4003c6ff987d8d50c633edbb49623b1dac799719fa06172825" +checksum = "879cf6ec26b64a90af0bcae3546b73b18fc16236fbcb236b1afca38b51c7cf2c" dependencies = [ - "chia-bls 0.11.0", + "chia-bls 0.17.0", "chia-protocol", "chia-puzzles", - "chia-traits 0.11.0", - "chia_streamable_macro 0.11.0", - "clvm-derive", + "chia-sha2", + "chia-traits 0.17.0", + "chia_streamable_macro 0.17.0", "clvm-traits", "clvm-utils", "clvmr", @@ -311,13 +304,14 @@ dependencies = [ [[package]] name = "chia-protocol" -version = "0.11.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea9eb79d3b0571924625ce8ed626a79cbfc6a0f8e5dd94e51aa44bb9fdf7ca85" +checksum = "7b25bfb8bb364959246aafa74f29e0642feeed9d439bf1bfa85fcac24eab02c9" dependencies = [ - "chia-bls 0.11.0", - "chia-traits 0.11.0", - "chia_streamable_macro 0.11.0", + "chia-bls 0.17.0", + "chia-sha2", + "chia-traits 0.17.0", + "chia_streamable_macro 0.17.0", "clvm-traits", "clvm-utils", "clvmr", @@ -326,12 +320,13 @@ dependencies = [ [[package]] name = "chia-puzzles" -version = "0.11.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b28823c4436ace210ce9065d4fbe2a9297b47d1187764d7bcba36a6487d4066" +checksum = "5ff9f6dcc5a587993a23b52307bc9b36e13778f4aba090d50c7c15a520ba148f" dependencies = [ - "chia-bls 0.11.0", + "chia-bls 0.17.0", "chia-protocol", + "chia-sha2", "clvm-traits", "clvm-utils", "clvmr", @@ -341,31 +336,29 @@ dependencies = [ [[package]] name = "chia-sdk-client" -version = "0.13.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b186a37833e847783c98910e80f3e7fcb9afbe6ddebb219d66a5475feccdc73f" +checksum = "85bc829fed5145a0285f2382ded74841940ce93645e52c22c893ddc952f35702" dependencies = [ "chia-protocol", "chia-sdk-types", "chia-ssl", - "chia-traits 0.11.0", + "chia-traits 0.17.0", "futures-util", - "hex", "native-tls", - "serde", - "serde_with", + "once_cell", "thiserror", "tokio", - "tokio-tungstenite", + "tokio-tungstenite 0.21.0", "tracing", - "tungstenite", + "tungstenite 0.21.0", ] [[package]] name = "chia-sdk-derive" -version = "0.13.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c626cb38e7557a683efacd00a0e82b0db7842fcb0267efd5d331cd8cb0f4f844" +checksum = "680c92022f963c813e50219802e0fcb44020f250378fa66d31894fb796d49ee7" dependencies = [ "convert_case", "quote", @@ -374,14 +367,16 @@ dependencies = [ [[package]] name = "chia-sdk-driver" -version = "0.13.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab3f470549655030a704d5b9cbf620acc172a3eaeb8fb315539796ffb29b4378" +checksum = "e2fc38b2be560752cd7ce5f025a919dd3451282820d3ddb0bebac20b16d4030a" dependencies = [ - "chia-bls 0.11.0", + "bigdecimal", + "chia-bls 0.17.0", "chia-protocol", "chia-puzzles", "chia-sdk-types", + "chia-secp", "clvm-traits", "clvm-utils", "clvmr", @@ -391,97 +386,116 @@ dependencies = [ "thiserror", ] -[[package]] -name = "chia-sdk-offers" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "254332ba53712a997592d38ec9b4abb065d4fa6177f4b7cb6523b3474d6da0c6" -dependencies = [ - "bech32", - "chia-bls 0.11.0", - "chia-protocol", - "chia-puzzles", - "chia-sdk-driver", - "chia-sdk-types", - "chia-traits 0.11.0", - "clvm-traits", - "clvm-utils", - "clvmr", - "flate2", - "indexmap 2.2.6", - "once_cell", - "thiserror", -] - [[package]] name = "chia-sdk-signer" -version = "0.13.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3416ca2f49b0b46c125170568f13108bd3627441bdd884da8e76543ec486195" +checksum = "9c3d924ec370571680c9b1467cae899f4467cda1f6a9d4b6c82c0249f12767a7" dependencies = [ - "chia-bls 0.11.0", + "chia-bls 0.17.0", "chia-consensus", "chia-protocol", "chia-sdk-types", + "chia-secp", "clvm-traits", "clvmr", + "k256", "thiserror", ] [[package]] name = "chia-sdk-test" -version = "0.13.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31afd50d240cc908157f263c45cf11fbd2324a954fa4ed9fdc90d6bbf852bf6" +checksum = "31010acf809615e6bbc43e0c96384a7bd39b8eaeaa4f9aaef5a8f70f57f92717" dependencies = [ "anyhow", "bip39", - "chia-bls 0.11.0", + "chia-bls 0.17.0", "chia-consensus", "chia-protocol", + "chia-puzzles", "chia-sdk-client", "chia-sdk-signer", "chia-sdk-types", - "chia-traits 0.11.0", + "chia-traits 0.17.0", "clvm-traits", "clvm-utils", "clvmr", "fastrand", "futures-channel", "futures-util", - "indexmap 2.2.6", + "hex", + "indexmap", "itertools", - "log", "rand", "rand_chacha", "thiserror", "tokio", - "tokio-tungstenite", + "tokio-tungstenite 0.21.0", + "tracing", ] [[package]] name = "chia-sdk-types" -version = "0.13.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b836a50ad0970a046fa6573025a53e5fb8fd903f31682699df0ee5d1175e03c6" +checksum = "15b669983275290aadb0d1107d8a36deacc41e1c9cbb22d4b8d234287cc88c05" dependencies = [ - "chia-bls 0.11.0", + "chia-bls 0.17.0", "chia-consensus", "chia-protocol", + "chia-puzzles", "chia-sdk-derive", + "chia-secp", "clvm-traits", "clvm-utils", "clvmr", "hex-literal", "once_cell", +] + +[[package]] +name = "chia-sdk-utils" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e98319569bc8a323964c6f4eb6737997883e6d38404d1cdfa042bd755ea929d6" +dependencies = [ + "bech32", + "chia-protocol", + "hex", + "indexmap", + "rand", + "rand_chacha", "thiserror", ] +[[package]] +name = "chia-secp" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac31ae4205b92add186fd27ee81158c7d6ff5f069c8fe3365b2d8ed686010ce9" +dependencies = [ + "chia-sha2", + "hex", + "k256", + "p256", +] + +[[package]] +name = "chia-sha2" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf81d4042d28fabed0f0cbf06748c81b14a148548976717fb3a7710812f09c6f" +dependencies = [ + "sha2", +] + [[package]] name = "chia-ssl" -version = "0.11.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c4a23cb186c6d5d7c6cc993a0d11725bd8a74a59cb605ace4523bc40fcd010" +checksum = "3b13cceb06dae32d8c76354c85245b9376558d09ee3412d93be164ba77208b13" dependencies = [ "lazy_static", "rand", @@ -504,34 +518,27 @@ dependencies = [ [[package]] name = "chia-traits" -version = "0.11.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d677fcdf166a855ddc1f5e6a0e3dfa0bd7e823d24a82198e79400dbacb1a503" +checksum = "8a90e39b3e52e458f2ee4365eefe2cb352174b675ca4ba586c3d9cff3ac41a72" dependencies = [ - "chia_streamable_macro 0.11.0", - "clvmr", + "chia-sha2", + "chia_streamable_macro 0.17.0", "thiserror", ] [[package]] name = "chia-wallet-sdk" -version = "0.13.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f53c4931b06c0946fedc71359daa0034c8de8df563d846534387f995ac01935" +checksum = "8f7ab25672fe9348f8b44177e8d6f38099fc034a4feaecb2980430d821bda03b" dependencies = [ - "bech32", - "chia-protocol", "chia-sdk-client", "chia-sdk-driver", - "chia-sdk-offers", "chia-sdk-signer", "chia-sdk-test", "chia-sdk-types", - "hex", - "indexmap 2.2.6", - "rand", - "rand_chacha", - "thiserror", + "chia-sdk-utils", ] [[package]] @@ -548,35 +555,21 @@ dependencies = [ [[package]] name = "chia_streamable_macro" -version = "0.11.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e4fde91c96e99445cca016635bc4830a302e8366c238d87b8a4213c16abb270" +checksum = "8a5e7ae41c5523feadb84ecda4cb05ec29954aad964f0789cb8c6cc774ea72e5" dependencies = [ - "clvmr", "proc-macro-crate", "proc-macro2", "quote", "syn", ] -[[package]] -name = "chrono" -version = "0.4.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" -dependencies = [ - "android-tzdata", - "iana-time-zone", - "num-traits", - "serde", - "windows-targets", -] - [[package]] name = "clvm-derive" -version = "0.11.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e6549eba5f6b3229024cb2bf9a0f9a1c73c6169f4f60947d19a42b1f70d2db2" +checksum = "bc5e060b89a2281ab21c7d8e0866b55c8bd9c1dd0b0b115fd9841561ec7842b4" dependencies = [ "proc-macro2", "quote", @@ -585,11 +578,12 @@ dependencies = [ [[package]] name = "clvm-traits" -version = "0.11.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cf0046574652d7db02909ad9bd94ec1b7e1559b6df063e11a601f4064b61f8d" +checksum = "792adc7f36ee2d544ffde86322a9b4460faa1813f6933b7a674c7521621d33f4" dependencies = [ - "chia-bls 0.11.0", + "chia-bls 0.17.0", + "chia-secp", "clvm-derive", "clvmr", "num-bigint", @@ -598,10 +592,11 @@ dependencies = [ [[package]] name = "clvm-utils" -version = "0.11.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0558159466adbce120099b9ddaf006ef23d31fa71efbbdec42123eb9835abdc8" +checksum = "2f977c5af481a341386002b9dd406cbfb5c4f1c6c2ff3657aa03dfbdc06911a3" dependencies = [ + "chia-sha2", "clvm-traits", "clvmr", "hex", @@ -609,9 +604,9 @@ dependencies = [ [[package]] name = "clvmr" -version = "0.8.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "903233f3bc9392b44a589f0cea46a53a67fedc3afb4b1303f636977074a505c5" +checksum = "2a0a3193c4f868919b940fa188f4251ed0c24e39d425ded397945bef1b08f7d9" dependencies = [ "chia-bls 0.10.0", "hex-literal", @@ -622,6 +617,7 @@ dependencies = [ "num-traits", "p256", "sha2", + "sha3", ] [[package]] @@ -664,15 +660,6 @@ dependencies = [ "libc", ] -[[package]] -name = "crc32fast" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" -dependencies = [ - "cfg-if", -] - [[package]] name = "crypto-bigint" version = "0.5.5" @@ -705,41 +692,6 @@ dependencies = [ "syn", ] -[[package]] -name = "darling" -version = "0.20.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.20.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn", -] - -[[package]] -name = "darling_macro" -version = "0.20.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" -dependencies = [ - "darling_core", - "quote", - "syn", -] - [[package]] name = "data-encoding" version = "2.6.0" @@ -758,7 +710,6 @@ dependencies = [ "napi", "napi-build", "napi-derive", - "native-tls", "num-bigint", "openssl", "openssl-sys", @@ -798,7 +749,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ "powerfmt", - "serde", ] [[package]] @@ -896,17 +846,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "flate2" -version = "1.0.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae" -dependencies = [ - "crc32fast", - "libz-sys", - "miniz_oxide", -] - [[package]] name = "fnv" version = "1.0.7" @@ -949,15 +888,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-macro" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", @@ -966,21 +905,21 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-util" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-core", "futures-macro", @@ -1036,12 +975,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - [[package]] name = "hashbrown" version = "0.14.5" @@ -1105,35 +1038,6 @@ version = "1.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" -[[package]] -name = "iana-time-zone" -version = "0.1.60" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "wasm-bindgen", - "windows-core", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" -dependencies = [ - "cc", -] - -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - [[package]] name = "idna" version = "0.5.0" @@ -1144,17 +1048,6 @@ dependencies = [ "unicode-normalization", ] -[[package]] -name = "indexmap" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown 0.12.3", - "serde", -] - [[package]] name = "indexmap" version = "2.2.6" @@ -1162,8 +1055,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", - "hashbrown 0.14.5", - "serde", + "hashbrown", ] [[package]] @@ -1181,20 +1073,11 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" -[[package]] -name = "js-sys" -version = "0.3.70" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" -dependencies = [ - "wasm-bindgen", -] - [[package]] name = "k256" -version = "0.13.3" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "956ff9b67e26e1a6a866cb758f12c6f8746208489e3e4a4b5580802f2f0a587b" +checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" dependencies = [ "cfg-if", "ecdsa", @@ -1204,6 +1087,15 @@ dependencies = [ "signature", ] +[[package]] +name = "keccak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +dependencies = [ + "cpufeatures", +] + [[package]] name = "lazy_static" version = "1.5.0" @@ -1215,9 +1107,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.155" +version = "0.2.169" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" [[package]] name = "libloading" @@ -1236,15 +1128,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" [[package]] -name = "libz-sys" -version = "1.1.18" +name = "linked-hash-map" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c15da26e5af7e25c90b37a2d75cdbf940cf4a55316de9d84c679c9b8bfabf82e" -dependencies = [ - "cc", - "pkg-config", - "vcpkg", -] +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" [[package]] name = "linux-raw-sys" @@ -1274,7 +1161,7 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3262e75e648fce39813cb56ac41f3c3e3f65217ebf3844d818d1f9398cfb0dc" dependencies = [ - "hashbrown 0.14.5", + "hashbrown", ] [[package]] @@ -1678,9 +1565,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99" dependencies = [ "unicode-ident", ] @@ -1803,9 +1690,9 @@ dependencies = [ [[package]] name = "rsa" -version = "0.9.6" +version = "0.9.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d0e5124fcb30e76a7e79bfee683a2746db83784b86289f6251b54b7950a0dfc" +checksum = "47c75d7c5c6b673e58bf54d8544a9f432e3a925b0e80f7cd3602ab5c50c55519" dependencies = [ "const-oid", "digest", @@ -1855,12 +1742,6 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0" -[[package]] -name = "ryu" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" - [[package]] name = "schannel" version = "0.1.23" @@ -1939,48 +1820,6 @@ dependencies = [ "syn", ] -[[package]] -name = "serde_json" -version = "1.0.127" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8043c06d9f82bd7271361ed64f415fe5e12a77fdb52e573e7f06a516dea329ad" -dependencies = [ - "itoa", - "memchr", - "ryu", - "serde", -] - -[[package]] -name = "serde_with" -version = "3.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69cecfa94848272156ea67b2b1a53f20fc7bc638c4a46d2f8abde08f05f4b857" -dependencies = [ - "base64", - "chrono", - "hex", - "indexmap 1.9.3", - "indexmap 2.2.6", - "serde", - "serde_derive", - "serde_json", - "serde_with_macros", - "time", -] - -[[package]] -name = "serde_with_macros" -version = "3.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8fee4991ef4f274617a51ad4af30519438dacb2f56ac773b08a1922ff743350" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "sha1" version = "0.10.6" @@ -2003,6 +1842,16 @@ dependencies = [ "digest", ] +[[package]] +name = "sha3" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +dependencies = [ + "digest", + "keccak", +] + [[package]] name = "signal-hook-registry" version = "1.4.2" @@ -2063,12 +1912,6 @@ dependencies = [ "der", ] -[[package]] -name = "strsim" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" - [[package]] name = "subtle" version = "2.6.1" @@ -2077,9 +1920,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" -version = "2.0.76" +version = "2.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578e081a14e0cefc3279b0472138c513f37b41a08d5a3cca9b6e4e8ceb6cd525" +checksum = "36147f1a48ae0ec2b5b3bc5b537d267457555a10dc06f3dbc8cb11ba3006d3b1" dependencies = [ "proc-macro2", "quote", @@ -2111,18 +1954,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.63" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.63" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", @@ -2186,9 +2029,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.39.3" +version = "1.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9babc99b9923bfa4804bd74722ff02c0381021eafa4db9949217e3be8e84fff5" +checksum = "3d61fa4ffa3de412bfea335c6ecff681de2b609ba3c77ef3e00e521813a9ed9e" dependencies = [ "backtrace", "bytes", @@ -2204,9 +2047,9 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" +checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" dependencies = [ "proc-macro2", "quote", @@ -2234,7 +2077,19 @@ dependencies = [ "native-tls", "tokio", "tokio-native-tls", - "tungstenite", + "tungstenite 0.21.0", +] + +[[package]] +name = "tokio-tungstenite" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edc5f74e248dc973e0dbb7b74c7e0d6fcc301c694ff50049504004ef4d0cdcd9" +dependencies = [ + "futures-util", + "log", + "tokio", + "tungstenite 0.24.0", ] [[package]] @@ -2249,7 +2104,7 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.2.6", + "indexmap", "toml_datetime", "winnow", ] @@ -2305,6 +2160,24 @@ dependencies = [ "utf-8", ] +[[package]] +name = "tungstenite" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18e5b8366ee7a95b16d32197d0b2604b43a0be89dc5fac9f8e96ccafbaedda8a" +dependencies = [ + "byteorder", + "bytes", + "data-encoding", + "http", + "httparse", + "log", + "rand", + "sha1", + "thiserror", + "utf-8", +] + [[package]] name = "typenum" version = "1.17.0" @@ -2379,70 +2252,6 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" -[[package]] -name = "wasm-bindgen" -version = "0.2.93" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" -dependencies = [ - "cfg-if", - "once_cell", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.93" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.93" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.93" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.93" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" - -[[package]] -name = "windows-core" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" -dependencies = [ - "windows-targets", -] - [[package]] name = "windows-sys" version = "0.52.0" diff --git a/Cargo.toml b/Cargo.toml index 3b8ca26..e9ebc36 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,15 +15,14 @@ crate-type = ["cdylib"] napi = { version = "2.12.2", default-features = false, features = ["napi6", "async"] } napi-derive = "2.12.2" -chia = "0.12.0" +chia = "0.17.0" thiserror = "1.0.61" -clvmr = "0.8.0" +clvmr = "0.10.0" tokio = "1.39.3" -chia-wallet-sdk = { version = "0.13.0", features = ["chip-0035"] } +chia-wallet-sdk = { version = "0.20.0", features = ["chip-0035", "native-tls"] } hex-literal = "0.4.1" num-bigint = "0.4.6" hex = "0.4.3" -native-tls = "0.2.12" [target.aarch64-unknown-linux-gnu.dependencies] openssl = { version = "0.10.64", features = ["vendored"] } diff --git a/src/lib.rs b/src/lib.rs index bc4a1cd..4f312f8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,5 @@ +#![allow(unexpected_cfgs)] + mod conversions; mod js; mod rust; @@ -16,16 +18,15 @@ use chia::protocol::{ use chia::puzzles::{standard::StandardArgs, DeriveSynthetic, Proof as RustProof}; use chia::traits::Streamable; use chia_wallet_sdk::{ - connect_peer, create_tls_connector, decode_address, encode_address, load_ssl_cert, - DataStore as RustDataStore, DataStoreInfo as RustDataStoreInfo, - DataStoreMetadata as RustDataStoreMetadata, DelegatedPuzzle as RustDelegatedPuzzle, NetworkId, - Peer as RustPeer, MAINNET_CONSTANTS, TESTNET11_CONSTANTS, + connect_peer, create_native_tls_connector, decode_address, encode_address, load_ssl_cert, + Connector, DataStore as RustDataStore, DataStoreInfo as RustDataStoreInfo, + DataStoreMetadata as RustDataStoreMetadata, DelegatedPuzzle as RustDelegatedPuzzle, + Peer as RustPeer, PeerOptions, MAINNET_CONSTANTS, TESTNET11_CONSTANTS, }; use conversions::{ConversionError, FromJs, ToJs}; use js::{Coin, CoinSpend, CoinState, EveProof, Proof, ServerCoin}; use napi::bindgen_prelude::*; use napi::Result; -use native_tls::TlsConnector; use std::collections::HashMap; use std::{net::SocketAddr, sync::Arc}; use tokio::sync::mpsc::{unbounded_channel, UnboundedSender}; @@ -431,7 +432,7 @@ impl ToJs for RustPossibleLaunchersResponse { } #[napi] -pub struct Tls(TlsConnector); +pub struct Tls(Connector); #[napi] impl Tls { @@ -442,7 +443,7 @@ impl Tls { /// @param {String} keyPath - Path to the key file (usually '~/.chia/mainnet/config/ssl/wallet/wallet_node.key'). pub fn new(cert_path: String, key_path: String) -> napi::Result { let cert = load_ssl_cert(&cert_path, &key_path).map_err(js::err)?; - let tls = create_tls_connector(&cert).map_err(js::err)?; + let tls = create_native_tls_connector(&cert).map_err(js::err)?; Ok(Self(tls)) } } @@ -463,12 +464,12 @@ impl Peer { /// @param {bool} testnet - True for connecting to testnet11, false for mainnet. /// @param {Tls} tls - TLS connector. /// @returns {Promise} A new Peer instance. - pub async fn new(node_uri: String, tesntet: bool, tls: &Tls) -> napi::Result { + pub async fn new(node_uri: String, testnet: bool, tls: &Tls) -> napi::Result { let (peer, mut receiver) = connect_peer( - if tesntet { - NetworkId::Testnet11 + if testnet { + "testnet11".to_string() } else { - NetworkId::Mainnet + "mainnet".to_string() }, tls.0.clone(), if let Ok(socket_addr) = node_uri.parse::() { @@ -476,6 +477,7 @@ impl Peer { } else { return Err(js::err(ConversionError::InvalidUri(node_uri))); }, + PeerOptions::default(), ) .await .map_err(js::err)?; diff --git a/src/server_coin.rs b/src/server_coin.rs index 0b6351e..bb4b390 100644 --- a/src/server_coin.rs +++ b/src/server_coin.rs @@ -1,8 +1,8 @@ use chia::clvm_traits::{self, FromClvm, ToClvm}; use chia::clvm_utils::{CurriedProgram, ToTreeHash, TreeHash}; -use chia::protocol::{Bytes32, Coin}; +use chia::protocol::{Bytes, Bytes32, Coin}; use chia_wallet_sdk::{Condition, CreateCoin, DriverError, SpendContext}; -use clvmr::NodePtr; +use clvmr::{Allocator, NodePtr}; use hex_literal::hex; use num_bigint::BigInt; @@ -90,6 +90,7 @@ pub fn morph_launcher_id(launcher_id: Bytes32, offset: &BigInt) -> Bytes32 { } pub fn urls_from_conditions( + allocator: &Allocator, server_coin: &Coin, parent_conditions: &[Condition], ) -> Option> { @@ -107,6 +108,14 @@ pub fn urls_from_conditions( return None; } + let memos = if let Some(memos) = memos { + Vec::::from_clvm(allocator, memos.value) + .ok() + .unwrap_or_default() + } else { + Vec::new() + }; + memos .iter() .skip(1) diff --git a/src/wallet.rs b/src/wallet.rs index 3880593..9e4bea4 100644 --- a/src/wallet.rs +++ b/src/wallet.rs @@ -11,8 +11,9 @@ use chia::clvm_traits::ToClvm; use chia::clvm_utils::tree_hash; use chia::clvm_utils::CurriedProgram; use chia::consensus::consensus_constants::ConsensusConstants; +use chia::consensus::gen::flags::DONT_VALIDATE_SIGNATURE; use chia::consensus::gen::{ - conditions::EmptyVisitor, flags::MEMPOOL_MODE, owned_conditions::OwnedSpendBundleConditions, + flags::MEMPOOL_MODE, owned_conditions::OwnedSpendBundleConditions, run_block_generator::run_block_generator, solution_generator::solution_generator, validation_error::ValidationErr, }; @@ -26,7 +27,10 @@ use chia::puzzles::standard::StandardArgs; use chia::puzzles::standard::StandardSolution; use chia::puzzles::DeriveSynthetic; use chia_wallet_sdk::announcement_id; +use chia_wallet_sdk::AggSigConstants; use chia_wallet_sdk::CreateCoin; +use chia_wallet_sdk::Memos; +use chia_wallet_sdk::SpendWithConditions; use chia_wallet_sdk::TESTNET11_CONSTANTS; use chia_wallet_sdk::{ get_merkle_tree, select_coins as select_coins_algo, ClientError, CoinSelectionError, Condition, @@ -173,6 +177,8 @@ fn spend_coins_together( output: i64, change_puzzle_hash: Bytes32, ) -> Result<(), WalletError> { + let p2 = StandardLayer::new(synthetic_key); + let change = i64::try_from(coins.iter().map(|coin| coin.amount).sum::()).unwrap() - output; assert!(change >= 0); let change = change as u64; @@ -184,14 +190,14 @@ fn spend_coins_together( let mut conditions = extra_conditions.clone(); if change > 0 { - conditions = conditions.create_coin(change_puzzle_hash, change, Vec::new()); + conditions = conditions.create_coin(change_puzzle_hash, change, None); } - ctx.spend_p2_coin(coin, synthetic_key, conditions)?; + p2.spend(ctx, coin, conditions)?; } else { - ctx.spend_p2_coin( + p2.spend( + ctx, coin, - synthetic_key, Conditions::new().assert_concurrent_spend(first_coin_id), )?; } @@ -211,7 +217,8 @@ pub fn send_xch( let mut total_amount = fee; for output in outputs { - conditions = conditions.create_coin(output.0, output.1, output.2.clone()); + let memos = ctx.alloc(&output.2)?; + conditions = conditions.create_coin(output.0, output.1, Some(Memos::new(memos))); total_amount += output.1; } @@ -238,16 +245,22 @@ pub fn create_server_coin( let puzzle_hash = StandardArgs::curry_tree_hash(synthetic_key).into(); let mut memos = Vec::with_capacity(uris.len() + 1); - memos.push(hint.to_vec().into()); + memos.push(hint.to_vec()); for url in &uris { - memos.push(url.as_bytes().into()); + memos.push(url.as_bytes().to_vec()); } let mut ctx = SpendContext::new(); + let memos = ctx.alloc(&memos)?; + let conditions = Conditions::new() - .create_coin(MirrorArgs::curry_tree_hash().into(), amount, memos) + .create_coin( + MirrorArgs::curry_tree_hash().into(), + amount, + Some(Memos::new(memos)), + ) .reserve_fee(fee); spend_coins_together( @@ -315,7 +328,6 @@ pub async fn spend_server_coins( let mut ctx = SpendContext::new(); let mirror_puzzle = ctx.mirror_puzzle()?; - let standard_puzzle = ctx.standard_puzzle()?; let puzzle_reveal = ctx.serialize(&CurriedProgram { program: mirror_puzzle, @@ -336,12 +348,11 @@ pub async fn spend_server_coins( return Err(WalletError::Permission); } + let parent_inner_puzzle = ctx.curry(StandardArgs::new(synthetic_key))?; + let solution = ctx.serialize(&MirrorSolution { parent_parent_id: parent_coin.coin.parent_coin_info, - parent_inner_puzzle: CurriedProgram { - program: standard_puzzle, - args: StandardArgs::new(synthetic_key), - }, + parent_inner_puzzle, parent_amount: parent_coin.coin.amount, parent_solution: StandardSolution { original_public_key: None, @@ -395,7 +406,7 @@ pub async fn fetch_server_coin( return Err(WalletError::Parse); }; - let Some(urls) = urls_from_conditions(&coin_state.coin, &conditions) else { + let Some(urls) = urls_from_conditions(&allocator, &coin_state.coin, &conditions) else { return Err(WalletError::Parse); }; @@ -430,13 +441,15 @@ pub fn mint_store( let mut ctx = SpendContext::new(); + let p2 = StandardLayer::new(minter_synthetic_key); + let lead_coin = selected_coins[0]; let lead_coin_name = lead_coin.coin_id(); for coin in selected_coins.into_iter().skip(1) { - ctx.spend_p2_coin( + p2.spend( + &mut ctx, coin, - minter_synthetic_key, Conditions::new().assert_concurrent_spend(lead_coin_name), )?; } @@ -454,32 +467,41 @@ pub fn mint_store( )?; // patch: add static hint to launcher - let launch_singleton = Conditions::new().extend(launch_singleton.into_iter().map(|cond| { - if let Condition::CreateCoin(cc) = cond { - if cc.puzzle_hash == SINGLETON_LAUNCHER_PUZZLE_HASH.into() { - return Condition::CreateCoin(CreateCoin { - puzzle_hash: cc.puzzle_hash, - amount: cc.amount, - memos: vec![DATASTORE_LAUNCHER_HINT.into()], - }); - } - - return Condition::CreateCoin(cc); - } + let launch_singleton = Conditions::new().extend( + launch_singleton + .into_iter() + .map(|cond| { + if let Condition::CreateCoin(cc) = cond { + if cc.puzzle_hash == SINGLETON_LAUNCHER_PUZZLE_HASH.into() { + let hint = ctx.hint(DATASTORE_LAUNCHER_HINT)?; + + return Ok(Condition::CreateCoin(CreateCoin { + puzzle_hash: cc.puzzle_hash, + amount: cc.amount, + memos: Some(hint), + })); + } + + return Ok(Condition::CreateCoin(cc)); + } - cond - })); + Ok(cond) + }) + .collect::, WalletError>>()?, + ); let lead_coin_conditions = if total_amount_from_coins > total_amount { + let hint = ctx.hint(minter_puzzle_hash)?; + launch_singleton.create_coin( minter_puzzle_hash, total_amount_from_coins - total_amount, - vec![minter_puzzle_hash.into()], + Some(hint), ) } else { launch_singleton }; - ctx.spend_p2_coin(lead_coin, minter_synthetic_key, lead_coin_conditions)?; + p2.spend(&mut ctx, lead_coin, lead_coin_conditions)?; Ok(SuccessResponse { coin_spends: ctx.take(), @@ -712,13 +734,15 @@ fn update_store_with_conditions( allow_writer: bool, ) -> Result { let inner_datastore_spend = match inner_spend_info { - DataStoreInnerSpend::Owner(pk) => StandardLayer::new(pk).spend(ctx, conditions)?, + DataStoreInnerSpend::Owner(pk) => { + StandardLayer::new(pk).spend_with_conditions(ctx, conditions)? + } DataStoreInnerSpend::Admin(pk) => { if !allow_admin { return Err(WalletError::Permission); } - StandardLayer::new(pk).spend(ctx, conditions)? + StandardLayer::new(pk).spend_with_conditions(ctx, conditions)? } DataStoreInnerSpend::Writer(pk) => { if !allow_writer { @@ -767,7 +791,7 @@ pub fn update_store_ownership( let merkle_tree = get_merkle_tree(ctx, new_delegated_puzzles.clone())?; let new_merkle_root_condition = UpdateDataStoreMerkleRoot { - new_merkle_root: merkle_tree.root, + new_merkle_root: merkle_tree.root(), memos: DataStore::::get_recreation_memos( datastore.info.launcher_id, new_owner_puzzle_hash.into(), @@ -850,7 +874,8 @@ pub fn melt_store( .map_err(DriverError::ToClvm)?, )); - let inner_datastore_spend = StandardLayer::new(owner_pk).spend(ctx, melt_conditions)?; + let inner_datastore_spend = + StandardLayer::new(owner_pk).spend_with_conditions(ctx, melt_conditions)?; let new_spend = datastore.spend(ctx, inner_datastore_spend)?; @@ -878,14 +903,16 @@ pub fn oracle_spend( let ctx = &mut SpendContext::new(); + let p2 = StandardLayer::new(spender_synthetic_key); + let lead_coin = selected_coins[0]; let lead_coin_name = lead_coin.coin_id(); let total_amount_from_coins = selected_coins.iter().map(|c| c.amount).sum::(); for coin in selected_coins.into_iter().skip(1) { - ctx.spend_p2_coin( + p2.spend( + ctx, coin, - spender_synthetic_key, Conditions::new().assert_concurrent_spend(lead_coin_name), )?; } @@ -897,16 +924,18 @@ pub fn oracle_spend( let mut lead_coin_conditions = assert_oracle_conds; if total_amount_from_coins > total_amount { + let hint = ctx.hint(spender_puzzle_hash)?; + lead_coin_conditions = lead_coin_conditions.create_coin( spender_puzzle_hash, total_amount_from_coins - total_amount, - vec![spender_puzzle_hash.into()], + Some(hint), ); } if fee > 0 { lead_coin_conditions = lead_coin_conditions.reserve_fee(fee); } - ctx.spend_p2_coin(lead_coin, spender_synthetic_key, lead_coin_conditions)?; + p2.spend(ctx, lead_coin, lead_coin_conditions)?; let inner_datastore_spend = OracleLayer::new(*oracle_ph, *oracle_fee) .ok_or(DriverError::OddOracleFee)? @@ -937,30 +966,34 @@ pub fn add_fee( let mut ctx = SpendContext::new(); + let p2 = StandardLayer::new(spender_synthetic_key); + let lead_coin = selected_coins[0]; let lead_coin_name = lead_coin.coin_id(); for coin in selected_coins.into_iter().skip(1) { - ctx.spend_p2_coin( + p2.spend( + &mut ctx, coin, - spender_synthetic_key, Conditions::new().assert_concurrent_spend(lead_coin_name), )?; } let mut lead_coin_conditions = Conditions::new().reserve_fee(fee); if total_amount_from_coins > fee { + let hint = ctx.hint(spender_puzzle_hash)?; + lead_coin_conditions = lead_coin_conditions.create_coin( spender_puzzle_hash, total_amount_from_coins - fee, - vec![spender_puzzle_hash.into()], + Some(hint), ); } for coin_id in coin_ids { lead_coin_conditions = lead_coin_conditions.assert_concurrent_spend(coin_id); } - ctx.spend_p2_coin(lead_coin, spender_synthetic_key, lead_coin_conditions)?; + p2.spend(&mut ctx, lead_coin, lead_coin_conditions)?; Ok(ctx.take()) } @@ -995,8 +1028,11 @@ pub fn sign_coin_spends( ) -> Result { let mut allocator = Allocator::new(); - let required_signatures = - RequiredSignature::from_coin_spends(&mut allocator, &coin_spends, network.get_constants())?; + let required_signatures = RequiredSignature::from_coin_spends( + &mut allocator, + &coin_spends, + &AggSigConstants::new(network.get_constants().agg_sig_me_additional_data), + )?; let key_pairs = private_keys .iter() @@ -1014,10 +1050,14 @@ pub fn sign_coin_spends( let mut sig = Signature::default(); for required in required_signatures { - let sk = key_pairs.get(&required.public_key()); + let RequiredSignature::Bls(required) = required else { + continue; + }; + + let sk = key_pairs.get(&required.public_key); if let Some(sk) = sk { - sig += &sign(sk, required.final_message()); + sig += &sign(sk, required.message()); } } @@ -1126,12 +1166,14 @@ pub fn get_cost(coin_spends: Vec) -> Result { ) .map_err(WalletError::Io)?; - let conds = run_block_generator::<&[u8], EmptyVisitor, _>( + let conds = run_block_generator::<&[u8], _>( &mut alloc, &generator, [], u64::MAX, - MEMPOOL_MODE, + MEMPOOL_MODE | DONT_VALIDATE_SIGNATURE, + &Signature::default(), + None, TargetNetwork::Mainnet.get_constants(), )?;