diff --git a/docs-test-gen/Cargo.lock b/docs-test-gen/Cargo.lock index 56fabf7b..f4cd255b 100644 --- a/docs-test-gen/Cargo.lock +++ b/docs-test-gen/Cargo.lock @@ -25,15 +25,15 @@ dependencies = [ [[package]] name = "allocator-api2" -version = "0.2.18" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" +checksum = "45862d1c77f2228b9e10bc609d5bc203d86ebc9b87ad8d5d5167a6c9abf739d9" [[package]] name = "anyhow" -version = "1.0.86" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" [[package]] name = "ark-bls12-381" @@ -158,9 +158,9 @@ dependencies = [ [[package]] name = "arrayref" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d151e35f61089500b617991b791fc8bfd237ae50cd5950803758a179b41e67a" +checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" [[package]] name = "arrayvec" @@ -170,9 +170,9 @@ checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "base16ct" @@ -264,9 +264,9 @@ checksum = "3e31ea183f6ee62ac8b8a8cf7feddd766317adfb13ff469de57ce033efd6a790" [[package]] name = "borsh" -version = "1.5.1" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6362ed55def622cddc70a4746a68554d7b687713770de539e59a739b249f8ed" +checksum = "2506947f73ad44e344215ccd6403ac2ae18cd8e046e581a441bf8d199f257f03" dependencies = [ "borsh-derive", "cfg_aliases", @@ -274,16 +274,15 @@ dependencies = [ [[package]] name = "borsh-derive" -version = "1.5.1" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3ef8005764f53cd4dca619f5bf64cafd4664dada50ece25e4d81de54c80cc0b" +checksum = "c2593a3b8b938bd68373196c9832f516be11fa487ef4ae745eb282e6a56a7244" dependencies = [ "once_cell", "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.76", - "syn_derive", + "syn 2.0.89", ] [[package]] @@ -306,9 +305,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.7.1" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" +checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da" dependencies = [ "serde", ] @@ -325,9 +324,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.15" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57b6a275aa2903740dc87da01c62040406b8812552e97129a63ea8850a17c6e6" +checksum = "fd9de9f2205d5ef3fd67e685b0df337994ddd4495e2a28d185500d0e1edfea47" dependencies = [ "shlex", ] @@ -400,15 +399,15 @@ dependencies = [ [[package]] name = "cosmwasm-core" -version = "2.1.3" +version = "2.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d905990ef3afb5753bb709dc7de88e9e370aa32bcc2f31731d4b533b63e82490" +checksum = "5f6ceb8624260d0d3a67c4e1a1d43fc7e9406720afbcb124521501dd138f90aa" [[package]] name = "cosmwasm-crypto" -version = "2.1.3" +version = "2.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b2a7bd9c1dd9a377a4dc0f4ad97d24b03c33798cd5a6d7ceb8869b41c5d2f2d" +checksum = "4125381e5fd7fefe9f614640049648088015eca2b60d861465329a5d87dfa538" dependencies = [ "ark-bls12-381", "ark-ec", @@ -424,49 +423,49 @@ dependencies = [ "rand_core", "rayon", "sha2 0.10.8", - "thiserror", + "thiserror 1.0.69", ] [[package]] name = "cosmwasm-derive" -version = "2.1.3" +version = "2.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "029910b409398fdf81955d7301b906caf81f2c42b013ea074fbd89720229c424" +checksum = "1b5658b1dc64e10b56ae7a449f678f96932a96f6cfad1769d608d1d1d656480a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.89", ] [[package]] name = "cosmwasm-schema" -version = "2.1.3" +version = "2.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bc0d4d85e83438ab9a0fea9348446f7268bc016aacfebce37e998559f151294" +checksum = "f86b4d949b6041519c58993a73f4bbfba8083ba14f7001eae704865a09065845" dependencies = [ "cosmwasm-schema-derive", "schemars", "serde", "serde_json", - "thiserror", + "thiserror 1.0.69", ] [[package]] name = "cosmwasm-schema-derive" -version = "2.1.3" +version = "2.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edf5c8adac41bb7751c050d7c4c18675be19ee128714454454575e894424eeef" +checksum = "c8ef1b5835a65fcca3ab8b9a02b4f4dacc78e233a5c2f20b270efb9db0666d12" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.89", ] [[package]] name = "cosmwasm-std" -version = "2.1.3" +version = "2.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51dec99a2e478715c0a4277f0dbeadbb8466500eb7dec873d0924edd086e77f1" +checksum = "70eb7ab0c1e99dd6207496963ba2a457c4128ac9ad9c72a83f8d9808542b849b" dependencies = [ "base64 0.22.1", "bech32", @@ -482,14 +481,14 @@ dependencies = [ "serde-json-wasm", "sha2 0.10.8", "static_assertions", - "thiserror", + "thiserror 1.0.69", ] [[package]] name = "cpufeatures" -version = "0.2.13" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51e852e6dc9a5bed1fae92dd2375037bf2b768725bf3be87811edee3249d09ad" +checksum = "16b80225097f2e5ae4e7179dd2266824648f3e2f49d9134d584b76389d31c4c3" dependencies = [ "libc", ] @@ -571,7 +570,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.89", ] [[package]] @@ -587,13 +586,33 @@ dependencies = [ "zeroize", ] +[[package]] +name = "cw-multi-test" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1149fe104344cc4f4ca0fc784b7411042fd1626813fe85fd412b05252a0ae9d8" +dependencies = [ + "anyhow", + "bech32", + "cosmwasm-schema", + "cosmwasm-std", + "cw-storage-plus", + "cw-utils", + "itertools 0.13.0", + "prost", + "schemars", + "serde", + "sha2 0.10.8", + "thiserror 2.0.3", +] + [[package]] name = "cw-storage-macro" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f90e7828ea0175c45743178f8b0290513752e949b2fdfa5bda52a7389d732610" dependencies = [ - "syn 2.0.76", + "syn 2.0.89", ] [[package]] @@ -610,9 +629,9 @@ dependencies = [ [[package]] name = "cw-storey" -version = "0.3.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73cc5d79b71429ffc0669b32ec2cf7c5556cec2cf9027ec77ec1c80dbea9b012" +checksum = "913874fdcce32a7ce75de057960300ae19f73190934405ac6641b6a85556f62a" dependencies = [ "cosmwasm-std", "rmp-serde", @@ -620,6 +639,19 @@ dependencies = [ "storey", ] +[[package]] +name = "cw-utils" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07dfee7f12f802431a856984a32bce1cb7da1e6c006b5409e3981035ce562dec" +dependencies = [ + "cosmwasm-schema", + "cosmwasm-std", + "schemars", + "serde", + "thiserror 1.0.69", +] + [[package]] name = "cw2" version = "2.0.0" @@ -632,7 +664,7 @@ dependencies = [ "schemars", "semver", "serde", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -656,7 +688,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.76", + "syn 2.0.89", ] [[package]] @@ -667,7 +699,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn 2.0.76", + "syn 2.0.89", ] [[package]] @@ -702,33 +734,33 @@ dependencies = [ [[package]] name = "derive_builder" -version = "0.20.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd33f37ee6a119146a1781d3356a7c26028f83d779b2e04ecd45fdc75c76877b" +checksum = "507dfb09ea8b7fa618fcf76e953f4f5e192547945816d5358edffe39f6f94947" dependencies = [ "derive_builder_macro", ] [[package]] name = "derive_builder_core" -version = "0.20.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7431fa049613920234f22c47fdc33e6cf3ee83067091ea4277a3f8c4587aae38" +checksum = "2d5bcf7b024d6835cfb3d473887cd966994907effbe9227e8c8219824d06c4e8" dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.89", ] [[package]] name = "derive_builder_macro" -version = "0.20.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4abae7035bf79b9877b779505d8cf3749285b80c43941eda66604841889451dc" +checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c" dependencies = [ "derive_builder_core", - "syn 2.0.76", + "syn 2.0.89", ] [[package]] @@ -739,7 +771,7 @@ checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.89", ] [[package]] @@ -759,7 +791,7 @@ checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.89", "unicode-xid", ] @@ -798,7 +830,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.89", ] [[package]] @@ -812,6 +844,7 @@ dependencies = [ "cosmwasm-std", "cw-storage-plus", "cw-storey", + "cw-utils", "cw2", "glob", "ibc", @@ -821,7 +854,7 @@ dependencies = [ "sha2 0.10.8", "strum", "sylvia", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -968,9 +1001,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" dependencies = [ "futures-channel", "futures-core", @@ -982,9 +1015,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", "futures-sink", @@ -992,33 +1025,33 @@ 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-io" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[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-sink", @@ -1085,6 +1118,12 @@ dependencies = [ "allocator-api2", ] +[[package]] +name = "hashbrown" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" + [[package]] name = "heck" version = "0.5.0" @@ -1574,7 +1613,7 @@ checksum = "2f0eb1d08a424a2d714652aca4c2738a016c90f4eb78f6f64913f9fe2c77fe34" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.89", ] [[package]] @@ -1598,9 +1637,9 @@ dependencies = [ [[package]] name = "ibc-proto" -version = "0.47.0" +version = "0.47.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1678333cf68c9094ca66aaf9a271269f1f6bf5c26881161def8bd88cee831a23" +checksum = "c852d22b782d2d793f4a646f968de419be635e02bc8798d5d74a6e44eef27733" dependencies = [ "base64 0.22.1", "borsh", @@ -1662,23 +1701,23 @@ dependencies = [ [[package]] name = "impl-trait-for-tuples" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" +checksum = "a0eb5a3343abf848c0984fe4604b2b105da9539376e24fc0a3b0007411ae4fd9" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.89", ] [[package]] name = "indexmap" -version = "2.4.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93ead53efc7ea8ed3cfb0c79fc8023fbb782a5432b52830b6518941cebe6505c" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" dependencies = [ "equivalent", - "hashbrown 0.14.5", + "hashbrown 0.15.2", ] [[package]] @@ -1711,15 +1750,15 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.11" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" +checksum = "540654e97a3f4470a492cd30ff187bc95d89557a903a2bbf112e2fae98104ef2" [[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", @@ -1738,9 +1777,9 @@ dependencies = [ [[package]] name = "konst" -version = "0.3.9" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50a0ba6de5f7af397afff922f22c149ff605c766cd3269cf6c1cd5e466dbe3b9" +checksum = "b65f00fb3910881e52bf0850ae2a82aea411488a557e1c02820ceaa60963dce3" dependencies = [ "const_panic", "konst_kernel", @@ -1750,24 +1789,24 @@ dependencies = [ [[package]] name = "konst_kernel" -version = "0.3.9" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be0a455a1719220fd6adf756088e1c69a85bf14b6a9e24537a5cc04f503edb2b" +checksum = "599c1232f55c72c7fc378335a3efe1c878c92720838c8e6a4fd87784ef7764de" dependencies = [ "typewit", ] [[package]] name = "konst_proc_macros" -version = "0.3.0" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e28ab1dc35e09d60c2b8c90d12a9a8d9666c876c10a3739a3196db0103b6043" +checksum = "00af7901ba50898c9e545c24d5c580c96a982298134e8037d8978b6594782c07" [[package]] name = "libc" -version = "0.2.158" +version = "0.2.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" +checksum = "433bfe06b8c75da9b2e3fbea6e5329ff87748f0b144ef75306e674c3f6f7c13f" [[package]] name = "log" @@ -1823,9 +1862,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.19.0" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "opaque-debug" @@ -1847,28 +1886,29 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "3.6.12" +version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "306800abfa29c7f16596b5970a588435e3d5b3149683d00c12b699cc19f895ee" +checksum = "8be4817d39f3272f69c59fe05d0535ae6456c2dc2fa1ba02910296c7e0a5c590" dependencies = [ "arrayvec", "bitvec", "byte-slice-cast", "impl-trait-for-tuples", "parity-scale-codec-derive", + "rustversion", "serde", ] [[package]] name = "parity-scale-codec-derive" -version = "3.6.12" +version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d830939c76d294956402033aee57a6da7b438f2294eb94864c37b0569053a42c" +checksum = "8781a75c6205af67215f382092b6e0a4ff3734798523e69073d4bcd294ec767b" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.89", ] [[package]] @@ -1907,7 +1947,7 @@ dependencies = [ "phf_shared", "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.89", ] [[package]] @@ -1921,9 +1961,9 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" +checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" [[package]] name = "pin-utils" @@ -2012,18 +2052,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" dependencies = [ "unicode-ident", ] [[package]] name = "prost" -version = "0.13.1" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13db3d3fde688c61e2446b4d843bc27a7e8af269a69440c0308021dc92333cc" +checksum = "7b0487d90e047de87f984913713b85c601c05609aad5b0df4b4573fbf69aa13f" dependencies = [ "bytes", "prost-derive", @@ -2031,22 +2071,22 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.13.1" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18bec9b0adc4eba778b33684b7ba3e7137789434769ee3ce3930463ef904cfca" +checksum = "e9552f850d5f0964a4e4d0bf306459ac29323ddfbae05e35a7c0d35cb0803cc5" dependencies = [ "anyhow", "itertools 0.13.0", "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.89", ] [[package]] name = "prost-types" -version = "0.13.1" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cee5168b05f49d4b0ca581206eb14a7b22fafd963efe729ac48eb03266e25cc2" +checksum = "4759aa0d3a6232fb8dbdb97b61de2c20047c68aca932c7ed76da9d788508d670" dependencies = [ "prost", ] @@ -2118,9 +2158,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.6" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", @@ -2130,9 +2170,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.7" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", @@ -2141,9 +2181,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "rfc6979" @@ -2203,9 +2243,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" +checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" [[package]] name = "ryu" @@ -2215,26 +2255,26 @@ checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "scale-info" -version = "2.11.3" +version = "2.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eca070c12893629e2cc820a9761bedf6ce1dcddc9852984d1dc734b8bd9bd024" +checksum = "346a3b32eba2640d17a9cb5927056b08f3de90f65b72fe09402c2ad07d684d0b" dependencies = [ "cfg-if", - "derive_more 0.99.18", + "derive_more 1.0.0", "parity-scale-codec", "scale-info-derive", ] [[package]] name = "scale-info-derive" -version = "2.11.3" +version = "2.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d35494501194174bda522a32605929eefc9ecf7e0a326c26db1fdd85881eb62" +checksum = "c6630024bf739e2179b91fb424b28898baf819414262c5d376677dbff1fe7ebf" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.89", ] [[package]] @@ -2258,7 +2298,7 @@ dependencies = [ "proc-macro2", "quote", "serde_derive_internals", - "syn 2.0.76", + "syn 2.0.89", ] [[package]] @@ -2282,9 +2322,9 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "serde" -version = "1.0.209" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99fce0ffe7310761ca6bf9faf5115afbc19688edd00171d81b1bb1b116c63e09" +checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" dependencies = [ "serde_derive", ] @@ -2318,13 +2358,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.209" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5831b979fd7b5439637af1752d535ff49f4860c0f341d1baeb6faf0f4242170" +checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.89", ] [[package]] @@ -2335,14 +2375,14 @@ checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.89", ] [[package]] name = "serde_json" -version = "1.0.127" +version = "1.0.133" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8043c06d9f82bd7271361ed64f415fe5e12a77fdb52e573e7f06a516dea329ad" +checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" dependencies = [ "itoa", "memchr", @@ -2358,7 +2398,7 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.89", ] [[package]] @@ -2445,13 +2485,13 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "storey" -version = "0.2.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3293237eab6b555f82aaa7b071fd35edff80ff5599cdb1abb52820fd67ddd3fc" +checksum = "89da67409154d8972ff07b90e563ccbfb902e4aff7d6bdc2e5c1471f5baa826a" dependencies = [ "storey-encoding", "storey-storage", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -2491,7 +2531,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.76", + "syn 2.0.89", ] [[package]] @@ -2517,12 +2557,14 @@ checksum = "734676eb262c623cec13c3155096e08d1f8f29adce39ba17948b18dad1e54142" [[package]] name = "sylvia" -version = "1.2.1" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96e34c4bc8b8847011ca9c1478cfd5f532acb691377bca5fecf748833acffde8" +checksum = "8791876dcc4b99ba55a212c0f4d485bf8b695ea21335b8d2d8e7fe35a55e4e9a" dependencies = [ "cosmwasm-schema", "cosmwasm-std", + "cw-multi-test", + "cw-utils", "derivative", "konst", "schemars", @@ -2534,9 +2576,9 @@ dependencies = [ [[package]] name = "sylvia-derive" -version = "1.2.1" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad349313e23cfe1d54876be195a31b3293ca91ae31754abcf1f908e10812b4e7" +checksum = "89f638b6e9383696b51431197e0bef6d4f03d638131a95f56c3269e60a03203d" dependencies = [ "convert_case", "itertools 0.13.0", @@ -2544,7 +2586,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.89", ] [[package]] @@ -2560,27 +2602,15 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.76" +version = "2.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578e081a14e0cefc3279b0472138c513f37b41a08d5a3cca9b6e4e8ceb6cd525" +checksum = "44d46482f1c1c87acd84dea20c1bf5ebff4c757009ed6bf19cfd36fb10e92c4e" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] -[[package]] -name = "syn_derive" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1329189c02ff984e9736652b1631330da25eaa6bc639089ed4915d25446cbe7b" -dependencies = [ - "proc-macro-error", - "proc-macro2", - "quote", - "syn 2.0.76", -] - [[package]] name = "tap" version = "1.0.1" @@ -2662,22 +2692,42 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.65" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d11abd9594d9b38965ef50805c5e469ca9cc6f197f883f717e0269a3057b3d5" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ - "thiserror-impl", + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c006c85c7651b3cf2ada4584faa36773bd07bac24acfb39f3c431b36d7e667aa" +dependencies = [ + "thiserror-impl 2.0.3", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.89", ] [[package]] name = "thiserror-impl" -version = "1.0.65" +version = "2.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae71770322cbd277e69d762a16c444af02aa0575ac0d174f0b9562d3b37f8602" +checksum = "f077553d607adc1caf65430528a576c757a71ed73944b66ebb58ef2bbd243568" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.89", ] [[package]] @@ -2733,9 +2783,9 @@ checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" [[package]] name = "toml_edit" -version = "0.22.20" +version = "0.22.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" +checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ "indexmap", "toml_datetime", @@ -2783,15 +2833,15 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" [[package]] name = "unicode-normalization" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" +checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" dependencies = [ "tinyvec", ] @@ -2804,9 +2854,9 @@ checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" [[package]] name = "unicode-xid" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "229730647fbc343e3a80e463c1db7f78f3855d3f3739bee0dda773c9a037c90a" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" [[package]] name = "unicode_categories" @@ -2828,9 +2878,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" +checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" dependencies = [ "cfg-if", "once_cell", @@ -2839,24 +2889,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" +checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.89", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" +checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2864,28 +2914,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" +checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.89", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" +checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" [[package]] name = "winnow" -version = "0.6.18" +version = "0.6.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" +checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" dependencies = [ "memchr", ] @@ -2917,7 +2967,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.89", ] [[package]] @@ -2937,5 +2987,5 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.89", ] diff --git a/docs-test-gen/Cargo.toml b/docs-test-gen/Cargo.toml index 5c8a43f6..d6a7916c 100644 --- a/docs-test-gen/Cargo.toml +++ b/docs-test-gen/Cargo.toml @@ -12,9 +12,10 @@ phf = { version = "0.11.2", features = ["macros"] } strum = { version = "0.26.3", features = ["derive"] } [dev-dependencies] -sylvia = "*" +sylvia = { version = "*", features = ["cosmwasm_2_0"] } cw2 = "*" cw-storage-plus = { version = "*", features = ["macro"] } +cw-utils = "*" cosmwasm-schema = "*" cosmwasm-std = { version = "*", features = [ "stargate", diff --git a/docs-test-gen/templates/sylvia/cw_storage_contract.tpl b/docs-test-gen/templates/sylvia/cw_storage_contract.tpl index 57f65ce1..d9acf81d 100644 --- a/docs-test-gen/templates/sylvia/cw_storage_contract.tpl +++ b/docs-test-gen/templates/sylvia/cw_storage_contract.tpl @@ -1,9 +1,11 @@ #![allow(unexpected_cfgs, dead_code, unused_variables, unused_imports)] -use sylvia::cw_std::{Addr, entry_point, Reply, SubMsg, WasmMsg, to_json_binary, DepsMut, Empty, Env, IbcChannelOpenMsg, IbcChannelOpenResponse, Response, StdError, StdResult}; +use sylvia::cw_std::{Addr, Binary, Coin, entry_point, Reply, SubMsg, WasmMsg, to_json_binary, DepsMut, Empty, Env, IbcChannelOpenMsg, IbcChannelOpenResponse, Response, StdError, StdResult, SubMsgResult}; use sylvia::{contract, entry_points, interface}; -use sylvia::types::{Remote, InstantiateCtx, QueryCtx, ExecCtx, ReplyCtx, SudoCtx, MigrateCtx}; +use sylvia::types::Remote; +use sylvia::ctx::{InstantiateCtx, QueryCtx, ExecCtx, ReplyCtx, SudoCtx, MigrateCtx}; use sylvia::cw_schema::cw_serde; +use cw_utils::MsgInstantiateContractResponse; use cw_storage_plus::Item; pub mod external_contract { diff --git a/docs-test-gen/templates/sylvia/empty.tpl b/docs-test-gen/templates/sylvia/empty.tpl index 9b9816ae..be55f935 100644 --- a/docs-test-gen/templates/sylvia/empty.tpl +++ b/docs-test-gen/templates/sylvia/empty.tpl @@ -1,15 +1,17 @@ #![allow(unexpected_cfgs, dead_code, unused_variables, unused_imports)] -use sylvia::cw_std::{Addr, entry_point, Reply, SubMsg, WasmMsg, to_json_binary, DepsMut, Empty, Env, IbcChannelOpenMsg, IbcChannelOpenResponse, Response, StdError, StdResult}; +use sylvia::cw_std::{Addr, Binary, Coin, entry_point, Reply, SubMsg, WasmMsg, to_json_binary, DepsMut, Empty, Env, IbcChannelOpenMsg, IbcChannelOpenResponse, Response, StdError, StdResult, SubMsgResult}; use sylvia::{contract, entry_points, interface}; -use sylvia::types::{Remote, InstantiateCtx, QueryCtx, ExecCtx, ReplyCtx, SudoCtx, MigrateCtx}; +use sylvia::types::Remote; +use sylvia::ctx::{InstantiateCtx, QueryCtx, ExecCtx, ReplyCtx, SudoCtx, MigrateCtx}; use sylvia::cw_schema::cw_serde; +use cw_utils::MsgInstantiateContractResponse; use cw_storey::CwStorage; use external_contract::ExternalContract; pub mod external_contract { use sylvia::contract; - use sylvia::types::{InstantiateCtx, ExecCtx}; + use sylvia::ctx::{InstantiateCtx, ExecCtx}; use sylvia::cw_std::{Response, StdResult}; pub struct ExternalContract; diff --git a/docs-test-gen/templates/sylvia/storey_contract.tpl b/docs-test-gen/templates/sylvia/storey_contract.tpl index a79bd580..43cc125a 100644 --- a/docs-test-gen/templates/sylvia/storey_contract.tpl +++ b/docs-test-gen/templates/sylvia/storey_contract.tpl @@ -1,9 +1,11 @@ #![allow(unexpected_cfgs, dead_code, unused_variables, unused_imports)] -use sylvia::cw_std::{Addr, entry_point, Reply, SubMsg, WasmMsg, to_json_binary, DepsMut, Empty, Env, IbcChannelOpenMsg, IbcChannelOpenResponse, Response, StdError, StdResult}; +use sylvia::cw_std::{Addr, Binary, Coin, entry_point, Reply, SubMsg, WasmMsg, to_json_binary, DepsMut, Empty, Env, IbcChannelOpenMsg, IbcChannelOpenResponse, Response, StdError, StdResult, SubMsgResult}; use sylvia::{contract, entry_points, interface}; -use sylvia::types::{Remote, InstantiateCtx, QueryCtx, ExecCtx, ReplyCtx, SudoCtx, MigrateCtx}; +use sylvia::types::Remote; +use sylvia::ctx::{InstantiateCtx, QueryCtx, ExecCtx, ReplyCtx, SudoCtx, MigrateCtx}; use sylvia::cw_schema::cw_serde; +use cw_utils::MsgInstantiateContractResponse; use cw_storey::CwStorage; use cw_storey::containers::Item; diff --git a/src/pages/ibc/diy-protocol/packet-lifecycle.mdx b/src/pages/ibc/diy-protocol/packet-lifecycle.mdx index d0cf5b09..efc64bc0 100644 --- a/src/pages/ibc/diy-protocol/packet-lifecycle.mdx +++ b/src/pages/ibc/diy-protocol/packet-lifecycle.mdx @@ -170,6 +170,9 @@ using the `IbcMsg::WriteAcknowledgement` message. Not acknowledging can lead to problems for the sender of the packet. + + + ```rust filename="ibc.rs" template="core" use cw_storage_plus::Map; @@ -214,6 +217,61 @@ pub fn async_ack( const ACK_LATER: Map<&(u64, String), String> = Map::new("ack_later"); ``` + + + +```rust filename="ibc.rs" template="core" +use cw_storey::containers::{Item, Map}; +use cw_storey::CwStorage; + +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn ibc_packet_receive( + deps: DepsMut, + _env: Env, + msg: IbcPacketReceiveMsg, +) -> StdResult { + // save the data we need for the async acknowledgement in contract state + // note: we are just saving a String here, but you can save any information + // you need for the acknowledgement later + ACK_LATER.access(&mut CwStorage(deps.storage)) + .entry_mut(&msg.packet.sequence) + .entry_mut(&msg.packet.dest.channel_id) + .set(&"ack str".to_string())?; + + // return without an acknowledgement + Ok(IbcReceiveResponse::without_ack()) +} + +/// Called somewhere in the contract to acknowledge the packet +pub fn async_ack( + deps: DepsMut, + env: Env, + info: MessageInfo, + packet_sequence: u64, + channel_id: String, +) -> StdResult { + // load data from contract state + let ack_str = ACK_LATER.access(&CwStorage(deps.storage)) + .entry(&packet_sequence) + .entry(&channel_id) + .try_get() + .map_err(|_| StdError::generic_err("error accessing ACK_LATER"))?; + + // send the acknowledgement + Ok(Response::new().add_message(IbcMsg::WriteAcknowledgement { + packet_sequence, + channel_id, + ack: IbcAcknowledgement::new(StdAck::success(ack_str.as_bytes())), + })) +} + +const ACK_LATER_IX: u8 = 0; +const ACK_LATER: Map>> = Map::new(ACK_LATER_IX); +``` + + + + ## Receiving a packet acknowledgement After the packet has been received and acknowledged by chain B, the relayer will pass the diff --git a/src/pages/storey/containers.mdx b/src/pages/storey/containers.mdx index aefc4497..f3d08cfa 100644 --- a/src/pages/storey/containers.mdx +++ b/src/pages/storey/containers.mdx @@ -19,7 +19,7 @@ For most of your needs, you can likely do what you need to with the built-in con For more advanced use cases, you can build your own containers as described in the [_Implementing new containers_](container-impl) section. -# Namespace +## Namespace To construct a container, you need to provide a single byte. This byte is used to distinguish between different "root" containers in the same storage space. @@ -43,7 +43,33 @@ container. To avoid key collisions, you must provide a different byte to each container. -# Composition +## Accessor + +Every container has a corresponding "accessor" type that is used to perform all read/write +operations. + +To get the accessor of a top-level container, the [`access` method] must be called. It takes a reference +to a storage backend. + +```rust template="storage" +use cw_storey::containers::Item; +use cw_storey::CwStorage; + +let item: Item = Item::new(0); + +item.access(&mut CwStorage(&mut storage)) + .set(&42) + .unwrap(); + +assert_eq!( + item.access(&CwStorage(&storage)) + .get() + .unwrap(), + Some(42) +); +``` + +## Composition Some containers can be composed together to create more complex data structures. Right now, the only built-in container that supports composition is the `Map` container. @@ -99,7 +125,7 @@ assert_eq!( It's possible to define custom containers that enable composition similar to maps. If done properly, they can be mixed with any other containers, including built-in ones. -# Encoding +## Encoding Types like `Item` or `Column` need a way to encode values in a binary store. If you're using the `Item` and `Column` types from `cw-storey`, the [MessagePack](https://msgpack.org/) format is used. @@ -108,3 +134,6 @@ This is a binary encoding that should generally be a storage performance improve If you need to use a different encoding, you can instead import the `Item`/`Column` type from the `storey` crate and specify an alternative encoding. A guide to implementing your encoding can be found in the [_Alternative encodings_](encodings) section. + +[`access` method]: + https://docs.rs/cw-storey/latest/cw_storey/containers/type.Item.html#method.access diff --git a/src/pages/storey/containers/item.mdx b/src/pages/storey/containers/item.mdx index d561b0cd..6f04efbf 100644 --- a/src/pages/storey/containers/item.mdx +++ b/src/pages/storey/containers/item.mdx @@ -5,3 +5,119 @@ tags: ["storey", "containers"] import { Callout } from "nextra/components"; # Item + +An [`Item`] is the simplest container. It stores a single value at a specific key. + +An `Item` that's never been [`set`] is empty, and will return `None` upon a [`get`]. + + + For a more in-depth look at the `Item` container, check out the [API documentation]. + + +## Usage examples + +### Saving an admin address + +Quite often it is necessary for a contract to keep track of who is its "owner" or "admin". In order +to do that, we can store an admin address (usually in instantiation). Later, the address of the +caller can be matched against this address in execution endpoints. + +Here's how to store and manipulate an admin address, or any other simple data. + +```rust template="storage" showLineNumbers {5,9-12,14-16,19} +use cw_storey::containers::Item; +use cw_storey::CwStorage; + +const ADMIN_IX: u8 = 0; + +let admin: Item = Item::new(ADMIN_IX); +let mut cw_storage = CwStorage(&mut storage); + +assert_eq!( + admin.access(&cw_storage).get().unwrap(), + None, +); + +admin.access(&mut cw_storage) + .set(&String::from("some_address")) + .unwrap(); + +assert_eq!( + admin.access(&cw_storage).get().unwrap(), + Some(String::from("some_address")), +); +``` + +- _line 5:_ Here we construct the `Item` facade. The constructor takes a key, which is the key the + data will be stored at in the underlying storage backend. See also + [_Containers - Namespace_](.#namespace). +- _lines 9-12_: This assertion is just to show you the `Item` is empty (`Option::None`) before it's + initialized. +- _lines 14-16_: Here we commit a value to storage. +- _line 19_: Here we retrieve the value from storage. + +### Maintaining a config structure + +It's also common to save a whole struct in an `Item`, with a variety of data. Often the struct +represents a contract's "config". + +```rust template="storage" showLineNumbers {6} +use cw_storey::containers::Item; +use cw_storey::CwStorage; + +const CFG_IX: u8 = 0; + +#[cw_serde] +struct Config { + pub admin: String, + pub interest_rate: Decimal, +} + +let item: Item = Item::new(CFG_IX); +let mut cw_storage = CwStorage(&mut storage); +let mut access = item.access(&mut cw_storage); + +let cfg = Config { + admin: "some_address".to_string(), + interest_rate: Decimal::percent(5), +}; + +access.set(&cfg).unwrap(); +assert_eq!(access.get().unwrap(), Some(cfg)); +``` + +Note the highlighted line. The struct must be encodable. For _CosmWasm_ contracts this generally +means it implements `serde::{Serialize, Deserialize}`. The best idiomatic way to achieve that is by +using the `cosmwasm_schema::cw_serde` macro we provide. + +### Default values + +Sometimes you might like to read a value, but expect to receive a default if it's never been +initialized. This is a common pattern for counters or other numeric values. + +```rust template="storage" showLineNumbers {10} +use cw_storey::containers::Item; +use cw_storey::CwStorage; + +const COUNTER_IX: u8 = 0; + +let counter: Item = Item::new(COUNTER_IX); +let mut cw_storage = CwStorage(&mut storage); +let mut access = counter.access(&mut cw_storage); + +let mut total = access.get().unwrap().unwrap_or(0); + +assert_eq!(total, 0); +total += 1; + +access.set(&total).unwrap(); +``` + +There's no magic here, just +[`Option::unwrap_or`](https://doc.rust-lang.org/std/option/enum.Option.html#method.unwrap_or) at the +highlighted line. This is less a feature of the framework and more a pattern you might find useful. + +[`Item`]: https://docs.rs/cw-storey/latest/cw_storey/containers/type.Item.html +[API documentation]: https://docs.rs/cw-storey/latest/cw_storey/containers/type.Item.html +[`get`]: https://docs.rs/storey/latest/storey/containers/struct.ItemAccess.html#method.get +[`set`]: https://docs.rs/storey/latest/storey/containers/struct.ItemAccess.html#method.set diff --git a/src/pages/sylvia/basics/interoperability.mdx b/src/pages/sylvia/basics/interoperability.mdx index a91d1a03..6dc86feb 100644 --- a/src/pages/sylvia/basics/interoperability.mdx +++ b/src/pages/sylvia/basics/interoperability.mdx @@ -73,11 +73,11 @@ We can also use the generated -```rust {1, 4, 21-23, 29-39, 45-51}, template="sylvia-empty" +```rust {1, 4, 22-24, 30-38, 44-48}, template="sylvia-empty" use external_contract::sv::Executor; use cw_storey::containers::Item; -const SUBMSG_ID: u64 = 1; +use sv::SubMsgMethods; pub struct ReplyContract { remote: Item>, @@ -85,6 +85,7 @@ pub struct ReplyContract { #[entry_points] #[contract] +#[sv::features(replies)] impl ReplyContract { pub fn new() -> Self { Self { @@ -102,29 +103,24 @@ impl ReplyContract { #[sv::msg(exec)] fn exec(&self, ctx: ExecCtx) -> StdResult { - let msg = self + let sub_msg = self .remote .access(&mut CwStorage(ctx.deps.storage)) .get()? .ok_or_else(|| StdError::generic_err("Remote not instantiated"))? .executor() .external_exec()? - .build(); + .build() + .your_reply_handler(42)?; - let sub_msg = SubMsg::reply_on_success(msg, SUBMSG_ID); let resp = Response::new().add_submessage(sub_msg); Ok(resp) } #[sv::msg(reply)] - fn reply(&self, ctx: ReplyCtx, reply: Reply) -> StdResult { - match reply.id { - SUBMSG_ID => { - // Your logic here - Ok(Response::new()) - } - _ => Err(StdError::generic_err("Invalid reply id")), - } + fn your_reply_handler(&self, ctx: ReplyCtx, result: SubMsgResult, your_payload: u64) -> StdResult { + // Your logic here + Ok(Response::new()) } } ``` @@ -132,11 +128,11 @@ impl ReplyContract { -```rust {1, 4, 21-23, 28-37, 42-48}, template="sylvia-empty" +```rust {1, 4, 22-24, 29-35, 41-45}, template="sylvia-empty" use external_contract::sv::Executor; use cw_storage_plus::Item; -const SUBMSG_ID: u64 = 1; +use sv::SubMsgMethods; pub struct ReplyContract { remote: Item>, @@ -144,6 +140,7 @@ pub struct ReplyContract { #[entry_points] #[contract] +#[sv::features(replies)] impl ReplyContract { pub fn new() -> Self { Self { @@ -160,27 +157,22 @@ impl ReplyContract { #[sv::msg(exec)] fn exec(&self, ctx: ExecCtx) -> StdResult { - let msg = self + let sub_msg = self .remote .load(ctx.deps.storage)? .executor() .external_exec()? - .build(); + .build() + .your_reply_handler(42)?; - let sub_msg = SubMsg::reply_on_success(msg, SUBMSG_ID); let resp = Response::new().add_submessage(sub_msg); Ok(resp) } #[sv::msg(reply)] - fn reply(&self, ctx: ReplyCtx, reply: Reply) -> StdResult { - match reply.id { - SUBMSG_ID => { - // Your logic here - Ok(Response::new()) - } - _ => Err(StdError::generic_err("Invalid reply id")), - } + fn your_reply_handler(&self, ctx: ReplyCtx, result: SubMsgResult, your_payload: u64) -> StdResult { + // Your logic here + Ok(Response::new()) } } ``` @@ -197,7 +189,7 @@ method. We can access the -```rust {5-7}, template="sylvia-storey-contract" +```rust {9-11}, template="sylvia-storey-contract" #[sv::msg(query)] fn external_count(&self, ctx: QueryCtx) -> StdResult { let remote = self diff --git a/src/pages/sylvia/macros/attributes/_meta.json b/src/pages/sylvia/macros/attributes/_meta.json index 54a2b66d..c7660295 100644 --- a/src/pages/sylvia/macros/attributes/_meta.json +++ b/src/pages/sylvia/macros/attributes/_meta.json @@ -1,9 +1,12 @@ { + "attr": "Attr", "custom": "Custom", + "data": "Data", "error": "Error", + "features": "Features", "message": "Message", "msg": "Msg", + "msg_attr": "MsgAttr", "override-entry-point": "Override_entry_point", - "attr": "Attr", - "msg_attr": "MsgAttr" + "payload": "Payload" } diff --git a/src/pages/sylvia/macros/attributes/data.mdx b/src/pages/sylvia/macros/attributes/data.mdx new file mode 100644 index 00000000..3b356617 --- /dev/null +++ b/src/pages/sylvia/macros/attributes/data.mdx @@ -0,0 +1,66 @@ +--- +tags: ["sylvia", "attributes"] +--- + +import { Callout } from "nextra/components"; + +# sv::data attribute + +Use `sv::data` to specify if the +[`SubMsgResponse::data`](https://docs.rs/cosmwasm-std/latest/cosmwasm_std/struct.SubMsgResponse.html) +field should be deserialized or not. + + + To use `sv::data` attribute pre Sylvia `2.0.0`, you need to enable the `replies` feature using the + [`sv::features`](features). + + +## Macros + +List of macros supporting the `sv::data` attribute: + +- [`contract`](../contract) +- [`entry_points`](../entry-points) + +## Usage + +```rust {20}, template="sylvia-empty" +pub struct Contract; + +#[cfg_attr(feature = "library", sylvia::entry_points)] +#[contract] +#[sv::features(replies)] +impl Contract { + pub const fn new() -> Self { + Self + } + + #[sv::msg(instantiate)] + fn instantiate(&self, ctx: InstantiateCtx) -> StdResult { + Ok(Response::new()) + } + + #[sv::msg(reply, handlers=[remote_instantiated], reply_on=success)] + fn store_remote_address( + &self, + ctx: ReplyCtx, + #[sv::data(instantiate)] data: MsgInstantiateContractResponse, + #[sv::payload(raw)] payload: Binary, + ) -> StdResult { + Ok(Response::new()) + } +} +``` + +Use the `sv::data` next to the reply method argument. Based on the passed parameters it enables +different behavior: + +| | Deserialize method | `Some(invalid)` | `Some(valid)` | `None` | +| :--------------------------- | :-------------------------------------------------------------------------------------------------------------------: | :-----------------------------: | :-----------------------------------------------------------------------------------------------------------------------------------: | ----------------------------: | +| No `sv::data` | N/A | No `data` forwarded | No `data` forwarded | No `data` forwarded | +| `sv::data(raw)` | N/A | Forwards `Binary` | Forwards `Binary` | Early returns no `data` error | +| `sv::data(raw, opt)` | N/A | Forwards `Option` | Forwards `Option` | Forwards `Option` | +| `sv::data` | [`from_json`](https://docs.rs/cosmwasm-std/latest/cosmwasm_std/fn.from_json.html) | Early returns deserialize error | Forwards deserialized data | Early returns no `data` error | +| `sv::data(opt)` | [`from_json`](https://docs.rs/cosmwasm-std/latest/cosmwasm_std/fn.from_json.html) | Early returns deserialize error | Forwards `Option` | Forwards `None` | +| `sv::data(instantiate)` | [`parse_instantiate_response_data`](https://docs.rs/cw-utils/latest/cw_utils/fn.parse_instantiate_response_data.html) | Early returns deserialize error | Forwards [`MsgInstantiateContractResponse`](https://docs.rs/cw-utils/latest/cw_utils/fn.parse_instantiate_response_data.html) | Early returns no `data` error | +| `sv::data(instantiate, opt)` | [`parse_instantiate_response_data`](https://docs.rs/cw-utils/latest/cw_utils/fn.parse_instantiate_response_data.html) | Early returns deserialize error | Forwards [`Option`](https://docs.rs/cw-utils/latest/cw_utils/fn.parse_instantiate_response_data.html) | Forwards `None` | diff --git a/src/pages/sylvia/macros/attributes/features.mdx b/src/pages/sylvia/macros/attributes/features.mdx new file mode 100644 index 00000000..335ab3a6 --- /dev/null +++ b/src/pages/sylvia/macros/attributes/features.mdx @@ -0,0 +1,55 @@ +--- +tags: ["sylvia", "attributes"] +--- + +import { Callout } from "nextra/components"; + +# `sv::features` attribute + +Use `sv::features` to enable Sylvia features that would be considered semver breaking between minor +releases. + +## Macros + +List of macros supporting the `sv::features` attribute: + +- [`contract`](../contract) +- [`entry_points`](../entry-points) + +## Usage + +```rust {5}, template="sylvia-empty" +pub struct Contract; + +#[cfg_attr(feature = "library", sylvia::entry_points)] +#[contract] +#[sv::features(replies)] +impl Contract { + pub const fn new() -> Self { + Self + } + + #[sv::msg(instantiate)] + fn instantiate(&self, ctx: InstantiateCtx) -> StdResult { + Ok(Response::new()) + } + + #[sv::msg(reply, handlers=[remote_instantiated], reply_on=success)] + fn store_remote_address( + &self, + ctx: ReplyCtx, + #[sv::data(instantiate)] data: MsgInstantiateContractResponse, + #[sv::payload(raw)] payload: Binary, + ) -> StdResult { + Ok(Response::new()) + } +} +``` + +Parameters supported by the `sv::features`: + +- replies - enables better reply handling. This includes: + - Auto dispatching of replies to the correct handler, + - Deserialization of the `data` and `payload` fields, + - Reply id generation. + - [`SubMsg`](https://docs.rs/cosmwasm-std/latest/cosmwasm_std/struct.SubMsg.html) builder trait diff --git a/src/pages/sylvia/macros/attributes/msg.mdx b/src/pages/sylvia/macros/attributes/msg.mdx index 53caa8ce..b888ff0f 100644 --- a/src/pages/sylvia/macros/attributes/msg.mdx +++ b/src/pages/sylvia/macros/attributes/msg.mdx @@ -23,7 +23,7 @@ List of macros supporting the `sv::msg` attribute: ## Usage -```rust, template="sylvia-empty" +```rust template="sylvia-empty" pub struct CounterContract; #[cw_serde] @@ -89,3 +89,105 @@ fn some_query(&self, ctx: QueryCtx) -> SomeResult { Ok(SomeResponse) } ``` + +## Handling replies + + + To use attributes present in this paragraph pre-Sylvia `2.0.0`, you need to enable the `replies` + feature using the [`sv::features`](features) attribute. + + +You can use additional parameters `handlers` and `reply_on` in the `#[sv::msg(reply)]` attribute. + +```rust {1} template="sylvia-cw-storage-contract" +#[sv::msg(reply, handlers=[remote_instantiated], reply_on=success)] +fn store_remote_address( + &self, + ctx: ReplyCtx, + #[sv::data(instantiate, opt)] data: Option, + payload: Option +) -> StdResult { + Ok(Response::new()) +} +``` + + + This approach requires the use of `sylvia::ctx::ReplyCtx` instead of `sylvia::types::ReplyCtx` due + to additional fields added to this type. + + +### The handlers parameter + +The `handlers` parameter allows the list of names of the reply handlers that would be supported by +the contract to be specified. Sylvia takes every unique handler name from across every `reply` +message and generates the **reply IDs**, **dispatching** and `SubMsg` **building methods** for them. +If the `handlers` parameter is not used, the method name is used as the handler name. + +```rust {1} template="sylvia-cw-storage-contract" +#[sv::msg(reply, handlers=[tokens_transfered, tokens_staked])] +fn update_state( + &self, + ctx: ReplyCtx, + result: SubMsgResult, + #[sv::payload(raw)] payload: Binary, +) -> StdResult { + Ok(Response::new()) +} +``` + +### The reply_on parameter + +The `reply_on` parameter specifies in which scenario should the reply method be called. It reflects +the [`cosmwasm_std::ReplyOn`](https://docs.rs/cosmwasm-std/latest/cosmwasm_std/enum.ReplyOn.html) +and it supports values: `success`, `error` and `always`. The `ReplyOn::Never` is not reflected since +creating a reply method that would never be called is counterproductive. If the `reply_on` parameter +is not used, the default value is `always`. + +The same handler name can be used twice across the methods only if one has `reply_on=Success` and +the other one `reply_on=Error`. This way, we can have different handling for **success** and +**error** for the same **reply ID**. + +```rust {1, 5, 11, 15, 21, 25} template="sylvia-cw-storage-contract" +#[sv::msg(reply, handlers=[tokens_transfered], reply_on=success)] +fn update_state( + &self, + ctx: ReplyCtx, + #[sv::data(raw)] data: Binary, + #[sv::payload(raw)] payload: Binary, +) -> StdResult { + Ok(Response::new()) +} + +#[sv::msg(reply, handlers=[tokens_transfered], reply_on=error)] +fn revert_state( + &self, + ctx: ReplyCtx, + error: String, + #[sv::payload(raw)] payload: Binary, +) -> StdResult { + Ok(Response::new()) +} + +#[sv::msg(reply, reply_on=always)] +fn update_or_revert_state( + &self, + ctx: ReplyCtx, + result: SubMsgResult, + #[sv::payload(raw)] payload: Binary, +) -> StdResult { + Ok(Response::new()) +} +``` + +Notice different method parameters depending on the `reply_on` value. On: + +- `success` - + [`SubMsgResponse::data`](https://docs.rs/cosmwasm-std/latest/cosmwasm_std/struct.SubMsgResponse.html) + is being passed as an argument to the method. Depending on the [`sv::data`](data) value, it can + be, among others, forwarded as an `Option` or deserialized to your custom type. +- `error` - + [`SubMsgResult::Err(error)`](https://docs.rs/cosmwasm-std/latest/cosmwasm_std/enum.SubMsgResult.html) + is forwarded as an argument to the method. +- `always` - + [`SubMsgResult`](https://docs.rs/cosmwasm-std/latest/cosmwasm_std/enum.SubMsgResult.html) is + passed as an argument to the method. diff --git a/src/pages/sylvia/macros/attributes/payload.mdx b/src/pages/sylvia/macros/attributes/payload.mdx new file mode 100644 index 00000000..38749178 --- /dev/null +++ b/src/pages/sylvia/macros/attributes/payload.mdx @@ -0,0 +1,84 @@ +--- +tags: ["sylvia", "attributes"] +--- + +import { Callout } from "nextra/components"; + +# sv::payload attribute + +Use `sv::payload` to specify if the +[`SubMsg::payload`](https://docs.rs/cosmwasm-std/latest/cosmwasm_std/struct.SubMsg.html) should be +forwarded as `Binary`. Exactly _ONE_ reply method parameter can be marked with the `sv::payload` +attribute. If missing, Sylvia will deserialize the `payload` to types defined after the `sv::data` +parameter. + + + To use `sv::payload` attribute pre Sylvia `2.0.0`, you need to enable the `replies` feature using + the [`sv::features`](features). + + +## Macros + +List of macros supporting the `sv::data` attribute: + +- [`contract`](../contract) +- [`entry_points`](../entry-points) + +## Usage + +```rust {26, 36, 46-47}, template="sylvia-empty" +#[cw_serde] +pub struct ReplyPayload { + pub receiver: Addr, + pub coins: Coin, +} + +pub struct Contract; + +#[cfg_attr(feature = "library", sylvia::entry_points)] +#[contract] +#[sv::features(replies)] +impl Contract { + pub const fn new() -> Self { + Self + } + + #[sv::msg(instantiate)] + fn instantiate(&self, ctx: InstantiateCtx) -> StdResult { + Ok(Response::new()) + } + + #[sv::msg(reply, reply_on=success)] + fn success_handler( + &self, + ctx: ReplyCtx, + #[sv::payload(raw)] payload: Binary, + ) -> StdResult { + Ok(Response::new()) + } + + #[sv::msg(reply, reply_on=error)] + fn error_handler( + &self, + ctx: ReplyCtx, + error: String, + payload: ReplyPayload, + ) -> StdResult { + Ok(Response::new()) + } + + #[sv::msg(reply, reply_on=always)] + fn always_handler( + &self, + ctx: ReplyCtx, + result: SubMsgResult, + receiver: Addr, + coins: Coin, + ) -> StdResult { + Ok(Response::new()) + } +} +``` + +Sylvia uses the [`from_json`](https://docs.rs/cosmwasm-std/latest/cosmwasm_std/fn.from_json.html) to +deserialize the `payload` field, so it has to be serialized do JSON. diff --git a/src/pages/sylvia/macros/contract.mdx b/src/pages/sylvia/macros/contract.mdx index a18050ef..d0127305 100644 --- a/src/pages/sylvia/macros/contract.mdx +++ b/src/pages/sylvia/macros/contract.mdx @@ -19,11 +19,16 @@ contract messages List of attributes supported by [`contract`](https://docs.rs/sylvia/latest/sylvia/attr.contract.html) macro: +- [`attr`](attributes/attr) - [`custom`](attributes/custom) +- [`data`](attributes/data) - [`error`](attributes/error) +- [`features`](attributes/features) - [`message`](attributes/message) - [`msg`](attributes/msg) +- [`msg_attr`](attributes/msg_attr) - [`override_entry_point`](attributes/override-entry-point) +- [`payload`](attributes/payload) ## Usage @@ -128,8 +133,9 @@ where This is a standard way to create generic structs in Rust. Two important things to mention are: - Rust will complain that generics used in method signatures are unused. You have to create a - `std::marker::PhantomData` field to silence this error. In case a contract uses multiple generic - types, simply wrap them in a tuple `PhantomData<(T1, T2)>`. + [`PhantomData`](https://doc.rust-lang.org/std/marker/struct.PhantomData.html) field to silence + this error. In case a contract uses multiple generic types, simply wrap them in a tuple + `PhantomData<(T1, T2)>`. - If generic types are used as part of the method signature, generated messages will require them to fulfill their trait bounds. In most cases it's enough to add the `sylvia::types::CustomMsg + \'static` bounds. diff --git a/src/pages/sylvia/macros/generated-types/communication.mdx b/src/pages/sylvia/macros/generated-types/communication.mdx index d40a1b90..23de27c5 100644 --- a/src/pages/sylvia/macros/generated-types/communication.mdx +++ b/src/pages/sylvia/macros/generated-types/communication.mdx @@ -107,3 +107,95 @@ impl Executor } } ``` + +## ContractApi implementation + +The [`contract`](../contract) macro generates an implementation of +[`ContractApi`](https://docs.rs/sylvia/latest/sylvia/types/trait.ContractApi.html) on the contract +type. + +This trait was created for internal use of the generated code to ease work with generic contracts. + +We reserve the right to break the API of this trait between minor releases. + +```rust, template="sylvia-empty" +impl sylvia::types::ContractApi for Contract { + type ContractExec = ContractExecMsg; + type ContractQuery = ContractQueryMsg; + type ContractSudo = ContractSudoMsg; + type Exec = ExecMsg; + type Query = QueryMsg; + type Sudo = SudoMsg; + type Instantiate = InstantiateMsg; + type Migrate = sylvia::cw_std::Empty; + type Remote<'remote> = sylvia::types::Remote<'remote, Self>; + type Querier<'querier> = sylvia::types::BoundQuerier<'querier, Empty, Self>; + type CustomMsg = Empty; + type CustomQuery = Empty; +} +``` + +## InterfaceApi implementation + + + This trait will is deprecated and will be removed in the `2.0.0` release in favor of generated + `InterfaceMessagesApi`. + + +The [`interface`](../interface) macro generates an `Api` type and implements the +[`InterfaceApi`](https://docs.rs/sylvia/latest/sylvia/types/trait.InterfaceApi.html) on the it. + +This trait was created for internal use of the generated code to ease working with generic +contracts. + +We reserve the right to break the API of this trait between the minor releases. + +```rust, template="sylvia-empty" +pub struct Api { + _phantom: std::marker::PhantomData<(ExecC, QueryC, CounterT)>, +} + +#[allow(deprecated)] +impl sylvia::types::InterfaceApi for Api +where + ExecC: CustomMsg, + QueryC: CustomQuery, + CounterT: Serialize + DeserializeOwned + std::fmt::Debug, +{ + type Exec = ExecMsg; + type Query = QueryMsg; + type Sudo = SudoMsg; + type Querier<'querier, Contract> = + sylvia::types::BoundQuerier<'querier, sylvia::cw_std::Empty, Contract>; +} +``` + +## InterfaceMessagesApi trait generation + +The [`interface`](../interface) macro generates an `Api` type and implements the +[`InterfaceApi`](https://docs.rs/sylvia/latest/sylvia/types/trait.InterfaceApi.html) on the it. + +This trait was created for internal use of the generated code to ease working with generic +contracts. + +We reserve the right to break the API of this trait between the minor releases. + +```rust, template="sylvia-empty" +pub struct Api { + _phantom: std::marker::PhantomData<(ExecC, QueryC, CounterT)>, +} + +#[allow(deprecated)] +impl sylvia::types::InterfaceApi for Api +where + ExecC: CustomMsg, + QueryC: CustomQuery, + CounterT: Serialize + DeserializeOwned + std::fmt::Debug, +{ + type Exec = ExecMsg; + type Query = QueryMsg; + type Sudo = SudoMsg; + type Querier<'querier, Contract> = + sylvia::types::BoundQuerier<'querier, sylvia::cw_std::Empty, Contract>; +} +```