From ccc0eb73f49a62aac6972ca52917676746c2b8c4 Mon Sep 17 00:00:00 2001 From: Nasr Date: Fri, 12 Apr 2024 09:50:00 -0400 Subject: [PATCH 1/3] feat: generating c++ bindings --- Cargo.lock | 387 ++++++++++++------------ build.rs | 41 ++- dojo.hpp | 847 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 1086 insertions(+), 189 deletions(-) create mode 100644 dojo.hpp diff --git a/Cargo.lock b/Cargo.lock index 4f73ca8..d936b29 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -102,9 +102,9 @@ dependencies = [ [[package]] name = "allocator-api2" -version = "0.2.16" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" +checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" [[package]] name = "android-tzdata" @@ -171,9 +171,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.81" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247" +checksum = "f538837af36e6f6a9be0faa67f9a314f8119e4e4b5867c6ab40ed60360142519" [[package]] name = "arc-swap" @@ -382,7 +382,7 @@ checksum = "7378575ff571966e99a744addeff0bff98b8ada0dedf1956d59e634db95eaac1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.57", + "syn 2.0.58", "synstructure 0.13.1", ] @@ -405,7 +405,7 @@ checksum = "7b18050c2cd6fe86c3a76584ef5e0baf286d038cda203eb6223df2cc413565f7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.57", + "syn 2.0.58", ] [[package]] @@ -432,7 +432,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f28243a43d821d11341ab73c80bed182dc015c514b951616cf79bd4af39af0c3" dependencies = [ "concurrent-queue", - "event-listener 5.2.0", + "event-listener 5.3.0", "event-listener-strategy 0.5.1", "futures-core", "pin-project-lite", @@ -440,9 +440,9 @@ dependencies = [ [[package]] name = "async-compression" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86a9249d1447a85f95810c620abea82e001fe58a31713fcce614caf52499f905" +checksum = "07dbbf24db18d609b1462965249abdf49129ccad073ec257da372adc83259c60" dependencies = [ "brotli", "flate2", @@ -454,9 +454,9 @@ dependencies = [ [[package]] name = "async-executor" -version = "1.9.1" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10b3e585719c2358d2660232671ca8ca4ddb4be4ce8a1842d6c2dc8685303316" +checksum = "5f98c37cf288e302c16ef6c8472aad1e034c6c84ce5ea7b8101c98eb4a802fee" dependencies = [ "async-lock 3.3.0", "async-task", @@ -585,7 +585,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.57", + "syn 2.0.58", ] [[package]] @@ -596,13 +596,13 @@ checksum = "fbb36e985947064623dbd357f727af08ffd077f93d696782f3c56365fa2e2799" [[package]] name = "async-trait" -version = "0.1.79" +version = "0.1.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507401cad91ec6a857ed5513a2073c82a9b9048762b885bb98655b306964681" +checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.57", + "syn 2.0.58", ] [[package]] @@ -663,7 +663,7 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.57", + "syn 2.0.58", ] [[package]] @@ -756,6 +756,12 @@ version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" +[[package]] +name = "base64" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9475866fec1451be56a3c2400fd081ff546538961565ccb5b7142cbd22bc7a51" + [[package]] name = "base64ct" version = "1.6.0" @@ -879,9 +885,9 @@ dependencies = [ [[package]] name = "brotli" -version = "3.5.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d640d25bc63c50fb1f0b545ffd80207d2e10a4c965530809b40ba3386825c391" +checksum = "125740193d7fee5cc63ab9e16c2fdc4e07c74ba755cc53b327d6ea029e9fc569" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -890,9 +896,9 @@ dependencies = [ [[package]] name = "brotli-decompressor" -version = "2.5.1" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e2e4afe60d7dd600fdd3de8d0f08c2b7ec039712e3b6137ff98b7004e82de4f" +checksum = "65622a320492e09b5e0ac436b14c54ff68199bac392d0e89a6832c4518eea525" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -920,9 +926,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.15.4" +version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ff69b9dd49fd426c69a0db9fc04dd934cdb6645ff000864d98f7e2af8830eaa" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "byte-slice-cast" @@ -1022,7 +1028,7 @@ dependencies = [ "quote", "serde_json", "starknet 0.8.0", - "syn 2.0.57", + "syn 2.0.58", "thiserror", ] @@ -1035,7 +1041,7 @@ dependencies = [ "quote", "serde_json", "starknet 0.9.0", - "syn 2.0.57", + "syn 2.0.58", "thiserror", ] @@ -1051,7 +1057,7 @@ dependencies = [ "quote", "serde_json", "starknet 0.8.0", - "syn 2.0.57", + "syn 2.0.58", "thiserror", ] @@ -1067,7 +1073,7 @@ dependencies = [ "quote", "serde_json", "starknet 0.9.0", - "syn 2.0.57", + "syn 2.0.58", "thiserror", ] @@ -1084,7 +1090,7 @@ dependencies = [ "quote", "serde_json", "starknet 0.9.0", - "syn 2.0.57", + "syn 2.0.58", "thiserror", ] @@ -1292,7 +1298,7 @@ checksum = "fef002aac874d76492eb9577dab663f9a84fe4584b4215c7ebfda7d025fcadae" dependencies = [ "cairo-lang-debug", "quote", - "syn 2.0.57", + "syn 2.0.58", ] [[package]] @@ -1711,9 +1717,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.90" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cd6604a82acf3039f1144f54b8eb34e91ffba622051189e71b781822d5ee1f5" +checksum = "2678b2e3449475e95b0aa6f9b506a28e61b3dc8996592b983695e8ebb58a8b41" dependencies = [ "jobserver", "libc", @@ -1831,14 +1837,14 @@ dependencies = [ "anstream", "anstyle", "clap_lex 0.7.0", - "strsim 0.11.0", + "strsim 0.11.1", ] [[package]] name = "clap_complete" -version = "4.5.1" +version = "4.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "885e4d7d5af40bfb99ae6f9433e292feac98d452dcb3ec3d25dfe7552b77da8c" +checksum = "dd79504325bf38b10165b02e89b4347300f855f273c4cb30c4a3209e6583275e" dependencies = [ "clap 4.5.4", ] @@ -1852,7 +1858,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.57", + "syn 2.0.58", ] [[package]] @@ -2017,9 +2023,9 @@ dependencies = [ [[package]] name = "crc" -version = "3.0.1" +version = "3.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86ec7a15cbe22e59248fc7eadb1907dab5ba09372595da4d73dd805ed4417dfe" +checksum = "69e6e4d7b33a94f0991c26729976b10ebde1d34c3ee82408fb536164fa10d636" dependencies = [ "crc-catalog", ] @@ -2170,7 +2176,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.57", + "syn 2.0.58", ] [[package]] @@ -2194,7 +2200,7 @@ dependencies = [ "proc-macro2", "quote", "strsim 0.10.0", - "syn 2.0.57", + "syn 2.0.58", ] [[package]] @@ -2205,7 +2211,7 @@ checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f" dependencies = [ "darling_core", "quote", - "syn 2.0.57", + "syn 2.0.58", ] [[package]] @@ -2340,7 +2346,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.57", + "syn 2.0.58", ] [[package]] @@ -2350,7 +2356,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "206868b8242f27cecce124c19fd88157fbd0dd334df2587f36417bafbc85097b" dependencies = [ "derive_builder_core", - "syn 2.0.57", + "syn 2.0.58", ] [[package]] @@ -2450,13 +2456,13 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.57", + "syn 2.0.58", ] [[package]] name = "dojo-bindgen" -version = "0.6.0-alpha.12" -source = "git+https://github.com/dojoengine/dojo#c2280feaf9567cd0727a6e7d93e67c173a66356b" +version = "0.6.1-alpha.0" +source = "git+https://github.com/dojoengine/dojo#99bd4cba7536a38a3d821f0e057845b70c542608" dependencies = [ "async-trait", "cainome 0.1.5", @@ -2472,7 +2478,7 @@ dependencies = [ [[package]] name = "dojo-c" -version = "1.0.0" +version = "1.1.0" dependencies = [ "anyhow", "cbindgen", @@ -2501,8 +2507,8 @@ dependencies = [ [[package]] name = "dojo-lang" -version = "0.6.0-alpha.12" -source = "git+https://github.com/dojoengine/dojo#c2280feaf9567cd0727a6e7d93e67c173a66356b" +version = "0.6.1-alpha.0" +source = "git+https://github.com/dojoengine/dojo#99bd4cba7536a38a3d821f0e057845b70c542608" dependencies = [ "anyhow", "cairo-lang-compiler", @@ -2546,8 +2552,8 @@ dependencies = [ [[package]] name = "dojo-types" -version = "0.6.0-alpha.12" -source = "git+https://github.com/dojoengine/dojo#c2280feaf9567cd0727a6e7d93e67c173a66356b" +version = "0.6.1-alpha.0" +source = "git+https://github.com/dojoengine/dojo#99bd4cba7536a38a3d821f0e057845b70c542608" dependencies = [ "crypto-bigint", "hex", @@ -2562,8 +2568,8 @@ dependencies = [ [[package]] name = "dojo-world" -version = "0.6.0-alpha.12" -source = "git+https://github.com/dojoengine/dojo#c2280feaf9567cd0727a6e7d93e67c173a66356b" +version = "0.6.1-alpha.0" +source = "git+https://github.com/dojoengine/dojo#99bd4cba7536a38a3d821f0e057845b70c542608" dependencies = [ "anyhow", "async-trait", @@ -2701,9 +2707,9 @@ checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" [[package]] name = "encoding_rs" -version = "0.8.33" +version = "0.8.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" +checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" dependencies = [ "cfg-if", ] @@ -2717,7 +2723,7 @@ dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.57", + "syn 2.0.58", ] [[package]] @@ -2837,9 +2843,9 @@ dependencies = [ [[package]] name = "event-listener" -version = "5.2.0" +version = "5.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b5fb89194fa3cad959b833185b3063ba881dbfc7030680b314250779fb4cc91" +checksum = "6d9944b8ca13534cdfb2800775f8dd4902ff3fc75a50101466decadfdf322a24" dependencies = [ "concurrent-queue", "parking", @@ -2862,7 +2868,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "332f51cb23d20b0de8458b86580878211da09bcd4503cb579c225b3d124cabb3" dependencies = [ - "event-listener 5.2.0", + "event-listener 5.3.0", "pin-project-lite", ] @@ -3129,7 +3135,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.57", + "syn 2.0.58", ] [[package]] @@ -3212,7 +3218,7 @@ checksum = "d4cf186fea4af17825116f72932fe52cce9a13bae39ff63b4dc0cfdb3fb4bde1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.57", + "syn 2.0.58", ] [[package]] @@ -3228,9 +3234,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.12" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +checksum = "94b22e06ecb0110981051723910cbf0b5f5e09a2062dd7663334ee79a9d1286c" dependencies = [ "cfg-if", "js-sys", @@ -3325,7 +3331,7 @@ dependencies = [ "gix-utils", "itoa", "thiserror", - "winnow 0.6.5", + "winnow 0.6.6", ] [[package]] @@ -3420,7 +3426,7 @@ dependencies = [ "smallvec", "thiserror", "unicode-bom", - "winnow 0.6.5", + "winnow 0.6.6", ] [[package]] @@ -3668,7 +3674,7 @@ checksum = "1dff438f14e67e7713ab9332f5fd18c8f20eb7eb249494f6c2bf170522224032" dependencies = [ "proc-macro2", "quote", - "syn 2.0.57", + "syn 2.0.58", ] [[package]] @@ -3715,7 +3721,7 @@ dependencies = [ "itoa", "smallvec", "thiserror", - "winnow 0.6.5", + "winnow 0.6.6", ] [[package]] @@ -3842,7 +3848,7 @@ dependencies = [ "gix-validate", "memmap2", "thiserror", - "winnow 0.6.5", + "winnow 0.6.6", ] [[package]] @@ -4114,9 +4120,9 @@ dependencies = [ [[package]] name = "good_lp" -version = "1.7.1" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef62372af3ab5b335ee1fca8ae7fb08da1c4aee777d9b6b740fa49cb74d905ac" +checksum = "3198bd13dea84c76a64621d6ee8ee26a4960a9a0d538eca95ca8f1320a469ac9" dependencies = [ "fnv", "minilp", @@ -4135,9 +4141,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fbd2820c5e49886948654ab546d0688ff24530286bdcf8fca3cefb16d4618eb" +checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" dependencies = [ "bytes", "fnv", @@ -4894,9 +4900,9 @@ checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "jobserver" -version = "0.1.28" +version = "0.1.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab46a6e9526ddef3ae7f787c06f0f2600639ba80ea3eade3d8e670a2230f51d6" +checksum = "f08474e32172238f2827bd160c67871cdb2801430f65c3979184dc362e3ca118" dependencies = [ "libc", ] @@ -5032,7 +5038,7 @@ dependencies = [ [[package]] name = "libp2p" version = "0.54.0" -source = "git+https://github.com/libp2p/rust-libp2p#9785dcae9c8634dc6dcd91a07553a9d7b13d8e86" +source = "git+https://github.com/libp2p/rust-libp2p#042174ebfda46ebba605015ded9314ea3699801a" dependencies = [ "bytes", "either", @@ -5066,7 +5072,7 @@ dependencies = [ [[package]] name = "libp2p-allow-block-list" version = "0.3.0" -source = "git+https://github.com/libp2p/rust-libp2p#9785dcae9c8634dc6dcd91a07553a9d7b13d8e86" +source = "git+https://github.com/libp2p/rust-libp2p#042174ebfda46ebba605015ded9314ea3699801a" dependencies = [ "libp2p-core 0.41.2 (git+https://github.com/libp2p/rust-libp2p)", "libp2p-identity", @@ -5077,7 +5083,7 @@ dependencies = [ [[package]] name = "libp2p-connection-limits" version = "0.3.1" -source = "git+https://github.com/libp2p/rust-libp2p#9785dcae9c8634dc6dcd91a07553a9d7b13d8e86" +source = "git+https://github.com/libp2p/rust-libp2p#042174ebfda46ebba605015ded9314ea3699801a" dependencies = [ "libp2p-core 0.41.2 (git+https://github.com/libp2p/rust-libp2p)", "libp2p-identity", @@ -5116,7 +5122,7 @@ dependencies = [ [[package]] name = "libp2p-core" version = "0.41.2" -source = "git+https://github.com/libp2p/rust-libp2p#9785dcae9c8634dc6dcd91a07553a9d7b13d8e86" +source = "git+https://github.com/libp2p/rust-libp2p#042174ebfda46ebba605015ded9314ea3699801a" dependencies = [ "either", "fnv", @@ -5143,7 +5149,7 @@ dependencies = [ [[package]] name = "libp2p-dns" version = "0.41.1" -source = "git+https://github.com/libp2p/rust-libp2p#9785dcae9c8634dc6dcd91a07553a9d7b13d8e86" +source = "git+https://github.com/libp2p/rust-libp2p#042174ebfda46ebba605015ded9314ea3699801a" dependencies = [ "async-trait", "futures", @@ -5189,10 +5195,10 @@ dependencies = [ [[package]] name = "libp2p-gossipsub" version = "0.46.1" -source = "git+https://github.com/libp2p/rust-libp2p#9785dcae9c8634dc6dcd91a07553a9d7b13d8e86" +source = "git+https://github.com/libp2p/rust-libp2p#042174ebfda46ebba605015ded9314ea3699801a" dependencies = [ "asynchronous-codec", - "base64 0.21.7", + "base64 0.22.0", "byteorder", "bytes", "either", @@ -5219,7 +5225,7 @@ dependencies = [ [[package]] name = "libp2p-identify" version = "0.44.2" -source = "git+https://github.com/libp2p/rust-libp2p#9785dcae9c8634dc6dcd91a07553a9d7b13d8e86" +source = "git+https://github.com/libp2p/rust-libp2p#042174ebfda46ebba605015ded9314ea3699801a" dependencies = [ "asynchronous-codec", "either", @@ -5259,7 +5265,7 @@ dependencies = [ [[package]] name = "libp2p-mdns" version = "0.45.1" -source = "git+https://github.com/libp2p/rust-libp2p#9785dcae9c8634dc6dcd91a07553a9d7b13d8e86" +source = "git+https://github.com/libp2p/rust-libp2p#042174ebfda46ebba605015ded9314ea3699801a" dependencies = [ "data-encoding", "futures", @@ -5279,7 +5285,7 @@ dependencies = [ [[package]] name = "libp2p-metrics" version = "0.14.1" -source = "git+https://github.com/libp2p/rust-libp2p#9785dcae9c8634dc6dcd91a07553a9d7b13d8e86" +source = "git+https://github.com/libp2p/rust-libp2p#042174ebfda46ebba605015ded9314ea3699801a" dependencies = [ "futures", "instant", @@ -5297,7 +5303,7 @@ dependencies = [ [[package]] name = "libp2p-noise" version = "0.44.0" -source = "git+https://github.com/libp2p/rust-libp2p#9785dcae9c8634dc6dcd91a07553a9d7b13d8e86" +source = "git+https://github.com/libp2p/rust-libp2p#042174ebfda46ebba605015ded9314ea3699801a" dependencies = [ "asynchronous-codec", "bytes", @@ -5321,8 +5327,8 @@ dependencies = [ [[package]] name = "libp2p-ping" -version = "0.44.0" -source = "git+https://github.com/libp2p/rust-libp2p#9785dcae9c8634dc6dcd91a07553a9d7b13d8e86" +version = "0.44.1" +source = "git+https://github.com/libp2p/rust-libp2p#042174ebfda46ebba605015ded9314ea3699801a" dependencies = [ "either", "futures", @@ -5339,7 +5345,7 @@ dependencies = [ [[package]] name = "libp2p-quic" version = "0.10.2" -source = "git+https://github.com/libp2p/rust-libp2p#9785dcae9c8634dc6dcd91a07553a9d7b13d8e86" +source = "git+https://github.com/libp2p/rust-libp2p#042174ebfda46ebba605015ded9314ea3699801a" dependencies = [ "bytes", "futures", @@ -5361,8 +5367,8 @@ dependencies = [ [[package]] name = "libp2p-relay" -version = "0.17.1" -source = "git+https://github.com/libp2p/rust-libp2p#9785dcae9c8634dc6dcd91a07553a9d7b13d8e86" +version = "0.17.2" +source = "git+https://github.com/libp2p/rust-libp2p#042174ebfda46ebba605015ded9314ea3699801a" dependencies = [ "asynchronous-codec", "bytes", @@ -5407,7 +5413,7 @@ dependencies = [ [[package]] name = "libp2p-swarm" version = "0.44.2" -source = "git+https://github.com/libp2p/rust-libp2p#9785dcae9c8634dc6dcd91a07553a9d7b13d8e86" +source = "git+https://github.com/libp2p/rust-libp2p#042174ebfda46ebba605015ded9314ea3699801a" dependencies = [ "either", "fnv", @@ -5432,18 +5438,18 @@ dependencies = [ [[package]] name = "libp2p-swarm-derive" version = "0.34.3" -source = "git+https://github.com/libp2p/rust-libp2p#9785dcae9c8634dc6dcd91a07553a9d7b13d8e86" +source = "git+https://github.com/libp2p/rust-libp2p#042174ebfda46ebba605015ded9314ea3699801a" dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.57", + "syn 2.0.58", ] [[package]] name = "libp2p-tcp" version = "0.41.0" -source = "git+https://github.com/libp2p/rust-libp2p#9785dcae9c8634dc6dcd91a07553a9d7b13d8e86" +source = "git+https://github.com/libp2p/rust-libp2p#042174ebfda46ebba605015ded9314ea3699801a" dependencies = [ "futures", "futures-timer", @@ -5459,7 +5465,7 @@ dependencies = [ [[package]] name = "libp2p-tls" version = "0.3.0" -source = "git+https://github.com/libp2p/rust-libp2p#9785dcae9c8634dc6dcd91a07553a9d7b13d8e86" +source = "git+https://github.com/libp2p/rust-libp2p#042174ebfda46ebba605015ded9314ea3699801a" dependencies = [ "futures", "futures-rustls", @@ -5477,7 +5483,7 @@ dependencies = [ [[package]] name = "libp2p-upnp" version = "0.2.2" -source = "git+https://github.com/libp2p/rust-libp2p#9785dcae9c8634dc6dcd91a07553a9d7b13d8e86" +source = "git+https://github.com/libp2p/rust-libp2p#042174ebfda46ebba605015ded9314ea3699801a" dependencies = [ "futures", "futures-timer", @@ -5492,7 +5498,7 @@ dependencies = [ [[package]] name = "libp2p-webrtc" version = "0.7.1-alpha" -source = "git+https://github.com/libp2p/rust-libp2p#9785dcae9c8634dc6dcd91a07553a9d7b13d8e86" +source = "git+https://github.com/libp2p/rust-libp2p#042174ebfda46ebba605015ded9314ea3699801a" dependencies = [ "async-trait", "bytes", @@ -5520,7 +5526,7 @@ dependencies = [ [[package]] name = "libp2p-webrtc-utils" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p#9785dcae9c8634dc6dcd91a07553a9d7b13d8e86" +source = "git+https://github.com/libp2p/rust-libp2p#042174ebfda46ebba605015ded9314ea3699801a" dependencies = [ "asynchronous-codec", "bytes", @@ -5542,7 +5548,7 @@ dependencies = [ [[package]] name = "libp2p-webrtc-websys" version = "0.3.0-alpha" -source = "git+https://github.com/libp2p/rust-libp2p#9785dcae9c8634dc6dcd91a07553a9d7b13d8e86" +source = "git+https://github.com/libp2p/rust-libp2p#042174ebfda46ebba605015ded9314ea3699801a" dependencies = [ "bytes", "futures", @@ -5563,7 +5569,7 @@ dependencies = [ [[package]] name = "libp2p-yamux" version = "0.45.1" -source = "git+https://github.com/libp2p/rust-libp2p#9785dcae9c8634dc6dcd91a07553a9d7b13d8e86" +source = "git+https://github.com/libp2p/rust-libp2p#042174ebfda46ebba605015ded9314ea3699801a" dependencies = [ "either", "futures", @@ -5881,6 +5887,12 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" +[[package]] +name = "multimap" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "defc4c55412d89136f966bbb339008b474350e5e6e78d2714439c386b3137a03" + [[package]] name = "multistream-select" version = "0.13.0" @@ -5898,7 +5910,7 @@ dependencies = [ [[package]] name = "multistream-select" version = "0.13.0" -source = "git+https://github.com/libp2p/rust-libp2p#9785dcae9c8634dc6dcd91a07553a9d7b13d8e86" +source = "git+https://github.com/libp2p/rust-libp2p#042174ebfda46ebba605015ded9314ea3699801a" dependencies = [ "bytes", "futures", @@ -5994,9 +6006,9 @@ dependencies = [ [[package]] name = "netlink-sys" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6471bf08e7ac0135876a9581bf3217ef0333c191c128d34878079f42ee150411" +checksum = "416060d346fbaf1f23f9512963e3e878f1a78e707cb699ba9215761754244307" dependencies = [ "bytes", "futures", @@ -6295,7 +6307,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.57", + "syn 2.0.58", ] [[package]] @@ -6498,11 +6510,11 @@ dependencies = [ [[package]] name = "pem" -version = "3.0.3" +version = "3.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b8fcc794035347fb64beda2d3b462595dd2753e3f268d89c5aae77e8cf2c310" +checksum = "8e459365e590736a54c3fa561947c84837534b8e9af6fc5bf781307e82658fae" dependencies = [ - "base64 0.21.7", + "base64 0.22.0", "serde", ] @@ -6563,7 +6575,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.57", + "syn 2.0.58", ] [[package]] @@ -6727,7 +6739,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d3928fb5db768cb86f891ff014f0144589297e3c6a1aba6ed7cecfdace270c7" dependencies = [ "proc-macro2", - "syn 2.0.57", + "syn 2.0.58", ] [[package]] @@ -6834,7 +6846,7 @@ checksum = "440f724eba9f6996b75d63681b0a92b06947f1457076d503a4d2e2c8f56442b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.57", + "syn 2.0.58", ] [[package]] @@ -6849,12 +6861,12 @@ dependencies = [ [[package]] name = "prost" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "146c289cda302b98a28d40c8b3b90498d6e526dd24ac2ecea73e4e491685b94a" +checksum = "d0f5d036824e4761737860779c906171497f6d55681139d8312388f8fe398922" dependencies = [ "bytes", - "prost-derive 0.12.3", + "prost-derive 0.12.4", ] [[package]] @@ -6868,7 +6880,7 @@ dependencies = [ "itertools 0.10.5", "lazy_static", "log", - "multimap", + "multimap 0.8.3", "petgraph", "prettyplease 0.1.25", "prost 0.11.9", @@ -6881,24 +6893,23 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c55e02e35260070b6f716a2423c2ff1c3bb1642ddca6f99e1f26d06268a0e2d2" +checksum = "80b776a1b2dc779f5ee0641f8ade0125bc1298dd41a9a0c16d8bd57b42d222b1" dependencies = [ "bytes", - "heck 0.4.1", - "itertools 0.11.0", + "heck 0.5.0", + "itertools 0.12.1", "log", - "multimap", + "multimap 0.10.0", "once_cell", "petgraph", "prettyplease 0.2.17", - "prost 0.12.3", - "prost-types 0.12.3", + "prost 0.12.4", + "prost-types 0.12.4", "regex", - "syn 2.0.57", + "syn 2.0.58", "tempfile", - "which 4.4.2", ] [[package]] @@ -6916,15 +6927,15 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efb6c9a1dd1def8e2124d17e83a20af56f1570d6c2d2bd9e266ccb768df3840e" +checksum = "19de2de2a00075bf566bee3bd4db014b11587e84184d3f7a791bc17f1a8e9e48" dependencies = [ "anyhow", - "itertools 0.11.0", + "itertools 0.12.1", "proc-macro2", "quote", - "syn 2.0.57", + "syn 2.0.58", ] [[package]] @@ -6938,11 +6949,11 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "193898f59edcf43c26227dcd4c8427f00d99d61e95dcde58dabd49fa291d470e" +checksum = "3235c33eb02c1f1e212abdbe34c78b264b038fb58ca612664343271e36e55ffe" dependencies = [ - "prost 0.12.3", + "prost 0.12.4", ] [[package]] @@ -6976,7 +6987,7 @@ dependencies = [ [[package]] name = "quick-protobuf-codec" version = "0.3.1" -source = "git+https://github.com/libp2p/rust-libp2p#9785dcae9c8634dc6dcd91a07553a9d7b13d8e86" +source = "git+https://github.com/libp2p/rust-libp2p#042174ebfda46ebba605015ded9314ea3699801a" dependencies = [ "asynchronous-codec", "bytes", @@ -7035,9 +7046,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.35" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] @@ -7505,9 +7516,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" +checksum = "80af6f9131f277a45a3fba6ce8e2258037bb0477a67e610d3c1fe046ab31de47" [[package]] name = "rw-stream-sink" @@ -7523,7 +7534,7 @@ dependencies = [ [[package]] name = "rw-stream-sink" version = "0.4.0" -source = "git+https://github.com/libp2p/rust-libp2p#9785dcae9c8634dc6dcd91a07553a9d7b13d8e86" +source = "git+https://github.com/libp2p/rust-libp2p#042174ebfda46ebba605015ded9314ea3699801a" dependencies = [ "futures", "pin-project", @@ -7891,7 +7902,7 @@ checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.57", + "syn 2.0.58", ] [[package]] @@ -7913,7 +7924,7 @@ checksum = "e578a843d40b4189a4d66bba51d7684f57da5bd7c304c64e14bd63efbef49509" dependencies = [ "proc-macro2", "quote", - "syn 2.0.57", + "syn 2.0.58", ] [[package]] @@ -7941,13 +7952,13 @@ dependencies = [ [[package]] name = "serde_repr" -version = "0.1.18" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b2e6b945e9d3df726b65d6ee24060aff8e3533d431f677a9695db04eff9dfdb" +checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.57", + "syn 2.0.58", ] [[package]] @@ -7996,7 +8007,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.57", + "syn 2.0.58", ] [[package]] @@ -8160,8 +8171,8 @@ dependencies = [ [[package]] name = "sozo-ops" -version = "0.6.0-alpha.12" -source = "git+https://github.com/dojoengine/dojo#c2280feaf9567cd0727a6e7d93e67c173a66356b" +version = "0.6.1-alpha.0" +source = "git+https://github.com/dojoengine/dojo#99bd4cba7536a38a3d821f0e057845b70c542608" dependencies = [ "anyhow", "async-trait", @@ -8629,7 +8640,7 @@ checksum = "bbc159a1934c7be9761c237333a57febe060ace2bc9e3b337a59a37af206d19f" dependencies = [ "starknet-curve", "starknet-ff", - "syn 2.0.57", + "syn 2.0.58", ] [[package]] @@ -8663,7 +8674,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95d549d3078bdbe775d0deaa8ddb57a19942989ce7c1f2dfd60beeb322bb4945" dependencies = [ "starknet-core 0.10.0", - "syn 2.0.57", + "syn 2.0.58", ] [[package]] @@ -8776,9 +8787,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "strsim" -version = "0.11.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ee073c9e4cd00e28217186dbe12796d692868f432bf2e97ee73bed0c56dfa01" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "strum" @@ -8796,7 +8807,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.57", + "syn 2.0.58", ] [[package]] @@ -8846,9 +8857,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.57" +version = "2.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11a6ae1e52eb25aab8f3fb9fca13be982a373b8f1157ca14b897a825ba4a2d35" +checksum = "44cfb93f38070beee36b3fef7d4f5a16f27751d94b187b666a5cc5e9b0d30687" dependencies = [ "proc-macro2", "quote", @@ -8881,7 +8892,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn 2.0.57", + "syn 2.0.58", ] [[package]] @@ -8977,7 +8988,7 @@ checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.57", + "syn 2.0.58", ] [[package]] @@ -9012,9 +9023,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.34" +version = "0.3.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", "itoa", @@ -9035,9 +9046,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.17" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" dependencies = [ "num-conv", "time-core", @@ -9114,7 +9125,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.57", + "syn 2.0.58", ] [[package]] @@ -9250,7 +9261,7 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "winnow 0.6.5", + "winnow 0.6.6", ] [[package]] @@ -9294,7 +9305,7 @@ dependencies = [ "hyper-timeout", "percent-encoding", "pin-project", - "prost 0.12.3", + "prost 0.12.4", "tokio", "tokio-stream", "tower", @@ -9324,9 +9335,9 @@ checksum = "9d021fc044c18582b9a2408cd0dd05b1596e3ecdb5c4df822bb0183545683889" dependencies = [ "prettyplease 0.2.17", "proc-macro2", - "prost-build 0.12.3", + "prost-build 0.12.4", "quote", - "syn 2.0.57", + "syn 2.0.58", ] [[package]] @@ -9335,8 +9346,8 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fa37c513df1339d197f4ba21d28c918b9ef1ac1768265f11ecb6b7f1cba1b76" dependencies = [ - "prost 0.12.3", - "prost-types 0.12.3", + "prost 0.12.4", + "prost-types 0.12.4", "tokio", "tokio-stream", "tonic 0.10.2", @@ -9388,8 +9399,8 @@ dependencies = [ [[package]] name = "torii-client" -version = "0.6.0-alpha.12" -source = "git+https://github.com/dojoengine/dojo#c2280feaf9567cd0727a6e7d93e67c173a66356b" +version = "0.6.1-alpha.0" +source = "git+https://github.com/dojoengine/dojo#99bd4cba7536a38a3d821f0e057845b70c542608" dependencies = [ "async-trait", "crypto-bigint", @@ -9400,7 +9411,7 @@ dependencies = [ "libp2p-gossipsub 0.46.1 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.12.1", "prost 0.11.9", - "prost 0.12.3", + "prost 0.12.4", "serde", "serde_json", "starknet 0.9.0", @@ -9416,8 +9427,8 @@ dependencies = [ [[package]] name = "torii-core" -version = "0.6.0-alpha.12" -source = "git+https://github.com/dojoengine/dojo#c2280feaf9567cd0727a6e7d93e67c173a66356b" +version = "0.6.1-alpha.0" +source = "git+https://github.com/dojoengine/dojo#99bd4cba7536a38a3d821f0e057845b70c542608" dependencies = [ "anyhow", "async-trait", @@ -9450,8 +9461,8 @@ dependencies = [ [[package]] name = "torii-grpc" -version = "0.6.0-alpha.12" -source = "git+https://github.com/dojoengine/dojo#c2280feaf9567cd0727a6e7d93e67c173a66356b" +version = "0.6.1-alpha.0" +source = "git+https://github.com/dojoengine/dojo#99bd4cba7536a38a3d821f0e057845b70c542608" dependencies = [ "bytes", "crypto-bigint", @@ -9462,7 +9473,7 @@ dependencies = [ "hyper", "parking_lot 0.12.1", "prost 0.11.9", - "prost 0.12.3", + "prost 0.12.4", "rand", "rayon", "serde", @@ -9489,14 +9500,15 @@ dependencies = [ [[package]] name = "torii-relay" -version = "0.6.0-alpha.12" -source = "git+https://github.com/dojoengine/dojo#c2280feaf9567cd0727a6e7d93e67c173a66356b" +version = "0.6.1-alpha.0" +source = "git+https://github.com/dojoengine/dojo#99bd4cba7536a38a3d821f0e057845b70c542608" dependencies = [ "anyhow", "async-trait", "chrono", "crypto-bigint", "dojo-types", + "dojo-world", "futures", "indexmap 2.2.6", "libp2p", @@ -9507,9 +9519,8 @@ dependencies = [ "serde", "serde_json", "sqlx", - "starknet-core 0.9.0", + "starknet 0.9.0", "starknet-crypto", - "starknet-ff", "thiserror", "tokio", "torii-core", @@ -9591,7 +9602,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.57", + "syn 2.0.58", ] [[package]] @@ -9696,7 +9707,7 @@ dependencies = [ "proc-macro2", "quote", "serde_derive_internals 0.28.0", - "syn 2.0.57", + "syn 2.0.58", ] [[package]] @@ -9736,7 +9747,7 @@ checksum = "563b3b88238ec95680aef36bdece66896eaa7ce3c0f1b4f39d38fb2435261352" dependencies = [ "proc-macro2", "quote", - "syn 2.0.57", + "syn 2.0.58", ] [[package]] @@ -9759,9 +9770,9 @@ dependencies = [ [[package]] name = "uluru" -version = "3.0.0" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "794a32261a1f5eb6a4462c81b59cec87b5c27d5deea7dd1ac8fc781c41d226db" +checksum = "7c8a2469e56e6e5095c82ccd3afb98dad95f7af7929aab6d8ba8d6e0f73657da" dependencies = [ "arrayvec", ] @@ -10009,7 +10020,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.57", + "syn 2.0.58", "wasm-bindgen-shared", ] @@ -10043,7 +10054,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.57", + "syn 2.0.58", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -10076,7 +10087,7 @@ checksum = "b7f89739351a2e03cb94beb799d47fb2cac01759b40ec441f7de39b00cbf7ef0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.57", + "syn 2.0.58", ] [[package]] @@ -10388,9 +10399,9 @@ dependencies = [ [[package]] name = "widestring" -version = "1.0.2" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "653f141f39ec16bba3c5abe400a0c60da7468261cc2cbf36805022876bc721a8" +checksum = "7219d36b6eac893fa81e84ebe06485e7dcbb616177469b142df14f1f4deb1311" [[package]] name = "winapi" @@ -10594,9 +10605,9 @@ dependencies = [ [[package]] name = "winnow" -version = "0.6.5" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dffa400e67ed5a4dd237983829e66475f0a4a26938c4b04c21baede6262215b8" +checksum = "f0c976aaaa0e1f90dbb21e9587cdaf1d9679a1cde8875c0d6bd83ab96a208352" dependencies = [ "memchr", ] @@ -10777,7 +10788,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.57", + "syn 2.0.58", ] [[package]] @@ -10797,7 +10808,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.57", + "syn 2.0.58", ] [[package]] diff --git a/build.rs b/build.rs index b8ae851..5a7bb97 100644 --- a/build.rs +++ b/build.rs @@ -36,11 +36,50 @@ fn main() { config }) - .with_crate(crate_dir) + .with_crate(crate_dir.clone()) .generate() .expect("Unable to generate bindings") .write_to_file("dojo.h"); + cbindgen::Builder::new() + .with_config({ + let mut config = cbindgen::Config::default(); + + config.language = cbindgen::Language::Cxx; + config.braces = cbindgen::Braces::SameLine; + config.style = cbindgen::Style::Both; + config.layout = cbindgen::LayoutConfig { + ..Default::default() + }; + config.enumeration = cbindgen::EnumConfig { + derive_helper_methods: true, + // prefix_with_name: true, + ..Default::default() + }; + config.export = cbindgen::ExportConfig { + mangle: cbindgen::MangleConfig { + remove_underscores: true, + ..Default::default() + }, + ..Default::default() + }; + + // config.structure.derive_constructor = true; + // config.structure.derive_eq = true; + + config.defines = HashMap::new(); + config.defines.insert( + "target_pointer_width = 32".to_string(), + "TARGET_POINTER_WIDTH_32".to_string(), + ); + + config + }) + .with_crate(crate_dir.clone()) + .generate() + .expect("Unable to generate bindings") + .write_to_file("dojo.hpp"); + // NOTE: disable for now. use c2cs to generate csharp bindings // generics not supported // csbindgen::Builder::default() diff --git a/dojo.hpp b/dojo.hpp new file mode 100644 index 0000000..1d38b7f --- /dev/null +++ b/dojo.hpp @@ -0,0 +1,847 @@ +#include +#include +#include +#include +#include + +enum class BlockTag { + Latest, + Pending, +}; + +enum class ComparisonOperator { + Eq, + Neq, + Gt, + Gte, + Lt, + Lte, +}; + +enum class LogicalOperator { + And, + Or, +}; + +struct Account; + +struct Provider; + +struct ToriiClient; + +struct Error { + char *message; +}; + +template +struct Result { + enum class Tag { + Ok, + Err, + }; + + struct Ok_Body { + T _0; + }; + + struct Err_Body { + Error _0; + }; + + Tag tag; + union { + Ok_Body ok; + Err_Body err; + }; + + static Result Ok(const T &_0) { + Result result; + ::new (&result.ok._0) (T)(_0); + result.tag = Tag::Ok; + return result; + } + + bool IsOk() const { + return tag == Tag::Ok; + } + + static Result Err(const Error &_0) { + Result result; + ::new (&result.err._0) (Error)(_0); + result.tag = Tag::Err; + return result; + } + + bool IsErr() const { + return tag == Tag::Err; + } +}; + +template +struct CArray { + T *data; + uintptr_t data_len; +}; + +struct KeysClause { + const char *model; + CArray keys; +}; + +struct FieldElement { + uint8_t data[32]; +}; + +struct Signature { + /// The `r` value of a signature + FieldElement r; + /// The `s` value of a signature + FieldElement s; +}; + +struct Primitive { + enum class Tag { + U8, + U16, + U32, + U64, + U128, +#if !defined(TARGET_POINTER_WIDTH_32) + U256, +#endif +#if defined(TARGET_POINTER_WIDTH_32) + U256, +#endif + USize, + Bool, + Felt252, + ClassHash, + ContractAddress, + }; + + struct U8_Body { + uint8_t _0; + }; + + struct U16_Body { + uint16_t _0; + }; + + struct U32_Body { + uint32_t _0; + }; + + struct U64_Body { + uint64_t _0; + }; + + struct U128_Body { + uint8_t _0[16]; + }; + +#if !defined(TARGET_POINTER_WIDTH_32) + struct U256_Body { + uint64_t _0[4]; + }; +#endif + +#if defined(TARGET_POINTER_WIDTH_32) + struct U256_Body { + uint32_t _0[8]; + }; +#endif + + struct USize_Body { + uint32_t _0; + }; + + struct Bool_Body { + bool _0; + }; + + struct Felt252_Body { + FieldElement _0; + }; + + struct ClassHash_Body { + FieldElement _0; + }; + + struct ContractAddress_Body { + FieldElement _0; + }; + + Tag tag; + union { + U8_Body u8; + U16_Body u16; + U32_Body u32; + U64_Body u64; + U128_Body u128; +#if !defined(TARGET_POINTER_WIDTH_32) + U256_Body u256; +#endif +#if defined(TARGET_POINTER_WIDTH_32) + U256_Body u256; +#endif + USize_Body u_size; + Bool_Body bool_; + Felt252_Body felt252; + ClassHash_Body class_hash; + ContractAddress_Body contract_address; + }; + + static Primitive U8(const uint8_t &_0) { + Primitive result; + ::new (&result.u8._0) (uint8_t)(_0); + result.tag = Tag::U8; + return result; + } + + bool IsU8() const { + return tag == Tag::U8; + } + + static Primitive U16(const uint16_t &_0) { + Primitive result; + ::new (&result.u16._0) (uint16_t)(_0); + result.tag = Tag::U16; + return result; + } + + bool IsU16() const { + return tag == Tag::U16; + } + + static Primitive U32(const uint32_t &_0) { + Primitive result; + ::new (&result.u32._0) (uint32_t)(_0); + result.tag = Tag::U32; + return result; + } + + bool IsU32() const { + return tag == Tag::U32; + } + + static Primitive U64(const uint64_t &_0) { + Primitive result; + ::new (&result.u64._0) (uint64_t)(_0); + result.tag = Tag::U64; + return result; + } + + bool IsU64() const { + return tag == Tag::U64; + } + + static Primitive U128(const uint8_t (&_0)[16]) { + Primitive result; + for (int i = 0; i < 16; i++) { + ::new (&result.u128._0[i]) (uint8_t)(_0[i]); + } + result.tag = Tag::U128; + return result; + } + + bool IsU128() const { + return tag == Tag::U128; + } + +#if !defined(TARGET_POINTER_WIDTH_32) + static Primitive U256(const uint64_t (&_0)[4]) { + Primitive result; + for (int i = 0; i < 4; i++) { + ::new (&result.u256._0[i]) (uint64_t)(_0[i]); + } + result.tag = Tag::U256; + return result; + } + + bool IsU256() const { + return tag == Tag::U256; + } +#endif + +#if defined(TARGET_POINTER_WIDTH_32) + static Primitive U256(const uint32_t (&_0)[8]) { + Primitive result; + for (int i = 0; i < 8; i++) { + ::new (&result.u256._0[i]) (uint32_t)(_0[i]); + } + result.tag = Tag::U256; + return result; + } + + bool IsU256() const { + return tag == Tag::U256; + } +#endif + + static Primitive USize(const uint32_t &_0) { + Primitive result; + ::new (&result.u_size._0) (uint32_t)(_0); + result.tag = Tag::USize; + return result; + } + + bool IsUSize() const { + return tag == Tag::USize; + } + + static Primitive Bool(const bool &_0) { + Primitive result; + ::new (&result.bool_._0) (bool)(_0); + result.tag = Tag::Bool; + return result; + } + + bool IsBool() const { + return tag == Tag::Bool; + } + + static Primitive Felt252(const FieldElement &_0) { + Primitive result; + ::new (&result.felt252._0) (FieldElement)(_0); + result.tag = Tag::Felt252; + return result; + } + + bool IsFelt252() const { + return tag == Tag::Felt252; + } + + static Primitive ClassHash(const FieldElement &_0) { + Primitive result; + ::new (&result.class_hash._0) (FieldElement)(_0); + result.tag = Tag::ClassHash; + return result; + } + + bool IsClassHash() const { + return tag == Tag::ClassHash; + } + + static Primitive ContractAddress(const FieldElement &_0) { + Primitive result; + ::new (&result.contract_address._0) (FieldElement)(_0); + result.tag = Tag::ContractAddress; + return result; + } + + bool IsContractAddress() const { + return tag == Tag::ContractAddress; + } +}; + +struct Member { + const char *name; + Ty *ty; + bool key; +}; + +struct Struct { + const char *name; + CArray children; +}; + +struct EnumOption { + const char *name; + Ty *ty; +}; + +struct Enum { + const char *name; + uint8_t option; + CArray options; +}; + +struct Ty { + enum class Tag { + Primitive_, + Struct_, + Enum_, + Tuple_, + }; + + struct Primitive__Body { + Primitive _0; + }; + + struct Struct__Body { + Struct _0; + }; + + struct Enum__Body { + Enum _0; + }; + + struct Tuple__Body { + CArray _0; + }; + + Tag tag; + union { + Primitive__Body primitive; + Struct__Body struct_; + Enum__Body enum_; + Tuple__Body tuple; + }; + + static Ty Primitive_(const Primitive &_0) { + Ty result; + ::new (&result.primitive._0) (Primitive)(_0); + result.tag = Tag::Primitive_; + return result; + } + + bool IsPrimitive_() const { + return tag == Tag::Primitive_; + } + + static Ty Struct_(const Struct &_0) { + Ty result; + ::new (&result.struct_._0) (Struct)(_0); + result.tag = Tag::Struct_; + return result; + } + + bool IsStruct_() const { + return tag == Tag::Struct_; + } + + static Ty Enum_(const Enum &_0) { + Ty result; + ::new (&result.enum_._0) (Enum)(_0); + result.tag = Tag::Enum_; + return result; + } + + bool IsEnum_() const { + return tag == Tag::Enum_; + } + + static Ty Tuple_(const CArray &_0) { + Ty result; + ::new (&result.tuple._0) (CArray)(_0); + result.tag = Tag::Tuple_; + return result; + } + + bool IsTuple_() const { + return tag == Tag::Tuple_; + } +}; + +template +struct COption { + enum class Tag { + Some, + None, + }; + + struct Some_Body { + T _0; + }; + + Tag tag; + union { + Some_Body some; + }; + + static COption Some(const T &_0) { + COption result; + ::new (&result.some._0) (T)(_0); + result.tag = Tag::Some; + return result; + } + + bool IsSome() const { + return tag == Tag::Some; + } + + static COption None() { + COption result; + result.tag = Tag::None; + return result; + } + + bool IsNone() const { + return tag == Tag::None; + } +}; + +struct Model { + const char *name; + CArray members; +}; + +struct Entity { + FieldElement hashed_keys; + CArray models; +}; + +struct ValueType { + enum class Tag { + String, + Int, + UInt, + VBool, + Bytes, + }; + + struct String_Body { + const char *_0; + }; + + struct Int_Body { + int64_t _0; + }; + + struct UInt_Body { + uint64_t _0; + }; + + struct VBool_Body { + bool _0; + }; + + struct Bytes_Body { + CArray _0; + }; + + Tag tag; + union { + String_Body string; + Int_Body int_; + UInt_Body u_int; + VBool_Body v_bool; + Bytes_Body bytes; + }; + + static ValueType String(const char *const &_0) { + ValueType result; + ::new (&result.string._0) (const char*)(_0); + result.tag = Tag::String; + return result; + } + + bool IsString() const { + return tag == Tag::String; + } + + static ValueType Int(const int64_t &_0) { + ValueType result; + ::new (&result.int_._0) (int64_t)(_0); + result.tag = Tag::Int; + return result; + } + + bool IsInt() const { + return tag == Tag::Int; + } + + static ValueType UInt(const uint64_t &_0) { + ValueType result; + ::new (&result.u_int._0) (uint64_t)(_0); + result.tag = Tag::UInt; + return result; + } + + bool IsUInt() const { + return tag == Tag::UInt; + } + + static ValueType VBool(const bool &_0) { + ValueType result; + ::new (&result.v_bool._0) (bool)(_0); + result.tag = Tag::VBool; + return result; + } + + bool IsVBool() const { + return tag == Tag::VBool; + } + + static ValueType Bytes(const CArray &_0) { + ValueType result; + ::new (&result.bytes._0) (CArray)(_0); + result.tag = Tag::Bytes; + return result; + } + + bool IsBytes() const { + return tag == Tag::Bytes; + } +}; + +struct Value { + Primitive primitive_type; + ValueType value_type; +}; + +struct MemberClause { + const char *model; + const char *member; + ComparisonOperator operator_; + Value value; +}; + +struct CompositeClause { + const char *model; + LogicalOperator operator_; + CArray clauses; +}; + +struct Clause { + enum class Tag { + Keys, + CMember, + Composite, + }; + + struct Keys_Body { + KeysClause _0; + }; + + struct CMember_Body { + MemberClause _0; + }; + + struct Composite_Body { + CompositeClause _0; + }; + + Tag tag; + union { + Keys_Body keys; + CMember_Body c_member; + Composite_Body composite; + }; + + static Clause Keys(const KeysClause &_0) { + Clause result; + ::new (&result.keys._0) (KeysClause)(_0); + result.tag = Tag::Keys; + return result; + } + + bool IsKeys() const { + return tag == Tag::Keys; + } + + static Clause CMember(const MemberClause &_0) { + Clause result; + ::new (&result.c_member._0) (MemberClause)(_0); + result.tag = Tag::CMember; + return result; + } + + bool IsCMember() const { + return tag == Tag::CMember; + } + + static Clause Composite(const CompositeClause &_0) { + Clause result; + ::new (&result.composite._0) (CompositeClause)(_0); + result.tag = Tag::Composite; + return result; + } + + bool IsComposite() const { + return tag == Tag::Composite; + } +}; + +struct Query { + uint32_t limit; + uint32_t offset; + COption clause; +}; + +struct ModelMetadata { + Ty schema; + const char *name; + uint32_t packed_size; + uint32_t unpacked_size; + FieldElement class_hash; + FieldElement contract_address; + CArray layout; +}; + +template +struct CHashItem { + K key; + V value; +}; + +struct WorldMetadata { + FieldElement world_address; + FieldElement world_class_hash; + CArray> models; +}; + +struct Call { + const char *to; + const char *selector; + CArray calldata; +}; + +/// Block hash, number or tag +struct BlockId { + enum class Tag { + Hash, + Number, + BlockTag_, + }; + + struct Hash_Body { + FieldElement _0; + }; + + struct Number_Body { + uint64_t _0; + }; + + struct BlockTag__Body { + BlockTag _0; + }; + + Tag tag; + union { + Hash_Body hash; + Number_Body number; + BlockTag__Body block_tag; + }; + + static BlockId Hash(const FieldElement &_0) { + BlockId result; + ::new (&result.hash._0) (FieldElement)(_0); + result.tag = Tag::Hash; + return result; + } + + bool IsHash() const { + return tag == Tag::Hash; + } + + static BlockId Number(const uint64_t &_0) { + BlockId result; + ::new (&result.number._0) (uint64_t)(_0); + result.tag = Tag::Number; + return result; + } + + bool IsNumber() const { + return tag == Tag::Number; + } + + static BlockId BlockTag_(const BlockTag &_0) { + BlockId result; + ::new (&result.block_tag._0) (BlockTag)(_0); + result.tag = Tag::BlockTag_; + return result; + } + + bool IsBlockTag_() const { + return tag == Tag::BlockTag_; + } +}; + +extern "C" { + +Result client_new(const char *torii_url, + const char *rpc_url, + const char *libp2p_relay_url, + const char *world, + const KeysClause *entities, + uintptr_t entities_len); + +Result> client_publish_message(ToriiClient *client, + const char *message, + Signature signature); + +Result> client_model(ToriiClient *client, const KeysClause *keys); + +Result> client_entities(ToriiClient *client, const Query *query); + +CArray client_subscribed_models(ToriiClient *client); + +WorldMetadata client_metadata(ToriiClient *client); + +Result client_add_models_to_sync(ToriiClient *client, + const KeysClause *models, + uintptr_t models_len); + +Result client_on_sync_model_update(ToriiClient *client, KeysClause model, void (*callback)()); + +Result client_on_entity_state_update(ToriiClient *client, + FieldElement *entities, + uintptr_t entities_len, + void (*callback)(FieldElement, CArray)); + +Result client_remove_models_to_sync(ToriiClient *client, + const KeysClause *models, + uintptr_t models_len); + +Result typed_data_encode(const char *typed_data, FieldElement address); + +FieldElement signing_key_new(); + +Result signing_key_sign(FieldElement private_key, FieldElement hash); + +FieldElement verifying_key_new(FieldElement signing_key); + +Result verifying_key_verify(FieldElement verifying_key, + FieldElement hash, + Signature signature); + +Result provider_new(const char *rpc_url); + +Result account_new(Provider *rpc, FieldElement private_key, const char *address); + +Result> starknet_call(Provider *provider, Call call, BlockId block_id); + +Result account_deploy_burner(Provider *provider, + Account *master_account, + FieldElement signing_key); + +FieldElement account_address(Account *account); + +FieldElement account_chain_id(Account *account); + +void account_set_block_id(Account *account, BlockId block_id); + +Result account_execute_raw(Account *account, + const Call *calldata, + uintptr_t calldata_len); + +Result wait_for_transaction(Provider *rpc, FieldElement txn_hash); + +FieldElement hash_get_contract_address(FieldElement class_hash, + FieldElement salt, + const FieldElement *constructor_calldata, + uintptr_t constructor_calldata_len, + FieldElement deployer_address); + +void client_free(ToriiClient *t); + +void provider_free(Provider *rpc); + +void model_free(Model *model); + +void account_free(Account *account); + +void ty_free(Ty *ty); + +void entity_free(Entity *entity); + +void error_free(Error *error); + +void world_metadata_free(WorldMetadata *metadata); + +void carray_free(void *data, uintptr_t data_len); + +void string_free(char *string); + +} // extern "C" From 41acd29834fe34a6e9d4c71c6d08dc0d711e8dc5 Mon Sep 17 00:00:00 2001 From: Nasr Date: Fri, 12 Apr 2024 10:01:09 -0400 Subject: [PATCH 2/3] feat: namespace for cpp bindings --- build.rs | 1 + dojo.hpp | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/build.rs b/build.rs index 5a7bb97..caddd89 100644 --- a/build.rs +++ b/build.rs @@ -66,6 +66,7 @@ fn main() { // config.structure.derive_constructor = true; // config.structure.derive_eq = true; + config.namespace = Some("dojo_bindings".to_string()); config.defines = HashMap::new(); config.defines.insert( diff --git a/dojo.hpp b/dojo.hpp index 1d38b7f..bbc2460 100644 --- a/dojo.hpp +++ b/dojo.hpp @@ -4,6 +4,8 @@ #include #include +namespace dojo_bindings { + enum class BlockTag { Latest, Pending, @@ -845,3 +847,5 @@ void carray_free(void *data, uintptr_t data_len); void string_free(char *string); } // extern "C" + +} // namespace dojo_bindings From 24653697e4fab278ac78c2920ecf30c4f2b9888d Mon Sep 17 00:00:00 2001 From: Nasr Date: Fri, 12 Apr 2024 10:01:27 -0400 Subject: [PATCH 3/3] fmt --- build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.rs b/build.rs index caddd89..93abf15 100644 --- a/build.rs +++ b/build.rs @@ -41,7 +41,7 @@ fn main() { .expect("Unable to generate bindings") .write_to_file("dojo.h"); - cbindgen::Builder::new() + cbindgen::Builder::new() .with_config({ let mut config = cbindgen::Config::default();