diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 36520adb..c892d9f2 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -7,7 +7,7 @@ on: merge_group: env: - CARGO_HACK_ARGS: --feature-powerset --exclude-features default --group-features base64,serde,arbitrary,hex + CARGO_HACK_ARGS: --feature-powerset --exclude-features default --group-features base64,serde,serde_json,schemars,arbitrary,hex jobs: diff --git a/.gitignore b/.gitignore index ea8c4bf7..bcd5559c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ /target + +.DS_Store diff --git a/Cargo.lock b/Cargo.lock index 29685c68..b0fe0d77 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -50,6 +50,20 @@ version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" +[[package]] +name = "bindings-js" +version = "0.0.0" +dependencies = [ + "console_error_panic_hook", + "schemars", + "serde-json-wasm", + "serde-wasm-bindgen", + "serde_json", + "stellar-xdr", + "wasm-bindgen", + "wasm-bindgen-test", +] + [[package]] name = "bitflags" version = "1.3.2" @@ -118,7 +132,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.52", ] [[package]] @@ -137,6 +151,16 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "console_error_panic_hook" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" +dependencies = [ + "cfg-if", + "wasm-bindgen", +] + [[package]] name = "core-foundation-sys" version = "0.8.3" @@ -219,7 +243,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.15", + "syn 2.0.52", ] [[package]] @@ -230,7 +254,7 @@ checksum = "7bfb82b62b1b8a2a9808fb4caf844ede819a76cfc23b2827d7f94eefb49551eb" dependencies = [ "darling_core", "quote", - "syn 2.0.15", + "syn 2.0.52", ] [[package]] @@ -244,6 +268,12 @@ dependencies = [ "syn 1.0.98", ] +[[package]] +name = "dyn-clone" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125" + [[package]] name = "escape-bytes" version = "0.1.1" @@ -326,9 +356,9 @@ checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" [[package]] name = "js-sys" -version = "0.3.60" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" dependencies = [ "wasm-bindgen", ] @@ -393,18 +423,18 @@ checksum = "e82dad04139b71a90c080c8463fe0dc7902db5192d939bd0950f074d014339e1" [[package]] name = "proc-macro2" -version = "1.0.69" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -415,6 +445,36 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" +[[package]] +name = "schemars" +version = "0.8.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45a28f4c49489add4ce10783f7911893516f15afe45d015608d41faca6bc4d29" +dependencies = [ + "dyn-clone", + "schemars_derive", + "serde", + "serde_json", +] + +[[package]] +name = "schemars_derive" +version = "0.8.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c767fd6fa65d9ccf9cf026122c1b555f2ef9a4f0cea69da4d7dbc3e258d30967" +dependencies = [ + "proc-macro2", + "quote", + "serde_derive_internals", + "syn 1.0.98", +] + +[[package]] +name = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + [[package]] name = "scratch" version = "1.0.2" @@ -423,29 +483,60 @@ checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898" [[package]] name = "serde" -version = "1.0.160" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2f3770c8bce3bcda7e149193a069a0f4365bda1fa5cd88e03bca26afc1216c" +checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" dependencies = [ "serde_derive", ] +[[package]] +name = "serde-json-wasm" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f05da0d153dd4595bdffd5099dc0e9ce425b205ee648eb93437ff7302af8c9a5" +dependencies = [ + "serde", +] + +[[package]] +name = "serde-wasm-bindgen" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8302e169f0eddcc139c70f139d19d6467353af16f9fce27e8c30158036a1e16b" +dependencies = [ + "js-sys", + "serde", + "wasm-bindgen", +] + [[package]] name = "serde_derive" -version = "1.0.160" +version = "1.0.197" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.52", +] + +[[package]] +name = "serde_derive_internals" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291a097c63d8497e00160b166a967a4a79c64f3facdd01cbd7502231688d77df" +checksum = "85bf8229e7920a9f636479437026331ce11aa132b4dde37d121944a44d6e5f3c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 1.0.98", ] [[package]] name = "serde_json" -version = "1.0.89" +version = "1.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "020ff22c755c2ed3f8cf162dbb41a7268d934702f3ed3631656ea597e08fc3db" +checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" dependencies = [ "itoa", "ryu", @@ -477,7 +568,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.52", ] [[package]] @@ -501,6 +592,7 @@ dependencies = [ "crate-git-revision", "escape-bytes", "hex", + "schemars", "serde", "serde_json", "serde_with", @@ -527,9 +619,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.15" +version = "2.0.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822" +checksum = "b699d15b36d1f02c3e7c69f8ffef53de37aefae075d8488d4ba1a7788d574a07" dependencies = [ "proc-macro2", "quote", @@ -591,9 +683,9 @@ checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" [[package]] name = "wasm-bindgen" -version = "0.2.83" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -601,24 +693,36 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.83" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 1.0.98", + "syn 2.0.52", "wasm-bindgen-shared", ] +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "wasm-bindgen-macro" -version = "0.2.83" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -626,22 +730,57 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.83" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 1.0.98", + "syn 2.0.52", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.83" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" + +[[package]] +name = "wasm-bindgen-test" +version = "0.3.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9bf62a58e0780af3e852044583deee40983e5886da43a271dd772379987667b" +dependencies = [ + "console_error_panic_hook", + "js-sys", + "scoped-tls", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-bindgen-test-macro", +] + +[[package]] +name = "wasm-bindgen-test-macro" +version = "0.3.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" +checksum = "b7f89739351a2e03cb94beb799d47fb2cac01759b40ec441f7de39b00cbf7ef0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.52", +] + +[[package]] +name = "web-sys" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" +dependencies = [ + "js-sys", + "wasm-bindgen", +] [[package]] name = "winapi" diff --git a/Cargo.toml b/Cargo.toml index 08501c81..d50246db 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,6 +29,7 @@ arbitrary = {version = "1.1.3", features = ["derive"], optional = true} clap = { version = "4.2.4", default-features = false, features = ["std", "derive", "usage", "help"], optional = true } serde_json = { version = "1.0.89", optional = true } thiserror = { version = "1.0.37", optional = true } +schemars = { version = "0.8.16", optional = true } [dev_dependencies] serde_json = "1.0.89" @@ -44,12 +45,32 @@ next = [] base64 = ["std", "dep:base64"] serde = ["alloc", "dep:serde", "dep:serde_with", "hex/serde"] serde_json = ["std", "serde", "dep:serde_json"] +schemars = ["alloc", "serde", "serde_json", "dep:schemars"] arbitrary = ["std", "dep:arbitrary"] hex = [] -# Features for the CLI. -cli = ["std", "curr", "next", "base64", "serde", "serde_json", "dep:clap", "dep:thiserror"] +cli = ["std", "curr", "next", "base64", "serde", "serde_json", "schemars", "dep:thiserror", "dep:clap"] [package.metadata.docs.rs] all-features = true rustdoc-args = ["--cfg", "docs"] + +[workspace] +members = [ + "bindings/js", +] + +[profile.release] +codegen-units = 1 +lto = true + +[profile.dev.package.bindings-js] +opt-level = "z" +debug = 0 +strip = "symbols" + +[profile.release.package.bindings-js] +opt-level = "z" +debug = 0 +strip = "symbols" +debug-assertions = false diff --git a/Makefile b/Makefile index 2e14d4f8..cd7c22c2 100644 --- a/Makefile +++ b/Makefile @@ -4,9 +4,12 @@ CARGO_HACK_ARGS=--feature-powerset --exclude-features default --group-features b CARGO_DOC_ARGS?=--open -XDRGEN_VERSION=e2cac557162d99b12ae73b846cf3d5bfe16636de +XDRGEN_VERSION=736398401ba08dfa8f5fcb577c1d7ed935cc51de +# XDRGEN_LOCAL=1 XDRGEN_TYPES_CUSTOM_STR_IMPL_CURR=PublicKey,AccountId,MuxedAccount,MuxedAccountMed25519,SignerKey,SignerKeyEd25519SignedPayload,NodeId,ScAddress,AssetCode,AssetCode4,AssetCode12 XDRGEN_TYPES_CUSTOM_STR_IMPL_NEXT=PublicKey,AccountId,MuxedAccount,MuxedAccountMed25519,SignerKey,SignerKeyEd25519SignedPayload,NodeId,ScAddress,AssetCode,AssetCode4,AssetCode12 +XDRGEN_TYPES_CUSTOM_JSONSCHEMA_IMPL_CURR=PublicKey,AccountId,MuxedAccount,MuxedAccountMed25519,SignerKey,SignerKeyEd25519SignedPayload,NodeId,ScAddress,AssetCode,AssetCode4,AssetCode12 +XDRGEN_TYPES_CUSTOM_JSONSCHEMA_IMPL_NEXT=PublicKey,AccountId,MuxedAccount,MuxedAccountMed25519,SignerKey,SignerKeyEd25519SignedPayload,NodeId,ScAddress,AssetCode,AssetCode4,AssetCode12 all: build test @@ -17,12 +20,23 @@ build: generate cargo hack clippy $(CARGO_HACK_ARGS) --all-targets cargo hack clippy $(CARGO_HACK_ARGS) --all-targets --release --target wasm32-unknown-unknown +generate-bindings: generate-bindings-js + +generate-bindings-js: + cd bindings/js \ + && rm -fr pkg \ + && wasm-pack build --"$${PROFILE:-dev}" --out-dir pkg --out-name stellar-xdr --target web \ + && json="$$(jq '.name = "stellar-xdr"' pkg/package.json)" \ + && echo "$$contents" > pkg/package.json \ + && rm pkg/.gitignore \ + && ls -lah pkg + doc: cargo test --doc --all-features RUSTDOCFLAGS="--cfg docs" cargo +nightly doc --package stellar-xdr --all-features $(CARGO_DOC_ARGS) install: - cargo install --path . --force --features cli + cargo install --locked --path . --force --features cli readme: cargo readme > README.md @@ -34,16 +48,22 @@ generate: src/curr/generated.rs xdr/curr-version src/next/generated.rs xdr/next- src/curr/generated.rs: $(sort $(wildcard xdr/curr/*.x)) > $@ -ifeq ($(LOCAL_XDRGEN),) +ifeq ($(XDRGEN_LOCAL),) docker run -i --rm -v $$PWD:/wd -w /wd docker.io/library/ruby:latest /bin/bash -c '\ gem install specific_install -v 0.3.8 && \ gem specific_install https://github.com/stellar/xdrgen.git -b $(XDRGEN_VERSION) && \ - xdrgen --language rust --namespace generated --output src/curr --rust-types-custom-str-impl $(XDRGEN_TYPES_CUSTOM_STR_IMPL_CURR) $^ \ + xdrgen --language rust --namespace generated --output src/curr \ + --rust-types-custom-str-impl $(XDRGEN_TYPES_CUSTOM_STR_IMPL_CURR) \ + --rust-types-custom-jsonschema-impl '$(XDRGEN_TYPES_CUSTOM_JSONSCHEMA_IMPL_CURR)' \ + $^ \ ' else docker run -i --rm -v $$PWD/../xdrgen:/xdrgen -v $$PWD:/wd -w /wd docker.io/library/ruby:latest /bin/bash -c '\ pushd /xdrgen && bundle install --deployment && rake install && popd && \ - xdrgen --language rust --namespace generated --output src/curr --rust-types-custom-str-impl $(XDRGEN_TYPES_CUSTOM_STR_IMPL_CURR) $^ \ + xdrgen --language rust --namespace generated --output src/curr \ + --rust-types-custom-str-impl $(XDRGEN_TYPES_CUSTOM_STR_IMPL_CURR) \ + --rust-types-custom-jsonschema-impl '$(XDRGEN_TYPES_CUSTOM_JSONSCHEMA_IMPL_CURR)' \ + $^ \ ' endif rustfmt $@ @@ -53,16 +73,22 @@ xdr/curr-version: $(wildcard .git/modules/xdr/curr/**/*) $(wildcard xdr/curr/*.x src/next/generated.rs: $(sort $(wildcard xdr/next/*.x)) > $@ -ifeq ($(LOCAL_XDRGEN),) +ifeq ($(XDRGEN_LOCAL),) docker run -i --rm -v $$PWD:/wd -w /wd docker.io/library/ruby:latest /bin/bash -c '\ gem install specific_install -v 0.3.8 && \ gem specific_install https://github.com/stellar/xdrgen.git -b $(XDRGEN_VERSION) && \ - xdrgen --language rust --namespace generated --output src/next --rust-types-custom-str-impl $(XDRGEN_TYPES_CUSTOM_STR_IMPL_NEXT) $^ \ + xdrgen --language rust --namespace generated --output src/next \ + --rust-types-custom-str-impl $(XDRGEN_TYPES_CUSTOM_STR_IMPL_NEXT) \ + --rust-types-custom-jsonschema-impl '$(XDRGEN_TYPES_CUSTOM_JSONSCHEMA_IMPL_NEXT)' \ + $^ \ ' else docker run -i --rm -v $$PWD/../xdrgen:/xdrgen -v $$PWD:/wd -w /wd docker.io/library/ruby:latest /bin/bash -c '\ pushd /xdrgen && bundle install --deployment && rake install && popd && \ - xdrgen --language rust --namespace generated --output src/next --rust-types-custom-str-impl $(XDRGEN_TYPES_CUSTOM_STR_IMPL_NEXT) $^ \ + xdrgen --language rust --namespace generated --output src/next \ + --rust-types-custom-str-impl $(XDRGEN_TYPES_CUSTOM_STR_IMPL_NEXT) \ + --rust-types-custom-jsonschema-impl '$(XDRGEN_TYPES_CUSTOM_JSONSCHEMA_IMPL_NEXT)' \ + $^ \ ' endif rustfmt $@ diff --git a/README.md b/README.md index 5ec42dc6..168e0b76 100644 --- a/README.md +++ b/README.md @@ -87,4 +87,14 @@ Parse a `BucketEntry` framed stream from a bucket file: stellar-xdr decode --type BucketEntry --input stream-framed --output json-formatted bucket.xdr ``` +##### Bindings + +The crate has language bindings in other languages, where the crate is +embedded as Wasm: + +###### JavaScript/TypeScript + +The source repositories `bindings/js/pkg` directory contains a prebuilt +bundler (e.g. webpack, etc) compatible npm package. + License: Apache-2.0 diff --git a/bindings/js/Cargo.toml b/bindings/js/Cargo.toml new file mode 100644 index 00000000..d3bdaee9 --- /dev/null +++ b/bindings/js/Cargo.toml @@ -0,0 +1,23 @@ +[package] +name = "bindings-js" +edition = "2021" +publish = false + +[lib] +crate-type = ["cdylib"] + +[features] +default = ["console_error_panic_hook"] + +[dependencies] +wasm-bindgen = "0.2.84" +stellar-xdr = { path = "../..", package = "stellar-xdr", features = ["std", "curr", "base64", "serde", "serde_json", "schemars"]} +schemars = "0.8.16" +serde-wasm-bindgen = "0.6.5" +console_error_panic_hook = { version = "0.1.7", optional = true } +serde-json-wasm = "1.0.1" +serde_json = "1.0.114" + +[dev-dependencies] +wasm-bindgen-test = "0.3.34" + diff --git a/bindings/js/README.md b/bindings/js/README.md new file mode 100644 index 00000000..6b684085 --- /dev/null +++ b/bindings/js/README.md @@ -0,0 +1,84 @@ +
+ +

wasm-pack-template

+ + A template for kick starting a Rust and WebAssembly project using wasm-pack. + +

+ Build Status +

+ +

+ Tutorial + | + Chat +

+ + Built with 🦀🕸 by The Rust and WebAssembly Working Group +
+ +## About + +[**📚 Read this template tutorial! 📚**][template-docs] + +This template is designed for compiling Rust libraries into WebAssembly and +publishing the resulting package to NPM. + +Be sure to check out [other `wasm-pack` tutorials online][tutorials] for other +templates and usages of `wasm-pack`. + +[tutorials]: https://rustwasm.github.io/docs/wasm-pack/tutorials/index.html +[template-docs]: https://rustwasm.github.io/docs/wasm-pack/tutorials/npm-browser-packages/index.html + +## 🚴 Usage + +### 🐑 Use `cargo generate` to Clone this Template + +[Learn more about `cargo generate` here.](https://github.com/ashleygwilliams/cargo-generate) + +``` +cargo generate --git https://github.com/rustwasm/wasm-pack-template.git --name my-project +cd my-project +``` + +### 🛠️ Build with `wasm-pack build` + +``` +wasm-pack build +``` + +### 🔬 Test in Headless Browsers with `wasm-pack test` + +``` +wasm-pack test --headless --firefox +``` + +### 🎁 Publish to NPM with `wasm-pack publish` + +``` +wasm-pack publish +``` + +## 🔋 Batteries Included + +* [`wasm-bindgen`](https://github.com/rustwasm/wasm-bindgen) for communicating + between WebAssembly and JavaScript. +* [`console_error_panic_hook`](https://github.com/rustwasm/console_error_panic_hook) + for logging panic messages to the developer console. +* `LICENSE-APACHE` and `LICENSE-MIT`: most Rust projects are licensed this way, so these are included for you + +## License + +Licensed under either of + +* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) +* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) + +at your option. + +### Contribution + +Unless you explicitly state otherwise, any contribution intentionally +submitted for inclusion in the work by you, as defined in the Apache-2.0 +license, shall be dual licensed as above, without any additional terms or +conditions. diff --git a/bindings/js/pkg/README.md b/bindings/js/pkg/README.md new file mode 100644 index 00000000..6b684085 --- /dev/null +++ b/bindings/js/pkg/README.md @@ -0,0 +1,84 @@ +
+ +

wasm-pack-template

+ + A template for kick starting a Rust and WebAssembly project using wasm-pack. + +

+ Build Status +

+ +

+ Tutorial + | + Chat +

+ + Built with 🦀🕸 by The Rust and WebAssembly Working Group +
+ +## About + +[**📚 Read this template tutorial! 📚**][template-docs] + +This template is designed for compiling Rust libraries into WebAssembly and +publishing the resulting package to NPM. + +Be sure to check out [other `wasm-pack` tutorials online][tutorials] for other +templates and usages of `wasm-pack`. + +[tutorials]: https://rustwasm.github.io/docs/wasm-pack/tutorials/index.html +[template-docs]: https://rustwasm.github.io/docs/wasm-pack/tutorials/npm-browser-packages/index.html + +## 🚴 Usage + +### 🐑 Use `cargo generate` to Clone this Template + +[Learn more about `cargo generate` here.](https://github.com/ashleygwilliams/cargo-generate) + +``` +cargo generate --git https://github.com/rustwasm/wasm-pack-template.git --name my-project +cd my-project +``` + +### 🛠️ Build with `wasm-pack build` + +``` +wasm-pack build +``` + +### 🔬 Test in Headless Browsers with `wasm-pack test` + +``` +wasm-pack test --headless --firefox +``` + +### 🎁 Publish to NPM with `wasm-pack publish` + +``` +wasm-pack publish +``` + +## 🔋 Batteries Included + +* [`wasm-bindgen`](https://github.com/rustwasm/wasm-bindgen) for communicating + between WebAssembly and JavaScript. +* [`console_error_panic_hook`](https://github.com/rustwasm/console_error_panic_hook) + for logging panic messages to the developer console. +* `LICENSE-APACHE` and `LICENSE-MIT`: most Rust projects are licensed this way, so these are included for you + +## License + +Licensed under either of + +* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) +* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) + +at your option. + +### Contribution + +Unless you explicitly state otherwise, any contribution intentionally +submitted for inclusion in the work by you, as defined in the Apache-2.0 +license, shall be dual licensed as above, without any additional terms or +conditions. diff --git a/bindings/js/pkg/package.json b/bindings/js/pkg/package.json new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/bindings/js/pkg/package.json @@ -0,0 +1 @@ + diff --git a/bindings/js/pkg/stellar-xdr.d.ts b/bindings/js/pkg/stellar-xdr.d.ts new file mode 100644 index 00000000..9ed08cd0 --- /dev/null +++ b/bindings/js/pkg/stellar-xdr.d.ts @@ -0,0 +1,87 @@ +/* tslint:disable */ +/* eslint-disable */ +/** +* Returns a list of XDR types. +* @returns {(string)[]} +*/ +export function types(): (string)[]; +/** +* Returns the JSON Schema for an XDR type. +* +* JSON Schema version Draft 7 is returned. +* @param {string} type_variant +* @returns {string} +*/ +export function schema(type_variant: string): string; +/** +* Identifies which XDR types the given XDR can decode to completely. +* +* Supports single XDR values only, not arrays, streams, or framed streams. +* @param {string} xdr_base64 +* @returns {(string)[]} +*/ +export function guess(xdr_base64: string): (string)[]; +/** +* Decodes the XDR into JSON. +* +* Accepts a XDR base64 string. +* +* Returns a JSON string. +* +* Unstable: The API of this function is unstable and will likely be changed to +* return a JsValue instead of a JSON string. +* @param {string} type_variant +* @param {string} xdr_base64 +* @returns {string} +*/ +export function decode(type_variant: string, xdr_base64: string): string; +/** +* Encodes to XDR from JSON. +* +* Accepts a JSON string. +* +* Returns an XDR base64 string. +* +* Unstable: The API of this function is unstable and will likely be changed to +* accept a JsValue instead of a JSON string. +* @param {string} type_variant +* @param {string} json +* @returns {string} +*/ +export function encode(type_variant: string, json: string): string; + +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly types: (a: number) => void; + readonly schema: (a: number, b: number, c: number) => void; + readonly guess: (a: number, b: number, c: number) => void; + readonly decode: (a: number, b: number, c: number, d: number, e: number) => void; + readonly encode: (a: number, b: number, c: number, d: number, e: number) => void; + readonly __wbindgen_add_to_stack_pointer: (a: number) => number; + readonly __wbindgen_export_0: (a: number, b: number, c: number) => void; + readonly __wbindgen_export_1: (a: number, b: number) => number; + readonly __wbindgen_export_2: (a: number, b: number, c: number, d: number) => number; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + +/** +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and +* for everything else, calls `WebAssembly.instantiate` directly. +* +* @param {InitInput | Promise} module_or_path +* +* @returns {Promise} +*/ +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/bindings/js/pkg/stellar-xdr.js b/bindings/js/pkg/stellar-xdr.js new file mode 100644 index 00000000..0974ec69 --- /dev/null +++ b/bindings/js/pkg/stellar-xdr.js @@ -0,0 +1,392 @@ +let wasm; + +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; + +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); + } + return cachedUint8Memory0; +} + +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); +} + +const heap = new Array(128).fill(undefined); + +heap.push(undefined, null, true, false); + +let heap_next = heap.length; + +function addHeapObject(obj) { + if (heap_next === heap.length) heap.push(heap.length + 1); + const idx = heap_next; + heap_next = heap[idx]; + + if (typeof(heap_next) !== 'number') throw new Error('corrupt heap'); + + heap[idx] = obj; + return idx; +} + +let cachedInt32Memory0 = null; + +function getInt32Memory0() { + if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) { + cachedInt32Memory0 = new Int32Array(wasm.memory.buffer); + } + return cachedInt32Memory0; +} + +let cachedUint32Memory0 = null; + +function getUint32Memory0() { + if (cachedUint32Memory0 === null || cachedUint32Memory0.byteLength === 0) { + cachedUint32Memory0 = new Uint32Array(wasm.memory.buffer); + } + return cachedUint32Memory0; +} + +function getObject(idx) { return heap[idx]; } + +function dropObject(idx) { + if (idx < 132) return; + heap[idx] = heap_next; + heap_next = idx; +} + +function takeObject(idx) { + const ret = getObject(idx); + dropObject(idx); + return ret; +} + +function getArrayJsValueFromWasm0(ptr, len) { + ptr = ptr >>> 0; + const mem = getUint32Memory0(); + const slice = mem.subarray(ptr / 4, ptr / 4 + len); + const result = []; + for (let i = 0; i < slice.length; i++) { + result.push(takeObject(slice[i])); + } + return result; +} +/** +* Returns a list of XDR types. +* @returns {(string)[]} +*/ +export function types() { + try { + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); + wasm.types(retptr); + var r0 = getInt32Memory0()[retptr / 4 + 0]; + var r1 = getInt32Memory0()[retptr / 4 + 1]; + var v1 = getArrayJsValueFromWasm0(r0, r1).slice(); + wasm.__wbindgen_export_0(r0, r1 * 4, 4); + return v1; + } finally { + wasm.__wbindgen_add_to_stack_pointer(16); + } +} + +let WASM_VECTOR_LEN = 0; + +const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } ); + +const encodeString = (typeof cachedTextEncoder.encodeInto === 'function' + ? function (arg, view) { + return cachedTextEncoder.encodeInto(arg, view); +} + : function (arg, view) { + const buf = cachedTextEncoder.encode(arg); + view.set(buf); + return { + read: arg.length, + written: buf.length + }; +}); + +function passStringToWasm0(arg, malloc, realloc) { + + if (typeof(arg) !== 'string') throw new Error(`expected a string argument, found ${typeof(arg)}`); + + if (realloc === undefined) { + const buf = cachedTextEncoder.encode(arg); + const ptr = malloc(buf.length, 1) >>> 0; + getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf); + WASM_VECTOR_LEN = buf.length; + return ptr; + } + + let len = arg.length; + let ptr = malloc(len, 1) >>> 0; + + const mem = getUint8Memory0(); + + let offset = 0; + + for (; offset < len; offset++) { + const code = arg.charCodeAt(offset); + if (code > 0x7F) break; + mem[ptr + offset] = code; + } + + if (offset !== len) { + if (offset !== 0) { + arg = arg.slice(offset); + } + ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0; + const view = getUint8Memory0().subarray(ptr + offset, ptr + len); + const ret = encodeString(arg, view); + if (ret.read !== arg.length) throw new Error('failed to pass whole string'); + offset += ret.written; + ptr = realloc(ptr, len, offset, 1) >>> 0; + } + + WASM_VECTOR_LEN = offset; + return ptr; +} +/** +* Returns the JSON Schema for an XDR type. +* +* JSON Schema version Draft 7 is returned. +* @param {string} type_variant +* @returns {string} +*/ +export function schema(type_variant) { + let deferred3_0; + let deferred3_1; + try { + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); + const ptr0 = passStringToWasm0(type_variant, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2); + const len0 = WASM_VECTOR_LEN; + wasm.schema(retptr, ptr0, len0); + var r0 = getInt32Memory0()[retptr / 4 + 0]; + var r1 = getInt32Memory0()[retptr / 4 + 1]; + var r2 = getInt32Memory0()[retptr / 4 + 2]; + var r3 = getInt32Memory0()[retptr / 4 + 3]; + var ptr2 = r0; + var len2 = r1; + if (r3) { + ptr2 = 0; len2 = 0; + throw takeObject(r2); + } + deferred3_0 = ptr2; + deferred3_1 = len2; + return getStringFromWasm0(ptr2, len2); + } finally { + wasm.__wbindgen_add_to_stack_pointer(16); + wasm.__wbindgen_export_0(deferred3_0, deferred3_1, 1); + } +} + +/** +* Identifies which XDR types the given XDR can decode to completely. +* +* Supports single XDR values only, not arrays, streams, or framed streams. +* @param {string} xdr_base64 +* @returns {(string)[]} +*/ +export function guess(xdr_base64) { + try { + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); + const ptr0 = passStringToWasm0(xdr_base64, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2); + const len0 = WASM_VECTOR_LEN; + wasm.guess(retptr, ptr0, len0); + var r0 = getInt32Memory0()[retptr / 4 + 0]; + var r1 = getInt32Memory0()[retptr / 4 + 1]; + var v2 = getArrayJsValueFromWasm0(r0, r1).slice(); + wasm.__wbindgen_export_0(r0, r1 * 4, 4); + return v2; + } finally { + wasm.__wbindgen_add_to_stack_pointer(16); + } +} + +/** +* Decodes the XDR into JSON. +* +* Accepts a XDR base64 string. +* +* Returns a JSON string. +* +* Unstable: The API of this function is unstable and will likely be changed to +* return a JsValue instead of a JSON string. +* @param {string} type_variant +* @param {string} xdr_base64 +* @returns {string} +*/ +export function decode(type_variant, xdr_base64) { + let deferred4_0; + let deferred4_1; + try { + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); + const ptr0 = passStringToWasm0(type_variant, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2); + const len0 = WASM_VECTOR_LEN; + const ptr1 = passStringToWasm0(xdr_base64, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2); + const len1 = WASM_VECTOR_LEN; + wasm.decode(retptr, ptr0, len0, ptr1, len1); + var r0 = getInt32Memory0()[retptr / 4 + 0]; + var r1 = getInt32Memory0()[retptr / 4 + 1]; + var r2 = getInt32Memory0()[retptr / 4 + 2]; + var r3 = getInt32Memory0()[retptr / 4 + 3]; + var ptr3 = r0; + var len3 = r1; + if (r3) { + ptr3 = 0; len3 = 0; + throw takeObject(r2); + } + deferred4_0 = ptr3; + deferred4_1 = len3; + return getStringFromWasm0(ptr3, len3); + } finally { + wasm.__wbindgen_add_to_stack_pointer(16); + wasm.__wbindgen_export_0(deferred4_0, deferred4_1, 1); + } +} + +/** +* Encodes to XDR from JSON. +* +* Accepts a JSON string. +* +* Returns an XDR base64 string. +* +* Unstable: The API of this function is unstable and will likely be changed to +* accept a JsValue instead of a JSON string. +* @param {string} type_variant +* @param {string} json +* @returns {string} +*/ +export function encode(type_variant, json) { + let deferred4_0; + let deferred4_1; + try { + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); + const ptr0 = passStringToWasm0(type_variant, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2); + const len0 = WASM_VECTOR_LEN; + const ptr1 = passStringToWasm0(json, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2); + const len1 = WASM_VECTOR_LEN; + wasm.encode(retptr, ptr0, len0, ptr1, len1); + var r0 = getInt32Memory0()[retptr / 4 + 0]; + var r1 = getInt32Memory0()[retptr / 4 + 1]; + var r2 = getInt32Memory0()[retptr / 4 + 2]; + var r3 = getInt32Memory0()[retptr / 4 + 3]; + var ptr3 = r0; + var len3 = r1; + if (r3) { + ptr3 = 0; len3 = 0; + throw takeObject(r2); + } + deferred4_0 = ptr3; + deferred4_1 = len3; + return getStringFromWasm0(ptr3, len3); + } finally { + wasm.__wbindgen_add_to_stack_pointer(16); + wasm.__wbindgen_export_0(deferred4_0, deferred4_1, 1); + } +} + +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } + } +} + +function __wbg_get_imports() { + const imports = {}; + imports.wbg = {}; + imports.wbg.__wbindgen_string_new = function(arg0, arg1) { + const ret = getStringFromWasm0(arg0, arg1); + return addHeapObject(ret); + }; + imports.wbg.__wbindgen_throw = function(arg0, arg1) { + throw new Error(getStringFromWasm0(arg0, arg1)); + }; + + return imports; +} + +function __wbg_init_memory(imports, maybe_memory) { + +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedInt32Memory0 = null; + cachedUint32Memory0 = null; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); + } + + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); +} + +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('stellar-xdr_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} + +export { initSync } +export default __wbg_init; diff --git a/bindings/js/pkg/stellar-xdr_bg.wasm b/bindings/js/pkg/stellar-xdr_bg.wasm new file mode 100644 index 00000000..ca4eb902 Binary files /dev/null and b/bindings/js/pkg/stellar-xdr_bg.wasm differ diff --git a/bindings/js/pkg/stellar-xdr_bg.wasm.d.ts b/bindings/js/pkg/stellar-xdr_bg.wasm.d.ts new file mode 100644 index 00000000..27a3c40d --- /dev/null +++ b/bindings/js/pkg/stellar-xdr_bg.wasm.d.ts @@ -0,0 +1,12 @@ +/* tslint:disable */ +/* eslint-disable */ +export const memory: WebAssembly.Memory; +export function types(a: number): void; +export function schema(a: number, b: number, c: number): void; +export function guess(a: number, b: number, c: number): void; +export function decode(a: number, b: number, c: number, d: number, e: number): void; +export function encode(a: number, b: number, c: number, d: number, e: number): void; +export function __wbindgen_add_to_stack_pointer(a: number): number; +export function __wbindgen_export_0(a: number, b: number, c: number): void; +export function __wbindgen_export_1(a: number, b: number): number; +export function __wbindgen_export_2(a: number, b: number, c: number, d: number): number; diff --git a/bindings/js/src/lib.rs b/bindings/js/src/lib.rs new file mode 100644 index 00000000..99cf622a --- /dev/null +++ b/bindings/js/src/lib.rs @@ -0,0 +1,79 @@ +mod utils; + +use std::str::FromStr; + +use schemars::gen::SchemaSettings; +use stellar_xdr::curr::{Limits, Type, TypeVariant, WriteXdr}; +use wasm_bindgen::prelude::*; + +/// Returns a list of XDR types. +#[wasm_bindgen] +pub fn types() -> Vec { + TypeVariant::VARIANTS_STR + .iter() + .map(ToString::to_string) + .collect() +} + +/// Returns the JSON Schema for an XDR type. +/// +/// JSON Schema version Draft 7 is returned. +#[wasm_bindgen] +pub fn schema(type_variant: &str) -> Result { + let t = TypeVariant::from_str(type_variant).map_err(|_| format!("unknown type"))?; + let settings = SchemaSettings::draft07(); + let generator = settings.into_generator(); + let schema = t.json_schema(generator); + serde_json_wasm::to_string(&schema).map_err(|e| format!("{e}")) +} + +/// Identifies which XDR types the given XDR can decode to completely. +/// +/// Supports single XDR values only, not arrays, streams, or framed streams. +#[wasm_bindgen] +pub fn guess(xdr_base64: String) -> Vec { + TypeVariant::VARIANTS + .iter() + .filter(|v| Type::from_xdr_base64(**v, &xdr_base64, Limits::none()).is_ok()) + .map(|v| v.name().to_string()) + .collect() +} + +/// Decodes the XDR into JSON. +/// +/// Accepts a XDR base64 string. +/// +/// Returns a JSON string. +/// +/// Unstable: The API of this function is unstable and will likely be changed to +/// return a JsValue instead of a JSON string. +#[wasm_bindgen] +pub fn decode(type_variant: String, xdr_base64: String) -> Result { + let type_variant = TypeVariant::from_str(&type_variant).map_err(|e| format!("{e}"))?; + let value = Type::from_xdr_base64(type_variant, xdr_base64, Limits::none()) + .map_err(|e| format!("{e}"))?; + // TODO: Return a native JS value. + // let js = serde_wasm_bindgen::to_value(&value).map_err(|e| format!("{e}"))?; + let json = serde_json_wasm::to_string(&value).map_err(|e| format!("{e}"))?; + Ok(json) +} + +/// Encodes to XDR from JSON. +/// +/// Accepts a JSON string. +/// +/// Returns an XDR base64 string. +/// +/// Unstable: The API of this function is unstable and will likely be changed to +/// accept a JsValue instead of a JSON string. +#[wasm_bindgen] +pub fn encode(type_variant: String, json: String) -> Result { + let type_variant = TypeVariant::from_str(&type_variant).map_err(|e| format!("{e}"))?; + // TODO: Return a native JS value. + // let t: Type = serde_wasm_bindgen::from_value(js).map_err(|e| format!("{e}"))?; + let t = Type::read_json(type_variant, json.as_bytes()).map_err(|e| format!("{e}"))?; + let b64 = t + .to_xdr_base64(Limits::none()) + .map_err(|e| format!("{e}"))?; + Ok(b64) +} diff --git a/bindings/js/src/utils.rs b/bindings/js/src/utils.rs new file mode 100644 index 00000000..c4be847e --- /dev/null +++ b/bindings/js/src/utils.rs @@ -0,0 +1,11 @@ +#[allow(dead_code)] +pub fn set_panic_hook() { + // When the `console_error_panic_hook` feature is enabled, we can call the + // `set_panic_hook` function at least once during initialization, and then + // we will get better error messages if our code ever panics. + // + // For more details see + // https://github.com/rustwasm/console_error_panic_hook#readme + #[cfg(feature = "console_error_panic_hook")] + console_error_panic_hook::set_once(); +} diff --git a/bindings/js/tests/web.rs b/bindings/js/tests/web.rs new file mode 100644 index 00000000..de5c1daf --- /dev/null +++ b/bindings/js/tests/web.rs @@ -0,0 +1,13 @@ +//! Test suite for the Web and headless browsers. + +#![cfg(target_arch = "wasm32")] + +extern crate wasm_bindgen_test; +use wasm_bindgen_test::*; + +wasm_bindgen_test_configure!(run_in_browser); + +#[wasm_bindgen_test] +fn pass() { + assert_eq!(1 + 1, 2); +} diff --git a/src/bin/stellar-xdr/main.rs b/src/bin/stellar-xdr/main.rs index 78ff30f3..2873708b 100644 --- a/src/bin/stellar-xdr/main.rs +++ b/src/bin/stellar-xdr/main.rs @@ -6,7 +6,10 @@ fn main() { if let Err(e) = cli::run(env::args_os()) { match e { cli::Error::Clap(e) => e.exit(), - cli::Error::Guess(_) | cli::Error::Decode(_) | cli::Error::Encode(_) => { + cli::Error::Types(_) + | cli::Error::Guess(_) + | cli::Error::Decode(_) + | cli::Error::Encode(_) => { Error::raw(clap::error::ErrorKind::ValueValidation, e).exit() } } diff --git a/src/cli/mod.rs b/src/cli/mod.rs index f8da43ad..9db33de0 100644 --- a/src/cli/mod.rs +++ b/src/cli/mod.rs @@ -34,7 +34,7 @@ impl Root { /// If the root command is configured with state that is invalid. pub fn run(&self) -> Result<(), Error> { match &self.cmd { - Cmd::Types(c) => c.run(&self.channel), + Cmd::Types(c) => c.run(&self.channel)?, Cmd::Guess(c) => c.run(&self.channel)?, Cmd::Decode(c) => c.run(&self.channel)?, Cmd::Encode(c) => c.run(&self.channel)?, @@ -77,6 +77,8 @@ pub enum Cmd { pub enum Error { #[error("{0}")] Clap(#[from] clap::Error), + #[error("{0}")] + Types(#[from] types::Error), #[error("error decoding XDR: {0}")] Guess(#[from] guess::Error), #[error("error reading file: {0}")] diff --git a/src/cli/types.rs b/src/cli/types.rs index a0ad2790..893a4c75 100644 --- a/src/cli/types.rs +++ b/src/cli/types.rs @@ -1,9 +1,16 @@ mod list; +mod schema; use clap::{Args, Subcommand}; use crate::cli::Channel; +#[derive(thiserror::Error, Debug)] +pub enum Error { + #[error("{0}")] + SchemaError(#[from] schema::Error), +} + #[derive(Args, Debug, Clone)] #[command()] pub struct Cmd { @@ -14,12 +21,15 @@ pub struct Cmd { #[derive(Subcommand, Clone, Debug)] pub enum Sub { List(list::Cmd), + Schema(schema::Cmd), } impl Cmd { - pub fn run(&self, channel: &Channel) { + pub fn run(&self, channel: &Channel) -> Result<(), Error> { match &self.sub { Sub::List(c) => c.run(channel), + Sub::Schema(c) => c.run(channel)?, } + Ok(()) } } diff --git a/src/cli/types/schema.rs b/src/cli/types/schema.rs new file mode 100644 index 00000000..730ca6c0 --- /dev/null +++ b/src/cli/types/schema.rs @@ -0,0 +1,68 @@ +use clap::{Args, ValueEnum}; +use schemars::gen::SchemaSettings; + +use crate::cli::Channel; + +#[derive(thiserror::Error, Debug)] +pub enum Error { + #[error("unknown type {0}, choose one of {1:?}")] + UnknownType(String, &'static [&'static str]), + #[error("error generating JSON: {0}")] + GenerateJson(#[from] serde_json::Error), +} + +#[derive(Args, Debug, Clone)] +#[command()] +pub struct Cmd { + /// XDR type to decode + #[arg(long)] + r#type: String, + + // Output format + #[arg(long, value_enum, default_value_t)] + output: OutputFormat, +} + +#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, ValueEnum)] +pub enum OutputFormat { + JsonSchemaDraft7, + JsonSchemaDraft201909, +} + +impl Default for OutputFormat { + fn default() -> Self { + Self::JsonSchemaDraft201909 + } +} + +macro_rules! run_x { + ($f:ident, $m:ident) => { + fn $f(&self) -> Result<(), Error> { + use std::str::FromStr; + let r#type = crate::$m::TypeVariant::from_str(&self.r#type).map_err(|_| { + Error::UnknownType(self.r#type.clone(), &crate::$m::TypeVariant::VARIANTS_STR) + })?; + let settings = match self.output { + OutputFormat::JsonSchemaDraft7 => SchemaSettings::draft07(), + OutputFormat::JsonSchemaDraft201909 => SchemaSettings::draft2019_09(), + }; + let generator = settings.into_generator(); + let schema = r#type.json_schema(generator); + println!("{}", serde_json::to_string_pretty(&schema)?); + Ok(()) + } + }; +} + +impl Cmd { + pub fn run(&self, channel: &Channel) -> Result<(), Error> { + match channel { + Channel::Curr => self.run_curr()?, + Channel::Next => self.run_next()?, + } + Ok(()) + } + + run_x!(run_curr, curr); + run_x!(run_next, next); +} diff --git a/src/curr/generated.rs b/src/curr/generated.rs index deabc26b..2acfd47d 100644 --- a/src/curr/generated.rs +++ b/src/curr/generated.rs @@ -956,6 +956,32 @@ impl Default for VecM { } } +#[cfg(feature = "schemars")] +impl schemars::JsonSchema for VecM { + fn schema_name() -> String { + format!("VecM<{}, {}>", T::schema_name(), MAX) + } + + fn is_referenceable() -> bool { + false + } + + fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema { + let schema = Vec::::json_schema(gen); + if let schemars::schema::Schema::Object(mut schema) = schema { + if let Some(array) = schema.array.clone() { + schema.array = Some(Box::new(schemars::schema::ArrayValidation { + max_items: Some(MAX), + ..*array + })); + } + schema.into() + } else { + schema + } + } +} + impl VecM { pub const MAX_LEN: usize = { MAX as usize }; @@ -1391,6 +1417,40 @@ impl Deref for BytesM { } } +#[cfg(feature = "schemars")] +impl schemars::JsonSchema for BytesM { + fn schema_name() -> String { + format!("BytesM<{MAX}>") + } + + fn is_referenceable() -> bool { + false + } + + fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema { + let schema = String::json_schema(gen); + if let schemars::schema::Schema::Object(mut schema) = schema { + schema.extensions.insert( + "contentEncoding".to_owned(), + serde_json::Value::String("hex".to_string()), + ); + schema.extensions.insert( + "contentMediaType".to_owned(), + serde_json::Value::String("application/binary".to_string()), + ); + let string = *schema.string.unwrap_or_default().clone(); + schema.string = Some(Box::new(schemars::schema::StringValidation { + max_length: MAX.checked_mul(2).map(Some).unwrap_or_default(), + min_length: None, + ..string + })); + schema.into() + } else { + schema + } + } +} + impl Default for BytesM { fn default() -> Self { Self(Vec::default()) @@ -1779,6 +1839,27 @@ impl Default for StringM { } } +#[cfg(feature = "schemars")] +impl schemars::JsonSchema for StringM { + fn schema_name() -> String { + format!("StringM<{MAX}>") + } + + fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema { + let schema = String::json_schema(gen); + if let schemars::schema::Schema::Object(mut schema) = schema { + let string = *schema.string.unwrap_or_default().clone(); + schema.string = Some(Box::new(schemars::schema::StringValidation { + max_length: Some(MAX), + ..string + })); + schema.into() + } else { + schema + } + } +} + impl StringM { pub const MAX_LEN: usize = { MAX as usize }; @@ -2095,6 +2176,17 @@ pub struct Frame(pub T) where T: ReadXdr; +#[cfg(feature = "schemars")] +impl schemars::JsonSchema for Frame { + fn schema_name() -> String { + format!("Frame<{}>", T::schema_name()) + } + + fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema { + T::json_schema(gen) + } +} + impl ReadXdr for Frame where T: ReadXdr, @@ -2758,6 +2850,7 @@ mod test { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[derive(Debug)] pub struct Value(pub BytesM); @@ -2866,6 +2959,7 @@ impl AsRef<[u8]> for Value { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScpBallot { pub counter: u32, pub value: Value, @@ -2914,6 +3008,7 @@ impl WriteXdr for ScpBallot { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ScpStatementType { Prepare = 0, @@ -3030,6 +3125,7 @@ impl WriteXdr for ScpStatementType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScpNomination { pub quorum_set_hash: Hash, pub votes: VecM, @@ -3082,6 +3178,7 @@ impl WriteXdr for ScpNomination { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScpStatementPrepare { pub quorum_set_hash: Hash, pub ballot: ScpBallot, @@ -3142,6 +3239,7 @@ impl WriteXdr for ScpStatementPrepare { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScpStatementConfirm { pub ballot: ScpBallot, pub n_prepared: u32, @@ -3197,6 +3295,7 @@ impl WriteXdr for ScpStatementConfirm { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScpStatementExternalize { pub commit: ScpBallot, pub n_h: u32, @@ -3272,6 +3371,7 @@ impl WriteXdr for ScpStatementExternalize { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ScpStatementPledges { Prepare(ScpStatementPrepare), @@ -3426,6 +3526,7 @@ impl WriteXdr for ScpStatementPledges { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScpStatement { pub node_id: NodeId, pub slot_index: u64, @@ -3474,6 +3575,7 @@ impl WriteXdr for ScpStatement { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScpEnvelope { pub statement: ScpStatement, pub signature: Signature, @@ -3520,6 +3622,7 @@ impl WriteXdr for ScpEnvelope { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScpQuorumSet { pub threshold: u32, pub validators: VecM, @@ -3568,6 +3671,7 @@ impl WriteXdr for ScpQuorumSet { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ConfigSettingContractExecutionLanesV0 { pub ledger_max_tx_count: u32, } @@ -3618,6 +3722,7 @@ impl WriteXdr for ConfigSettingContractExecutionLanesV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ConfigSettingContractComputeV0 { pub ledger_max_instructions: i64, pub tx_max_instructions: i64, @@ -3699,6 +3804,7 @@ impl WriteXdr for ConfigSettingContractComputeV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ConfigSettingContractLedgerCostV0 { pub ledger_max_read_ledger_entries: u32, pub ledger_max_read_bytes: u32, @@ -3782,6 +3888,7 @@ impl WriteXdr for ConfigSettingContractLedgerCostV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ConfigSettingContractHistoricalDataV0 { pub fee_historical1_kb: i64, } @@ -3826,6 +3933,7 @@ impl WriteXdr for ConfigSettingContractHistoricalDataV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ConfigSettingContractEventsV0 { pub tx_max_contract_events_size_bytes: u32, pub fee_contract_events1_kb: i64, @@ -3876,6 +3984,7 @@ impl WriteXdr for ConfigSettingContractEventsV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ConfigSettingContractBandwidthV0 { pub ledger_max_txs_size_bytes: u32, pub tx_max_size_bytes: u32, @@ -4021,6 +4130,7 @@ impl WriteXdr for ConfigSettingContractBandwidthV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ContractCostType { WasmInsnExec = 0, @@ -4348,6 +4458,7 @@ impl WriteXdr for ContractCostType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ContractCostParamEntry { pub ext: ExtensionPoint, pub const_term: i64, @@ -4415,6 +4526,7 @@ impl WriteXdr for ContractCostParamEntry { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct StateArchivalSettings { pub max_entry_ttl: u32, pub min_temporary_ttl: u32, @@ -4484,6 +4596,7 @@ impl WriteXdr for StateArchivalSettings { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct EvictionIterator { pub bucket_list_level: u32, pub is_curr_bucket: bool, @@ -4537,6 +4650,7 @@ pub const CONTRACT_COST_COUNT_LIMIT: u64 = 1024; derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[derive(Debug)] pub struct ContractCostParams(pub VecM); @@ -4658,6 +4772,7 @@ impl AsRef<[ContractCostParamEntry]> for ContractCostParams { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ConfigSettingId { ContractMaxSizeBytes = 0, @@ -4855,6 +4970,7 @@ impl WriteXdr for ConfigSettingId { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ConfigSettingEntry { ContractMaxSizeBytes(u32), @@ -5081,6 +5197,7 @@ impl WriteXdr for ConfigSettingEntry { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ScEnvMetaKind { ScEnvMetaKindInterfaceVersion = 0, @@ -5183,6 +5300,7 @@ impl WriteXdr for ScEnvMetaKind { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ScEnvMetaEntry { ScEnvMetaKindInterfaceVersion(u64), @@ -5284,6 +5402,7 @@ impl WriteXdr for ScEnvMetaEntry { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScMetaV0 { pub key: StringM, pub val: StringM, @@ -5329,6 +5448,7 @@ impl WriteXdr for ScMetaV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ScMetaKind { ScMetaV0 = 0, @@ -5431,6 +5551,7 @@ impl WriteXdr for ScMetaKind { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ScMetaEntry { ScMetaV0(ScMetaV0), @@ -5568,6 +5689,7 @@ pub const SC_SPEC_DOC_LIMIT: u64 = 1024; derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ScSpecType { Val = 0, @@ -5792,6 +5914,7 @@ impl WriteXdr for ScSpecType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScSpecTypeOption { pub value_type: Box, } @@ -5834,6 +5957,7 @@ impl WriteXdr for ScSpecTypeOption { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScSpecTypeResult { pub ok_type: Box, pub error_type: Box, @@ -5878,6 +6002,7 @@ impl WriteXdr for ScSpecTypeResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScSpecTypeVec { pub element_type: Box, } @@ -5920,6 +6045,7 @@ impl WriteXdr for ScSpecTypeVec { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScSpecTypeMap { pub key_type: Box, pub value_type: Box, @@ -5964,6 +6090,7 @@ impl WriteXdr for ScSpecTypeMap { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScSpecTypeTuple { pub value_types: VecM, } @@ -6005,6 +6132,7 @@ impl WriteXdr for ScSpecTypeTuple { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScSpecTypeBytesN { pub n: u32, } @@ -6046,6 +6174,7 @@ impl WriteXdr for ScSpecTypeBytesN { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScSpecTypeUdt { pub name: StringM<60>, } @@ -6120,6 +6249,7 @@ impl WriteXdr for ScSpecTypeUdt { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ScSpecTypeDef { Val, @@ -6392,6 +6522,7 @@ impl WriteXdr for ScSpecTypeDef { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScSpecUdtStructFieldV0 { pub doc: StringM<1024>, pub name: StringM<30>, @@ -6442,6 +6573,7 @@ impl WriteXdr for ScSpecUdtStructFieldV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScSpecUdtStructV0 { pub doc: StringM<1024>, pub lib: StringM<80>, @@ -6493,6 +6625,7 @@ impl WriteXdr for ScSpecUdtStructV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScSpecUdtUnionCaseVoidV0 { pub doc: StringM<1024>, pub name: StringM<60>, @@ -6539,6 +6672,7 @@ impl WriteXdr for ScSpecUdtUnionCaseVoidV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScSpecUdtUnionCaseTupleV0 { pub doc: StringM<1024>, pub name: StringM<60>, @@ -6588,6 +6722,7 @@ impl WriteXdr for ScSpecUdtUnionCaseTupleV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ScSpecUdtUnionCaseV0Kind { VoidV0 = 0, @@ -6698,6 +6833,7 @@ impl WriteXdr for ScSpecUdtUnionCaseV0Kind { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ScSpecUdtUnionCaseV0 { VoidV0(ScSpecUdtUnionCaseVoidV0), @@ -6811,6 +6947,7 @@ impl WriteXdr for ScSpecUdtUnionCaseV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScSpecUdtUnionV0 { pub doc: StringM<1024>, pub lib: StringM<80>, @@ -6863,6 +7000,7 @@ impl WriteXdr for ScSpecUdtUnionV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScSpecUdtEnumCaseV0 { pub doc: StringM<1024>, pub name: StringM<60>, @@ -6913,6 +7051,7 @@ impl WriteXdr for ScSpecUdtEnumCaseV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScSpecUdtEnumV0 { pub doc: StringM<1024>, pub lib: StringM<80>, @@ -6965,6 +7104,7 @@ impl WriteXdr for ScSpecUdtEnumV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScSpecUdtErrorEnumCaseV0 { pub doc: StringM<1024>, pub name: StringM<60>, @@ -7015,6 +7155,7 @@ impl WriteXdr for ScSpecUdtErrorEnumCaseV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScSpecUdtErrorEnumV0 { pub doc: StringM<1024>, pub lib: StringM<80>, @@ -7067,6 +7208,7 @@ impl WriteXdr for ScSpecUdtErrorEnumV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScSpecFunctionInputV0 { pub doc: StringM<1024>, pub name: StringM<30>, @@ -7117,6 +7259,7 @@ impl WriteXdr for ScSpecFunctionInputV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScSpecFunctionV0 { pub doc: StringM<1024>, pub name: ScSymbol, @@ -7172,6 +7315,7 @@ impl WriteXdr for ScSpecFunctionV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ScSpecEntryKind { FunctionV0 = 0, @@ -7306,6 +7450,7 @@ impl WriteXdr for ScSpecEntryKind { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ScSpecEntry { FunctionV0(ScSpecFunctionV0), @@ -7489,6 +7634,7 @@ impl WriteXdr for ScSpecEntry { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ScValType { Bool = 0, @@ -7708,6 +7854,7 @@ impl WriteXdr for ScValType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ScErrorType { Contract = 0, @@ -7859,6 +8006,7 @@ impl WriteXdr for ScErrorType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ScErrorCode { ArithDomain = 0, @@ -8020,6 +8168,7 @@ impl WriteXdr for ScErrorCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ScError { Contract(u32), @@ -8177,6 +8326,7 @@ impl WriteXdr for ScError { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct UInt128Parts { pub hi: u64, pub lo: u64, @@ -8221,6 +8371,7 @@ impl WriteXdr for UInt128Parts { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct Int128Parts { pub hi: i64, pub lo: u64, @@ -8267,6 +8418,7 @@ impl WriteXdr for Int128Parts { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct UInt256Parts { pub hi_hi: u64, pub hi_lo: u64, @@ -8319,6 +8471,7 @@ impl WriteXdr for UInt256Parts { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct Int256Parts { pub hi_hi: i64, pub hi_lo: u64, @@ -8371,6 +8524,7 @@ impl WriteXdr for Int256Parts { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ContractExecutableType { Wasm = 0, @@ -8481,6 +8635,7 @@ impl WriteXdr for ContractExecutableType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ContractExecutable { Wasm(Hash), @@ -8589,6 +8744,7 @@ impl WriteXdr for ContractExecutable { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ScAddressType { Account = 0, @@ -8804,6 +8960,7 @@ pub const SCSYMBOL_LIMIT: u64 = 32; derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[derive(Debug)] pub struct ScVec(pub VecM); @@ -8909,6 +9066,7 @@ impl AsRef<[ScVal]> for ScVec { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[derive(Debug)] pub struct ScMap(pub VecM); @@ -9014,6 +9172,7 @@ impl AsRef<[ScMapEntry]> for ScMap { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[derive(Debug)] pub struct ScBytes(pub BytesM); @@ -9119,6 +9278,7 @@ impl AsRef<[u8]> for ScBytes { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[derive(Debug)] pub struct ScString(pub StringM); @@ -9224,6 +9384,7 @@ impl AsRef<[u8]> for ScString { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[derive(Debug)] pub struct ScSymbol(pub StringM<32>); @@ -9330,6 +9491,7 @@ impl AsRef<[u8]> for ScSymbol { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScNonceKey { pub nonce: i64, } @@ -9371,6 +9533,7 @@ impl WriteXdr for ScNonceKey { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScContractInstance { pub executable: ContractExecutable, pub storage: Option, @@ -9473,6 +9636,7 @@ impl WriteXdr for ScContractInstance { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ScVal { Bool(bool), @@ -9725,6 +9889,7 @@ impl WriteXdr for ScVal { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScMapEntry { pub key: ScVal, pub val: ScVal, @@ -9773,6 +9938,7 @@ impl WriteXdr for ScMapEntry { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum StoredTransactionSet { V0(TransactionSet), @@ -9878,6 +10044,7 @@ impl WriteXdr for StoredTransactionSet { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct StoredDebugTransactionSet { pub tx_set: StoredTransactionSet, pub ledger_seq: u32, @@ -9927,6 +10094,7 @@ impl WriteXdr for StoredDebugTransactionSet { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct PersistedScpStateV0 { pub scp_envelopes: VecM, pub quorum_sets: VecM, @@ -9976,6 +10144,7 @@ impl WriteXdr for PersistedScpStateV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct PersistedScpStateV1 { pub scp_envelopes: VecM, pub quorum_sets: VecM, @@ -10024,6 +10193,7 @@ impl WriteXdr for PersistedScpStateV1 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum PersistedScpState { V0(PersistedScpStateV0), @@ -10153,6 +10323,39 @@ impl core::str::FromStr for Thresholds { hex::decode(s).map_err(|_| Error::InvalidHex)?.try_into() } } +#[cfg(feature = "schemars")] +impl schemars::JsonSchema for Thresholds { + fn schema_name() -> String { + "Thresholds".to_string() + } + + fn is_referenceable() -> bool { + false + } + + fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema { + let schema = String::json_schema(gen); + if let schemars::schema::Schema::Object(mut schema) = schema { + schema.extensions.insert( + "contentEncoding".to_owned(), + serde_json::Value::String("hex".to_string()), + ); + schema.extensions.insert( + "contentMediaType".to_owned(), + serde_json::Value::String("application/binary".to_string()), + ); + let string = *schema.string.unwrap_or_default().clone(); + schema.string = Some(Box::new(schemars::schema::StringValidation { + max_length: 4_u32.checked_mul(2).map(Some).unwrap_or_default(), + min_length: 4_u32.checked_mul(2).map(Some).unwrap_or_default(), + ..string + })); + schema.into() + } else { + schema + } + } +} impl From for [u8; 4] { #[must_use] fn from(x: Thresholds) -> Self { @@ -10243,6 +10446,7 @@ impl AsRef<[u8]> for Thresholds { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[derive(Debug)] pub struct String32(pub StringM<32>); @@ -10348,6 +10552,7 @@ impl AsRef<[u8]> for String32 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[derive(Debug)] pub struct String64(pub StringM<64>); @@ -10452,6 +10657,7 @@ impl AsRef<[u8]> for String64 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[derive(Debug)] pub struct SequenceNumber(pub i64); @@ -10508,6 +10714,7 @@ impl WriteXdr for SequenceNumber { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[derive(Debug)] pub struct DataValue(pub BytesM<64>); @@ -10612,6 +10819,7 @@ impl AsRef<[u8]> for DataValue { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[derive(Debug)] pub struct PoolId(pub Hash); @@ -10876,6 +11084,7 @@ impl AsRef<[u8]> for AssetCode12 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum AssetType { Native = 0, @@ -11101,6 +11310,7 @@ impl WriteXdr for AssetCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct AlphaNum4 { pub asset_code: AssetCode4, pub issuer: AccountId, @@ -11146,6 +11356,7 @@ impl WriteXdr for AlphaNum4 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct AlphaNum12 { pub asset_code: AssetCode12, pub issuer: AccountId, @@ -11200,6 +11411,7 @@ impl WriteXdr for AlphaNum12 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum Asset { Native, @@ -11313,6 +11525,7 @@ impl WriteXdr for Asset { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct Price { pub n: i32, pub d: i32, @@ -11358,6 +11571,7 @@ impl WriteXdr for Price { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct Liabilities { pub buying: i64, pub selling: i64, @@ -11406,6 +11620,7 @@ impl WriteXdr for Liabilities { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ThresholdIndexes { MasterWeight = 0, @@ -11530,6 +11745,7 @@ impl WriteXdr for ThresholdIndexes { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum LedgerEntryType { Account = 0, @@ -11680,6 +11896,7 @@ impl WriteXdr for LedgerEntryType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct Signer { pub key: SignerKey, pub weight: u32, @@ -11738,6 +11955,7 @@ impl WriteXdr for Signer { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum AccountFlags { RequiredFlag = 1, @@ -11878,6 +12096,7 @@ pub const MAX_SIGNERS: u64 = 20; derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[derive(Debug)] pub struct SponsorshipDescriptor(pub Option); @@ -11944,6 +12163,7 @@ impl WriteXdr for SponsorshipDescriptor { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct AccountEntryExtensionV3 { pub ext: ExtensionPoint, pub seq_ledger: u32, @@ -11995,6 +12215,7 @@ impl WriteXdr for AccountEntryExtensionV3 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum AccountEntryExtensionV2Ext { V0, @@ -12109,6 +12330,7 @@ impl WriteXdr for AccountEntryExtensionV2Ext { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct AccountEntryExtensionV2 { pub num_sponsored: u32, pub num_sponsoring: u32, @@ -12163,6 +12385,7 @@ impl WriteXdr for AccountEntryExtensionV2 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum AccountEntryExtensionV1Ext { V0, @@ -12275,6 +12498,7 @@ impl WriteXdr for AccountEntryExtensionV1Ext { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct AccountEntryExtensionV1 { pub liabilities: Liabilities, pub ext: AccountEntryExtensionV1Ext, @@ -12323,6 +12547,7 @@ impl WriteXdr for AccountEntryExtensionV1 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum AccountEntryExt { V0, @@ -12450,6 +12675,7 @@ impl WriteXdr for AccountEntryExt { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct AccountEntry { pub account_id: AccountId, pub balance: i64, @@ -12526,6 +12752,7 @@ impl WriteXdr for AccountEntry { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum TrustLineFlags { AuthorizedFlag = 1, @@ -12665,6 +12892,7 @@ pub const MASK_TRUSTLINE_FLAGS_V17: u64 = 7; derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum LiquidityPoolType { LiquidityPoolConstantProduct = 0, @@ -12778,6 +13006,7 @@ impl WriteXdr for LiquidityPoolType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum TrustLineAsset { Native, @@ -12899,6 +13128,7 @@ impl WriteXdr for TrustLineAsset { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum TrustLineEntryExtensionV2Ext { V0, @@ -13004,6 +13234,7 @@ impl WriteXdr for TrustLineEntryExtensionV2Ext { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct TrustLineEntryExtensionV2 { pub liquidity_pool_use_count: i32, pub ext: TrustLineEntryExtensionV2Ext, @@ -13052,6 +13283,7 @@ impl WriteXdr for TrustLineEntryExtensionV2 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum TrustLineEntryV1Ext { V0, @@ -13164,6 +13396,7 @@ impl WriteXdr for TrustLineEntryV1Ext { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct TrustLineEntryV1 { pub liabilities: Liabilities, pub ext: TrustLineEntryV1Ext, @@ -13224,6 +13457,7 @@ impl WriteXdr for TrustLineEntryV1 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum TrustLineEntryExt { V0, @@ -13355,6 +13589,7 @@ impl WriteXdr for TrustLineEntryExt { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct TrustLineEntry { pub account_id: AccountId, pub asset: TrustLineAsset, @@ -13414,6 +13649,7 @@ impl WriteXdr for TrustLineEntry { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum OfferEntryFlags { PassiveFlag = 1, @@ -13524,6 +13760,7 @@ pub const MASK_OFFERENTRY_FLAGS: u64 = 1; derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum OfferEntryExt { V0, @@ -13642,6 +13879,7 @@ impl WriteXdr for OfferEntryExt { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct OfferEntry { pub seller_id: AccountId, pub offer_id: i64, @@ -13706,6 +13944,7 @@ impl WriteXdr for OfferEntry { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum DataEntryExt { V0, @@ -13814,6 +14053,7 @@ impl WriteXdr for DataEntryExt { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct DataEntry { pub account_id: AccountId, pub data_name: String64, @@ -13870,6 +14110,7 @@ impl WriteXdr for DataEntry { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ClaimPredicateType { Unconditional = 0, @@ -14012,6 +14253,7 @@ impl WriteXdr for ClaimPredicateType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ClaimPredicate { Unconditional, @@ -14154,6 +14396,7 @@ impl WriteXdr for ClaimPredicate { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ClaimantType { ClaimantTypeV0 = 0, @@ -14255,6 +14498,7 @@ impl WriteXdr for ClaimantType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ClaimantV0 { pub destination: AccountId, pub predicate: ClaimPredicate, @@ -14305,6 +14549,7 @@ impl WriteXdr for ClaimantV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum Claimant { ClaimantTypeV0(ClaimantV0), @@ -14404,6 +14649,7 @@ impl WriteXdr for Claimant { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ClaimableBalanceIdType { ClaimableBalanceIdTypeV0 = 0, @@ -14507,6 +14753,7 @@ impl WriteXdr for ClaimableBalanceIdType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ClaimableBalanceId { ClaimableBalanceIdTypeV0(Hash), @@ -14611,6 +14858,7 @@ impl WriteXdr for ClaimableBalanceId { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ClaimableBalanceFlags { ClaimableBalanceClawbackEnabledFlag = 1, @@ -14722,6 +14970,7 @@ pub const MASK_CLAIMABLE_BALANCE_FLAGS: u64 = 0x1; derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ClaimableBalanceEntryExtensionV1Ext { V0, @@ -14827,6 +15076,7 @@ impl WriteXdr for ClaimableBalanceEntryExtensionV1Ext { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ClaimableBalanceEntryExtensionV1 { pub ext: ClaimableBalanceEntryExtensionV1Ext, pub flags: u32, @@ -14875,6 +15125,7 @@ impl WriteXdr for ClaimableBalanceEntryExtensionV1 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ClaimableBalanceEntryExt { V0, @@ -14998,6 +15249,7 @@ impl WriteXdr for ClaimableBalanceEntryExt { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ClaimableBalanceEntry { pub balance_id: ClaimableBalanceId, pub claimants: VecM, @@ -15053,6 +15305,7 @@ impl WriteXdr for ClaimableBalanceEntry { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LiquidityPoolConstantProductParameters { pub asset_a: Asset, pub asset_b: Asset, @@ -15106,6 +15359,7 @@ impl WriteXdr for LiquidityPoolConstantProductParameters { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LiquidityPoolEntryConstantProduct { pub params: LiquidityPoolConstantProductParameters, pub reserve_a: i64, @@ -15170,6 +15424,7 @@ impl WriteXdr for LiquidityPoolEntryConstantProduct { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum LiquidityPoolEntryBody { LiquidityPoolConstantProduct(LiquidityPoolEntryConstantProduct), @@ -15290,6 +15545,7 @@ impl WriteXdr for LiquidityPoolEntryBody { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LiquidityPoolEntry { pub liquidity_pool_id: PoolId, pub body: LiquidityPoolEntryBody, @@ -15335,6 +15591,7 @@ impl WriteXdr for LiquidityPoolEntry { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ContractDataDurability { Temporary = 0, @@ -15445,6 +15702,7 @@ impl WriteXdr for ContractDataDurability { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ContractDataEntry { pub ext: ExtensionPoint, pub contract: ScAddress, @@ -15507,6 +15765,7 @@ impl WriteXdr for ContractDataEntry { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ContractCodeCostInputs { pub ext: ExtensionPoint, pub n_instructions: u32, @@ -15579,6 +15838,7 @@ impl WriteXdr for ContractCodeCostInputs { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ContractCodeEntryV1 { pub ext: ExtensionPoint, pub cost_inputs: ContractCodeCostInputs, @@ -15631,6 +15891,7 @@ impl WriteXdr for ContractCodeEntryV1 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ContractCodeEntryExt { V0, @@ -15746,6 +16007,7 @@ impl WriteXdr for ContractCodeEntryExt { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ContractCodeEntry { pub ext: ContractCodeEntryExt, pub hash: Hash, @@ -15794,6 +16056,7 @@ impl WriteXdr for ContractCodeEntry { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct TtlEntry { pub key_hash: Hash, pub live_until_ledger_seq: u32, @@ -15840,6 +16103,7 @@ impl WriteXdr for TtlEntry { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum LedgerEntryExtensionV1Ext { V0, @@ -15945,6 +16209,7 @@ impl WriteXdr for LedgerEntryExtensionV1Ext { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LedgerEntryExtensionV1 { pub sponsoring_id: SponsorshipDescriptor, pub ext: LedgerEntryExtensionV1Ext, @@ -16009,6 +16274,7 @@ impl WriteXdr for LedgerEntryExtensionV1 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum LedgerEntryData { Account(AccountEntry), @@ -16188,6 +16454,7 @@ impl WriteXdr for LedgerEntryData { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum LedgerEntryExt { V0, @@ -16326,6 +16593,7 @@ impl WriteXdr for LedgerEntryExt { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LedgerEntry { pub last_modified_ledger_seq: u32, pub data: LedgerEntryData, @@ -16373,6 +16641,7 @@ impl WriteXdr for LedgerEntry { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LedgerKeyAccount { pub account_id: AccountId, } @@ -16415,6 +16684,7 @@ impl WriteXdr for LedgerKeyAccount { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LedgerKeyTrustLine { pub account_id: AccountId, pub asset: TrustLineAsset, @@ -16460,6 +16730,7 @@ impl WriteXdr for LedgerKeyTrustLine { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LedgerKeyOffer { pub seller_id: AccountId, pub offer_id: i64, @@ -16505,6 +16776,7 @@ impl WriteXdr for LedgerKeyOffer { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LedgerKeyData { pub account_id: AccountId, pub data_name: String64, @@ -16549,6 +16821,7 @@ impl WriteXdr for LedgerKeyData { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LedgerKeyClaimableBalance { pub balance_id: ClaimableBalanceId, } @@ -16590,6 +16863,7 @@ impl WriteXdr for LedgerKeyClaimableBalance { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LedgerKeyLiquidityPool { pub liquidity_pool_id: PoolId, } @@ -16633,6 +16907,7 @@ impl WriteXdr for LedgerKeyLiquidityPool { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LedgerKeyContractData { pub contract: ScAddress, pub key: ScVal, @@ -16680,6 +16955,7 @@ impl WriteXdr for LedgerKeyContractData { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LedgerKeyContractCode { pub hash: Hash, } @@ -16721,6 +16997,7 @@ impl WriteXdr for LedgerKeyContractCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LedgerKeyConfigSetting { pub config_setting_id: ConfigSettingId, } @@ -16763,6 +17040,7 @@ impl WriteXdr for LedgerKeyConfigSetting { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LedgerKeyTtl { pub key_hash: Hash, } @@ -16865,6 +17143,7 @@ impl WriteXdr for LedgerKeyTtl { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum LedgerKey { Account(LedgerKeyAccount), @@ -17050,6 +17329,7 @@ impl WriteXdr for LedgerKey { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum EnvelopeType { TxV0 = 0, @@ -17197,6 +17477,7 @@ impl WriteXdr for EnvelopeType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[derive(Debug)] pub struct UpgradeType(pub BytesM<128>); @@ -17306,6 +17587,7 @@ impl AsRef<[u8]> for UpgradeType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum StellarValueType { Basic = 0, @@ -17410,6 +17692,7 @@ impl WriteXdr for StellarValueType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LedgerCloseValueSignature { pub node_id: NodeId, pub signature: Signature, @@ -17458,6 +17741,7 @@ impl WriteXdr for LedgerCloseValueSignature { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum StellarValueExt { Basic, @@ -17579,6 +17863,7 @@ impl WriteXdr for StellarValueExt { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct StellarValue { pub tx_set_hash: Hash, pub close_time: TimePoint, @@ -17640,6 +17925,7 @@ pub const MASK_LEDGER_HEADER_FLAGS: u64 = 0x7; derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum LedgerHeaderFlags { TradingFlag = 1, @@ -17752,6 +18038,7 @@ impl WriteXdr for LedgerHeaderFlags { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum LedgerHeaderExtensionV1Ext { V0, @@ -17857,6 +18144,7 @@ impl WriteXdr for LedgerHeaderExtensionV1Ext { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LedgerHeaderExtensionV1 { pub flags: u32, pub ext: LedgerHeaderExtensionV1Ext, @@ -17905,6 +18193,7 @@ impl WriteXdr for LedgerHeaderExtensionV1 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum LedgerHeaderExt { V0, @@ -18043,6 +18332,7 @@ impl WriteXdr for LedgerHeaderExt { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LedgerHeader { pub ledger_version: u32, pub previous_ledger_hash: Hash, @@ -18133,6 +18423,7 @@ impl WriteXdr for LedgerHeader { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum LedgerUpgradeType { Version = 1, @@ -18267,6 +18558,7 @@ impl WriteXdr for LedgerUpgradeType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ConfigUpgradeSetKey { pub contract_id: Hash, pub content_hash: Hash, @@ -18328,6 +18620,7 @@ impl WriteXdr for ConfigUpgradeSetKey { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum LedgerUpgrade { Version(u32), @@ -18473,6 +18766,7 @@ impl WriteXdr for LedgerUpgrade { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ConfigUpgradeSet { pub updated_entry: VecM, } @@ -18520,6 +18814,7 @@ impl WriteXdr for ConfigUpgradeSet { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum BucketEntryType { Metaentry = -1, @@ -18637,6 +18932,7 @@ impl WriteXdr for BucketEntryType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum BucketMetadataExt { V0, @@ -18744,6 +19040,7 @@ impl WriteXdr for BucketMetadataExt { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct BucketMetadata { pub ledger_version: u32, pub ext: BucketMetadataExt, @@ -18796,6 +19093,7 @@ impl WriteXdr for BucketMetadata { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum BucketEntry { Liveentry(LedgerEntry), @@ -18918,6 +19216,7 @@ impl WriteXdr for BucketEntry { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum TxSetComponentType { TxsetCompTxsMaybeDiscountedFee = 0, @@ -19020,6 +19319,7 @@ impl WriteXdr for TxSetComponentType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct TxSetComponentTxsMaybeDiscountedFee { pub base_fee: Option, pub txs: VecM, @@ -19070,6 +19370,7 @@ impl WriteXdr for TxSetComponentTxsMaybeDiscountedFee { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum TxSetComponent { TxsetCompTxsMaybeDiscountedFee(TxSetComponentTxsMaybeDiscountedFee), @@ -19177,6 +19478,7 @@ impl WriteXdr for TxSetComponent { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum TransactionPhase { V0(VecM), @@ -19276,6 +19578,7 @@ impl WriteXdr for TransactionPhase { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct TransactionSet { pub previous_ledger_hash: Hash, pub txs: VecM, @@ -19321,6 +19624,7 @@ impl WriteXdr for TransactionSet { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct TransactionSetV1 { pub previous_ledger_hash: Hash, pub phases: VecM, @@ -19368,6 +19672,7 @@ impl WriteXdr for TransactionSetV1 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum GeneralizedTransactionSet { V1(TransactionSetV1), @@ -19467,6 +19772,7 @@ impl WriteXdr for GeneralizedTransactionSet { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct TransactionResultPair { pub transaction_hash: Hash, pub result: TransactionResult, @@ -19511,6 +19817,7 @@ impl WriteXdr for TransactionResultPair { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct TransactionResultSet { pub results: VecM, } @@ -19556,6 +19863,7 @@ impl WriteXdr for TransactionResultSet { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum TransactionHistoryEntryExt { V0, @@ -19670,6 +19978,7 @@ impl WriteXdr for TransactionHistoryEntryExt { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct TransactionHistoryEntry { pub ledger_seq: u32, pub tx_set: TransactionSet, @@ -19719,6 +20028,7 @@ impl WriteXdr for TransactionHistoryEntry { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum TransactionHistoryResultEntryExt { V0, @@ -19826,6 +20136,7 @@ impl WriteXdr for TransactionHistoryResultEntryExt { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct TransactionHistoryResultEntry { pub ledger_seq: u32, pub tx_result_set: TransactionResultSet, @@ -19875,6 +20186,7 @@ impl WriteXdr for TransactionHistoryResultEntry { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum LedgerHeaderHistoryEntryExt { V0, @@ -19982,6 +20294,7 @@ impl WriteXdr for LedgerHeaderHistoryEntryExt { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LedgerHeaderHistoryEntry { pub hash: Hash, pub header: LedgerHeader, @@ -20030,6 +20343,7 @@ impl WriteXdr for LedgerHeaderHistoryEntry { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LedgerScpMessages { pub ledger_seq: u32, pub messages: VecM, @@ -20075,6 +20389,7 @@ impl WriteXdr for LedgerScpMessages { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScpHistoryEntryV0 { pub quorum_sets: VecM, pub ledger_messages: LedgerScpMessages, @@ -20121,6 +20436,7 @@ impl WriteXdr for ScpHistoryEntryV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ScpHistoryEntry { V0(ScpHistoryEntryV0), @@ -20223,6 +20539,7 @@ impl WriteXdr for ScpHistoryEntry { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum LedgerEntryChangeType { Created = 0, @@ -20345,6 +20662,7 @@ impl WriteXdr for LedgerEntryChangeType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum LedgerEntryChange { Created(LedgerEntry), @@ -20461,6 +20779,7 @@ impl WriteXdr for LedgerEntryChange { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[derive(Debug)] pub struct LedgerEntryChanges(pub VecM); @@ -20568,6 +20887,7 @@ impl AsRef<[LedgerEntryChange]> for LedgerEntryChanges { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct OperationMeta { pub changes: LedgerEntryChanges, } @@ -20610,6 +20930,7 @@ impl WriteXdr for OperationMeta { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct TransactionMetaV1 { pub tx_changes: LedgerEntryChanges, pub operations: VecM, @@ -20658,6 +20979,7 @@ impl WriteXdr for TransactionMetaV1 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct TransactionMetaV2 { pub tx_changes_before: LedgerEntryChanges, pub operations: VecM, @@ -20708,6 +21030,7 @@ impl WriteXdr for TransactionMetaV2 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ContractEventType { System = 0, @@ -20819,6 +21142,7 @@ impl WriteXdr for ContractEventType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ContractEventV0 { pub topics: VecM, pub data: ScVal, @@ -20869,6 +21193,7 @@ impl WriteXdr for ContractEventV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ContractEventBody { V0(ContractEventV0), @@ -20983,6 +21308,7 @@ impl WriteXdr for ContractEventBody { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ContractEvent { pub ext: ExtensionPoint, pub contract_id: Option, @@ -21034,6 +21360,7 @@ impl WriteXdr for ContractEvent { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct DiagnosticEvent { pub in_successful_contract_call: bool, pub event: ContractEvent, @@ -21107,6 +21434,7 @@ impl WriteXdr for DiagnosticEvent { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct SorobanTransactionMetaExtV1 { pub ext: ExtensionPoint, pub total_non_refundable_resource_fee_charged: i64, @@ -21162,6 +21490,7 @@ impl WriteXdr for SorobanTransactionMetaExtV1 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum SorobanTransactionMetaExt { V0, @@ -21274,6 +21603,7 @@ impl WriteXdr for SorobanTransactionMetaExt { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct SorobanTransactionMeta { pub ext: SorobanTransactionMetaExt, pub events: VecM, @@ -21332,6 +21662,7 @@ impl WriteXdr for SorobanTransactionMeta { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct TransactionMetaV3 { pub ext: ExtensionPoint, pub tx_changes_before: LedgerEntryChanges, @@ -21386,6 +21717,7 @@ impl WriteXdr for TransactionMetaV3 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct InvokeHostFunctionSuccessPreImage { pub return_value: ScVal, pub events: VecM, @@ -21438,6 +21770,7 @@ impl WriteXdr for InvokeHostFunctionSuccessPreImage { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum TransactionMeta { V0(VecM), @@ -21553,6 +21886,7 @@ impl WriteXdr for TransactionMeta { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct TransactionResultMeta { pub result: TransactionResultPair, pub fee_processing: LedgerEntryChanges, @@ -21601,6 +21935,7 @@ impl WriteXdr for TransactionResultMeta { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct UpgradeEntryMeta { pub upgrade: LedgerUpgrade, pub changes: LedgerEntryChanges, @@ -21658,6 +21993,7 @@ impl WriteXdr for UpgradeEntryMeta { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LedgerCloseMetaV0 { pub ledger_header: LedgerHeaderHistoryEntry, pub tx_set: TransactionSet, @@ -21712,6 +22048,7 @@ impl WriteXdr for LedgerCloseMetaV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LedgerCloseMetaExtV1 { pub ext: ExtensionPoint, pub soroban_fee_write1_kb: i64, @@ -21760,6 +22097,7 @@ impl WriteXdr for LedgerCloseMetaExtV1 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum LedgerCloseMetaExt { V0, @@ -21889,6 +22227,7 @@ impl WriteXdr for LedgerCloseMetaExt { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LedgerCloseMetaV1 { pub ext: LedgerCloseMetaExt, pub ledger_header: LedgerHeaderHistoryEntry, @@ -21958,6 +22297,7 @@ impl WriteXdr for LedgerCloseMetaV1 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum LedgerCloseMeta { V0(LedgerCloseMetaV0), @@ -22066,6 +22406,7 @@ impl WriteXdr for LedgerCloseMeta { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ErrorCode { Misc = 0, @@ -22185,6 +22526,7 @@ impl WriteXdr for ErrorCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct SError { pub code: ErrorCode, pub msg: StringM<100>, @@ -22229,6 +22571,7 @@ impl WriteXdr for SError { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct SendMore { pub num_messages: u32, } @@ -22271,6 +22614,7 @@ impl WriteXdr for SendMore { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct SendMoreExtended { pub num_messages: u32, pub num_bytes: u32, @@ -22317,6 +22661,7 @@ impl WriteXdr for SendMoreExtended { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct AuthCert { pub pubkey: Curve25519Public, pub expiration: u64, @@ -22372,6 +22717,7 @@ impl WriteXdr for AuthCert { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct Hello { pub ledger_version: u32, pub overlay_version: u32, @@ -22445,6 +22791,7 @@ pub const AUTH_MSG_FLAG_FLOW_CONTROL_BYTES_REQUESTED: u64 = 200; derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct Auth { pub flags: i32, } @@ -22488,6 +22835,7 @@ impl WriteXdr for Auth { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum IpAddrType { IPv4 = 0, @@ -22595,6 +22943,7 @@ impl WriteXdr for IpAddrType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum PeerAddressIp { IPv4([u8; 4]), @@ -22707,6 +23056,7 @@ impl WriteXdr for PeerAddressIp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct PeerAddress { pub ip: PeerAddressIp, pub port: u32, @@ -22784,6 +23134,7 @@ impl WriteXdr for PeerAddress { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum MessageType { ErrorMsg = 0, @@ -22984,6 +23335,7 @@ impl WriteXdr for MessageType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct DontHave { pub type_: MessageType, pub req_hash: Uint256, @@ -23029,6 +23381,7 @@ impl WriteXdr for DontHave { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum SurveyMessageCommandType { SurveyTopology = 0, @@ -23131,6 +23484,7 @@ impl WriteXdr for SurveyMessageCommandType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum SurveyMessageResponseType { V0 = 0, @@ -23239,6 +23593,7 @@ impl WriteXdr for SurveyMessageResponseType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct SurveyRequestMessage { pub surveyor_peer_id: NodeId, pub surveyed_peer_id: NodeId, @@ -23293,6 +23648,7 @@ impl WriteXdr for SurveyRequestMessage { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct SignedSurveyRequestMessage { pub request_signature: Signature, pub request: SurveyRequestMessage, @@ -23335,6 +23691,7 @@ impl WriteXdr for SignedSurveyRequestMessage { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[derive(Debug)] pub struct EncryptedBody(pub BytesM<64000>); @@ -23446,6 +23803,7 @@ impl AsRef<[u8]> for EncryptedBody { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct SurveyResponseMessage { pub surveyor_peer_id: NodeId, pub surveyed_peer_id: NodeId, @@ -23500,6 +23858,7 @@ impl WriteXdr for SurveyResponseMessage { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct SignedSurveyResponseMessage { pub response_signature: Signature, pub response: SurveyResponseMessage, @@ -23560,6 +23919,7 @@ impl WriteXdr for SignedSurveyResponseMessage { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct PeerStats { pub id: NodeId, pub version_str: StringM<100>, @@ -23641,6 +24001,7 @@ impl WriteXdr for PeerStats { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[derive(Debug)] pub struct PeerStatList(pub VecM); @@ -23752,6 +24113,7 @@ impl AsRef<[PeerStats]> for PeerStatList { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct TopologyResponseBodyV0 { pub inbound_peers: PeerStatList, pub outbound_peers: PeerStatList, @@ -23809,6 +24171,7 @@ impl WriteXdr for TopologyResponseBodyV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct TopologyResponseBodyV1 { pub inbound_peers: PeerStatList, pub outbound_peers: PeerStatList, @@ -23869,6 +24232,7 @@ impl WriteXdr for TopologyResponseBodyV1 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum SurveyResponseBody { V0(TopologyResponseBodyV0), @@ -23980,6 +24344,7 @@ pub const TX_ADVERT_VECTOR_MAX_SIZE: u64 = 1000; derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[derive(Debug)] pub struct TxAdvertVector(pub VecM); @@ -24087,6 +24452,7 @@ impl AsRef<[Hash]> for TxAdvertVector { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct FloodAdvert { pub tx_hashes: TxAdvertVector, } @@ -24134,6 +24500,7 @@ pub const TX_DEMAND_VECTOR_MAX_SIZE: u64 = 1000; derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[derive(Debug)] pub struct TxDemandVector(pub VecM); @@ -24241,6 +24608,7 @@ impl AsRef<[Hash]> for TxDemandVector { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct FloodDemand { pub tx_hashes: TxDemandVector, } @@ -24329,6 +24697,7 @@ impl WriteXdr for FloodDemand { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum StellarMessage { ErrorMsg(SError), @@ -24574,6 +24943,7 @@ impl WriteXdr for StellarMessage { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct AuthenticatedMessageV0 { pub sequence: u64, pub message: StellarMessage, @@ -24628,6 +24998,7 @@ impl WriteXdr for AuthenticatedMessageV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum AuthenticatedMessage { V0(AuthenticatedMessageV0), @@ -24736,6 +25107,7 @@ pub const MAX_OPS_PER_TX: u64 = 100; derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum LiquidityPoolParameters { LiquidityPoolConstantProduct(LiquidityPoolConstantProductParameters), @@ -24997,6 +25369,7 @@ impl WriteXdr for MuxedAccount { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct DecoratedSignature { pub hint: SignatureHint, pub signature: Signature, @@ -25068,6 +25441,7 @@ impl WriteXdr for DecoratedSignature { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum OperationType { CreateAccount = 0, @@ -25303,6 +25677,7 @@ impl WriteXdr for OperationType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct CreateAccountOp { pub destination: AccountId, pub starting_balance: i64, @@ -25349,6 +25724,7 @@ impl WriteXdr for CreateAccountOp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct PaymentOp { pub destination: MuxedAccount, pub asset: Asset, @@ -25405,6 +25781,7 @@ impl WriteXdr for PaymentOp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct PathPaymentStrictReceiveOp { pub send_asset: Asset, pub send_max: i64, @@ -25470,6 +25847,7 @@ impl WriteXdr for PathPaymentStrictReceiveOp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct PathPaymentStrictSendOp { pub send_asset: Asset, pub send_amount: i64, @@ -25532,6 +25910,7 @@ impl WriteXdr for PathPaymentStrictSendOp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ManageSellOfferOp { pub selling: Asset, pub buying: Asset, @@ -25592,6 +25971,7 @@ impl WriteXdr for ManageSellOfferOp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ManageBuyOfferOp { pub selling: Asset, pub buying: Asset, @@ -25648,6 +26028,7 @@ impl WriteXdr for ManageBuyOfferOp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct CreatePassiveSellOfferOp { pub selling: Asset, pub buying: Asset, @@ -25713,6 +26094,7 @@ impl WriteXdr for CreatePassiveSellOfferOp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct SetOptionsOp { pub inflation_dest: Option, pub clear_flags: Option, @@ -25791,6 +26173,7 @@ impl WriteXdr for SetOptionsOp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ChangeTrustAsset { Native, @@ -25913,6 +26296,7 @@ impl WriteXdr for ChangeTrustAsset { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ChangeTrustOp { pub line: ChangeTrustAsset, pub limit: i64, @@ -25961,6 +26345,7 @@ impl WriteXdr for ChangeTrustOp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct AllowTrustOp { pub trustor: AccountId, pub asset: AssetCode, @@ -26009,6 +26394,7 @@ impl WriteXdr for AllowTrustOp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ManageDataOp { pub data_name: String64, pub data_value: Option, @@ -26053,6 +26439,7 @@ impl WriteXdr for ManageDataOp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct BumpSequenceOp { pub bump_to: SequenceNumber, } @@ -26096,6 +26483,7 @@ impl WriteXdr for BumpSequenceOp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct CreateClaimableBalanceOp { pub asset: Asset, pub amount: i64, @@ -26143,6 +26531,7 @@ impl WriteXdr for CreateClaimableBalanceOp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ClaimClaimableBalanceOp { pub balance_id: ClaimableBalanceId, } @@ -26184,6 +26573,7 @@ impl WriteXdr for ClaimClaimableBalanceOp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct BeginSponsoringFutureReservesOp { pub sponsored_id: AccountId, } @@ -26227,6 +26617,7 @@ impl WriteXdr for BeginSponsoringFutureReservesOp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum RevokeSponsorshipType { LedgerEntry = 0, @@ -26334,6 +26725,7 @@ impl WriteXdr for RevokeSponsorshipType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct RevokeSponsorshipOpSigner { pub account_id: AccountId, pub signer_key: SignerKey, @@ -26386,6 +26778,7 @@ impl WriteXdr for RevokeSponsorshipOpSigner { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum RevokeSponsorshipOp { LedgerEntry(LedgerKey), @@ -26496,6 +26889,7 @@ impl WriteXdr for RevokeSponsorshipOp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ClawbackOp { pub asset: Asset, pub from: MuxedAccount, @@ -26543,6 +26937,7 @@ impl WriteXdr for ClawbackOp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ClawbackClaimableBalanceOp { pub balance_id: ClaimableBalanceId, } @@ -26588,6 +26983,7 @@ impl WriteXdr for ClawbackClaimableBalanceOp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct SetTrustLineFlagsOp { pub trustor: AccountId, pub asset: Asset, @@ -26650,6 +27046,7 @@ pub const LIQUIDITY_POOL_FEE_V18: u64 = 30; derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LiquidityPoolDepositOp { pub liquidity_pool_id: PoolId, pub max_amount_a: i64, @@ -26706,6 +27103,7 @@ impl WriteXdr for LiquidityPoolDepositOp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LiquidityPoolWithdrawOp { pub liquidity_pool_id: PoolId, pub amount: i64, @@ -26759,6 +27157,7 @@ impl WriteXdr for LiquidityPoolWithdrawOp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum HostFunctionType { InvokeContract = 0, @@ -26872,6 +27271,7 @@ impl WriteXdr for HostFunctionType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ContractIdPreimageType { Address = 0, @@ -26979,6 +27379,7 @@ impl WriteXdr for ContractIdPreimageType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ContractIdPreimageFromAddress { pub address: ScAddress, pub salt: Uint256, @@ -27031,6 +27432,7 @@ impl WriteXdr for ContractIdPreimageFromAddress { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ContractIdPreimage { Address(ContractIdPreimageFromAddress), @@ -27140,6 +27542,7 @@ impl WriteXdr for ContractIdPreimage { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct CreateContractArgs { pub contract_id_preimage: ContractIdPreimage, pub executable: ContractExecutable, @@ -27185,6 +27588,7 @@ impl WriteXdr for CreateContractArgs { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct InvokeContractArgs { pub contract_address: ScAddress, pub function_name: ScSymbol, @@ -27238,6 +27642,7 @@ impl WriteXdr for InvokeContractArgs { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum HostFunction { InvokeContract(InvokeContractArgs), @@ -27359,6 +27764,7 @@ impl WriteXdr for HostFunction { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum SorobanAuthorizedFunctionType { ContractFn = 0, @@ -27469,6 +27875,7 @@ impl WriteXdr for SorobanAuthorizedFunctionType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum SorobanAuthorizedFunction { ContractFn(InvokeContractArgs), @@ -27581,6 +27988,7 @@ impl WriteXdr for SorobanAuthorizedFunction { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct SorobanAuthorizedInvocation { pub function: SorobanAuthorizedFunction, pub sub_invocations: VecM, @@ -27628,6 +28036,7 @@ impl WriteXdr for SorobanAuthorizedInvocation { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct SorobanAddressCredentials { pub address: ScAddress, pub nonce: i64, @@ -27680,6 +28089,7 @@ impl WriteXdr for SorobanAddressCredentials { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum SorobanCredentialsType { SourceAccount = 0, @@ -27790,6 +28200,7 @@ impl WriteXdr for SorobanCredentialsType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum SorobanCredentials { SourceAccount, @@ -27899,6 +28310,7 @@ impl WriteXdr for SorobanCredentials { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct SorobanAuthorizationEntry { pub credentials: SorobanCredentials, pub root_invocation: SorobanAuthorizedInvocation, @@ -27946,6 +28358,7 @@ impl WriteXdr for SorobanAuthorizationEntry { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct InvokeHostFunctionOp { pub host_function: HostFunction, pub auth: VecM, @@ -27991,6 +28404,7 @@ impl WriteXdr for InvokeHostFunctionOp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ExtendFootprintTtlOp { pub ext: ExtensionPoint, pub extend_to: u32, @@ -28035,6 +28449,7 @@ impl WriteXdr for ExtendFootprintTtlOp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct RestoreFootprintOp { pub ext: ExtensionPoint, } @@ -28130,6 +28545,7 @@ impl WriteXdr for RestoreFootprintOp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum OperationBody { CreateAccount(CreateAccountOp), @@ -28510,6 +28926,7 @@ impl WriteXdr for OperationBody { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct Operation { pub source_account: Option, pub body: OperationBody, @@ -28556,6 +28973,7 @@ impl WriteXdr for Operation { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct HashIdPreimageOperationId { pub source_account: AccountId, pub seq_num: SequenceNumber, @@ -28607,6 +29025,7 @@ impl WriteXdr for HashIdPreimageOperationId { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct HashIdPreimageRevokeId { pub source_account: AccountId, pub seq_num: SequenceNumber, @@ -28661,6 +29080,7 @@ impl WriteXdr for HashIdPreimageRevokeId { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct HashIdPreimageContractId { pub network_id: Hash, pub contract_id_preimage: ContractIdPreimage, @@ -28708,6 +29128,7 @@ impl WriteXdr for HashIdPreimageContractId { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct HashIdPreimageSorobanAuthorization { pub network_id: Hash, pub nonce: i64, @@ -28788,6 +29209,7 @@ impl WriteXdr for HashIdPreimageSorobanAuthorization { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum HashIdPreimage { OpId(HashIdPreimageOperationId), @@ -28922,6 +29344,7 @@ impl WriteXdr for HashIdPreimage { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum MemoType { None = 0, @@ -29050,6 +29473,7 @@ impl WriteXdr for MemoType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum Memo { None, @@ -29175,6 +29599,7 @@ impl WriteXdr for Memo { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct TimeBounds { pub min_time: TimePoint, pub max_time: TimePoint, @@ -29220,6 +29645,7 @@ impl WriteXdr for TimeBounds { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LedgerBounds { pub min_ledger: u32, pub max_ledger: u32, @@ -29292,6 +29718,7 @@ impl WriteXdr for LedgerBounds { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct PreconditionsV2 { pub time_bounds: Option, pub ledger_bounds: Option, @@ -29351,6 +29778,7 @@ impl WriteXdr for PreconditionsV2 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum PreconditionType { None = 0, @@ -29467,6 +29895,7 @@ impl WriteXdr for PreconditionType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum Preconditions { None, @@ -29580,6 +30009,7 @@ impl WriteXdr for Preconditions { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LedgerFootprint { pub read_only: VecM, pub read_write: VecM, @@ -29632,6 +30062,7 @@ impl WriteXdr for LedgerFootprint { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct SorobanResources { pub footprint: LedgerFootprint, pub instructions: u32, @@ -29693,6 +30124,7 @@ impl WriteXdr for SorobanResources { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct SorobanTransactionData { pub ext: ExtensionPoint, pub resources: SorobanResources, @@ -29742,6 +30174,7 @@ impl WriteXdr for SorobanTransactionData { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum TransactionV0Ext { V0, @@ -29851,6 +30284,7 @@ impl WriteXdr for TransactionV0Ext { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct TransactionV0 { pub source_account_ed25519: Uint256, pub fee: u32, @@ -29913,6 +30347,7 @@ impl WriteXdr for TransactionV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct TransactionV0Envelope { pub tx: TransactionV0, pub signatures: VecM, @@ -29961,6 +30396,7 @@ impl WriteXdr for TransactionV0Envelope { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum TransactionExt { V0, @@ -30088,6 +30524,7 @@ impl WriteXdr for TransactionExt { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct Transaction { pub source_account: MuxedAccount, pub fee: u32, @@ -30150,6 +30587,7 @@ impl WriteXdr for Transaction { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct TransactionV1Envelope { pub tx: Transaction, pub signatures: VecM, @@ -30196,6 +30634,7 @@ impl WriteXdr for TransactionV1Envelope { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum FeeBumpTransactionInnerTx { Tx(TransactionV1Envelope), @@ -30296,6 +30735,7 @@ impl WriteXdr for FeeBumpTransactionInnerTx { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum FeeBumpTransactionExt { V0, @@ -30407,6 +30847,7 @@ impl WriteXdr for FeeBumpTransactionExt { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct FeeBumpTransaction { pub fee_source: MuxedAccount, pub fee: i64, @@ -30460,6 +30901,7 @@ impl WriteXdr for FeeBumpTransaction { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct FeeBumpTransactionEnvelope { pub tx: FeeBumpTransaction, pub signatures: VecM, @@ -30510,6 +30952,7 @@ impl WriteXdr for FeeBumpTransactionEnvelope { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum TransactionEnvelope { TxV0(TransactionV0Envelope), @@ -30629,6 +31072,7 @@ impl WriteXdr for TransactionEnvelope { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum TransactionSignaturePayloadTaggedTransaction { Tx(Transaction), @@ -30741,6 +31185,7 @@ impl WriteXdr for TransactionSignaturePayloadTaggedTransaction { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct TransactionSignaturePayload { pub network_id: Hash, pub tagged_transaction: TransactionSignaturePayloadTaggedTransaction, @@ -30788,6 +31233,7 @@ impl WriteXdr for TransactionSignaturePayload { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ClaimAtomType { V0 = 0, @@ -30908,6 +31354,7 @@ impl WriteXdr for ClaimAtomType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ClaimOfferAtomV0 { pub seller_ed25519: Uint256, pub offer_id: i64, @@ -30974,6 +31421,7 @@ impl WriteXdr for ClaimOfferAtomV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ClaimOfferAtom { pub seller_id: AccountId, pub offer_id: i64, @@ -31038,6 +31486,7 @@ impl WriteXdr for ClaimOfferAtom { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ClaimLiquidityAtom { pub liquidity_pool_id: PoolId, pub asset_sold: Asset, @@ -31097,6 +31546,7 @@ impl WriteXdr for ClaimLiquidityAtom { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ClaimAtom { V0(ClaimOfferAtomV0), @@ -31220,6 +31670,7 @@ impl WriteXdr for ClaimAtom { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum CreateAccountResultCode { Success = 0, @@ -31351,6 +31802,7 @@ impl WriteXdr for CreateAccountResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum CreateAccountResult { Success, @@ -31494,6 +31946,7 @@ impl WriteXdr for CreateAccountResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum PaymentResultCode { Success = 0, @@ -31655,6 +32108,7 @@ impl WriteXdr for PaymentResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum PaymentResult { Success, @@ -31845,6 +32299,7 @@ impl WriteXdr for PaymentResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum PathPaymentStrictReceiveResultCode { Success = 0, @@ -32011,6 +32466,7 @@ impl WriteXdr for PathPaymentStrictReceiveResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct SimplePaymentResult { pub destination: AccountId, pub asset: Asset, @@ -32059,6 +32515,7 @@ impl WriteXdr for SimplePaymentResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct PathPaymentStrictReceiveResultSuccess { pub offers: VecM, pub last: SimplePaymentResult, @@ -32125,6 +32582,7 @@ impl WriteXdr for PathPaymentStrictReceiveResultSuccess { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum PathPaymentStrictReceiveResult { Success(PathPaymentStrictReceiveResultSuccess), @@ -32338,6 +32796,7 @@ impl WriteXdr for PathPaymentStrictReceiveResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum PathPaymentStrictSendResultCode { Success = 0, @@ -32503,6 +32962,7 @@ impl WriteXdr for PathPaymentStrictSendResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct PathPaymentStrictSendResultSuccess { pub offers: VecM, pub last: SimplePaymentResult, @@ -32568,6 +33028,7 @@ impl WriteXdr for PathPaymentStrictSendResultSuccess { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum PathPaymentStrictSendResult { Success(PathPaymentStrictSendResultSuccess), @@ -32780,6 +33241,7 @@ impl WriteXdr for PathPaymentStrictSendResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ManageSellOfferResultCode { Success = 0, @@ -32947,6 +33409,7 @@ impl WriteXdr for ManageSellOfferResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ManageOfferEffect { Created = 0, @@ -33062,6 +33525,7 @@ impl WriteXdr for ManageOfferEffect { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ManageOfferSuccessResultOffer { Created(OfferEntry), @@ -33185,6 +33649,7 @@ impl WriteXdr for ManageOfferSuccessResultOffer { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ManageOfferSuccessResult { pub offers_claimed: VecM, pub offer: ManageOfferSuccessResultOffer, @@ -33244,6 +33709,7 @@ impl WriteXdr for ManageOfferSuccessResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ManageSellOfferResult { Success(ManageOfferSuccessResult), @@ -33453,6 +33919,7 @@ impl WriteXdr for ManageSellOfferResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ManageBuyOfferResultCode { Success = 0, @@ -33632,6 +34099,7 @@ impl WriteXdr for ManageBuyOfferResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ManageBuyOfferResult { Success(ManageOfferSuccessResult), @@ -33834,6 +34302,7 @@ impl WriteXdr for ManageBuyOfferResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum SetOptionsResultCode { Success = 0, @@ -34001,6 +34470,7 @@ impl WriteXdr for SetOptionsResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum SetOptionsResult { Success, @@ -34188,6 +34658,7 @@ impl WriteXdr for SetOptionsResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ChangeTrustResultCode { Success = 0, @@ -34343,6 +34814,7 @@ impl WriteXdr for ChangeTrustResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ChangeTrustResult { Success, @@ -34514,6 +34986,7 @@ impl WriteXdr for ChangeTrustResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum AllowTrustResultCode { Success = 0, @@ -34657,6 +35130,7 @@ impl WriteXdr for AllowTrustResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum AllowTrustResult { Success, @@ -34812,6 +35286,7 @@ impl WriteXdr for AllowTrustResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum AccountMergeResultCode { Success = 0, @@ -34961,6 +35436,7 @@ impl WriteXdr for AccountMergeResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum AccountMergeResult { Success(i64), @@ -35116,6 +35592,7 @@ impl WriteXdr for AccountMergeResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum InflationResultCode { Success = 0, @@ -35221,6 +35698,7 @@ impl WriteXdr for InflationResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct InflationPayout { pub destination: AccountId, pub amount: i64, @@ -35269,6 +35747,7 @@ impl WriteXdr for InflationPayout { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum InflationResult { Success(VecM), @@ -35384,6 +35863,7 @@ impl WriteXdr for InflationResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ManageDataResultCode { Success = 0, @@ -35515,6 +35995,7 @@ impl WriteXdr for ManageDataResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ManageDataResult { Success, @@ -35649,6 +36130,7 @@ impl WriteXdr for ManageDataResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum BumpSequenceResultCode { Success = 0, @@ -35759,6 +36241,7 @@ impl WriteXdr for BumpSequenceResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum BumpSequenceResult { Success, @@ -35871,6 +36354,7 @@ impl WriteXdr for BumpSequenceResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum CreateClaimableBalanceResultCode { Success = 0, @@ -36009,6 +36493,7 @@ impl WriteXdr for CreateClaimableBalanceResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum CreateClaimableBalanceResult { Success(ClaimableBalanceId), @@ -36155,6 +36640,7 @@ impl WriteXdr for CreateClaimableBalanceResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ClaimClaimableBalanceResultCode { Success = 0, @@ -36292,6 +36778,7 @@ impl WriteXdr for ClaimClaimableBalanceResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ClaimClaimableBalanceResult { Success, @@ -36437,6 +36924,7 @@ impl WriteXdr for ClaimClaimableBalanceResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum BeginSponsoringFutureReservesResultCode { Success = 0, @@ -36559,6 +37047,7 @@ impl WriteXdr for BeginSponsoringFutureReservesResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum BeginSponsoringFutureReservesResult { Success, @@ -36684,6 +37173,7 @@ impl WriteXdr for BeginSponsoringFutureReservesResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum EndSponsoringFutureReservesResultCode { Success = 0, @@ -36795,6 +37285,7 @@ impl WriteXdr for EndSponsoringFutureReservesResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum EndSponsoringFutureReservesResult { Success, @@ -36911,6 +37402,7 @@ impl WriteXdr for EndSponsoringFutureReservesResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum RevokeSponsorshipResultCode { Success = 0, @@ -37048,6 +37540,7 @@ impl WriteXdr for RevokeSponsorshipResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum RevokeSponsorshipResult { Success, @@ -37194,6 +37687,7 @@ impl WriteXdr for RevokeSponsorshipResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ClawbackResultCode { Success = 0, @@ -37325,6 +37819,7 @@ impl WriteXdr for ClawbackResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ClawbackResult { Success, @@ -37462,6 +37957,7 @@ impl WriteXdr for ClawbackResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ClawbackClaimableBalanceResultCode { Success = 0, @@ -37584,6 +38080,7 @@ impl WriteXdr for ClawbackClaimableBalanceResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ClawbackClaimableBalanceResult { Success, @@ -37714,6 +38211,7 @@ impl WriteXdr for ClawbackClaimableBalanceResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum SetTrustLineFlagsResultCode { Success = 0, @@ -37851,6 +38349,7 @@ impl WriteXdr for SetTrustLineFlagsResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum SetTrustLineFlagsResult { Success, @@ -38004,6 +38503,7 @@ impl WriteXdr for SetTrustLineFlagsResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum LiquidityPoolDepositResultCode { Success = 0, @@ -38153,6 +38653,7 @@ impl WriteXdr for LiquidityPoolDepositResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum LiquidityPoolDepositResult { Success, @@ -38317,6 +38818,7 @@ impl WriteXdr for LiquidityPoolDepositResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum LiquidityPoolWithdrawResultCode { Success = 0, @@ -38454,6 +38956,7 @@ impl WriteXdr for LiquidityPoolWithdrawResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum LiquidityPoolWithdrawResult { Success, @@ -38601,6 +39104,7 @@ impl WriteXdr for LiquidityPoolWithdrawResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum InvokeHostFunctionResultCode { Success = 0, @@ -38738,6 +39242,7 @@ impl WriteXdr for InvokeHostFunctionResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum InvokeHostFunctionResult { Success(Hash), @@ -38887,6 +39392,7 @@ impl WriteXdr for InvokeHostFunctionResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ExtendFootprintTtlResultCode { Success = 0, @@ -39012,6 +39518,7 @@ impl WriteXdr for ExtendFootprintTtlResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ExtendFootprintTtlResult { Success, @@ -39147,6 +39654,7 @@ impl WriteXdr for ExtendFootprintTtlResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum RestoreFootprintResultCode { Success = 0, @@ -39272,6 +39780,7 @@ impl WriteXdr for RestoreFootprintResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum RestoreFootprintResult { Success, @@ -39408,6 +39917,7 @@ impl WriteXdr for RestoreFootprintResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum OperationResultCode { OpInner = 0, @@ -39596,6 +40106,7 @@ impl WriteXdr for OperationResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum OperationResultTr { CreateAccount(CreateAccountResult), @@ -39984,6 +40495,7 @@ impl WriteXdr for OperationResultTr { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum OperationResult { OpInner(OperationResultTr), @@ -40151,6 +40663,7 @@ impl WriteXdr for OperationResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum TransactionResultCode { TxFeeBumpInnerSuccess = 1, @@ -40366,6 +40879,7 @@ impl WriteXdr for TransactionResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum InnerTransactionResultResult { TxSuccess(VecM), @@ -40586,6 +41100,7 @@ impl WriteXdr for InnerTransactionResultResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum InnerTransactionResultExt { V0, @@ -40719,6 +41234,7 @@ impl WriteXdr for InnerTransactionResultExt { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct InnerTransactionResult { pub fee_charged: i64, pub result: InnerTransactionResultResult, @@ -40767,6 +41283,7 @@ impl WriteXdr for InnerTransactionResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct InnerTransactionResultPair { pub transaction_hash: Hash, pub result: InnerTransactionResult, @@ -40834,6 +41351,7 @@ impl WriteXdr for InnerTransactionResultPair { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum TransactionResultResult { TxFeeBumpInnerSuccess(InnerTransactionResultPair), @@ -41072,6 +41590,7 @@ impl WriteXdr for TransactionResultResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum TransactionResultExt { V0, @@ -41206,6 +41725,7 @@ impl WriteXdr for TransactionResultExt { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct TransactionResult { pub fee_charged: i64, pub result: TransactionResultResult, @@ -41279,6 +41799,39 @@ impl core::str::FromStr for Hash { hex::decode(s).map_err(|_| Error::InvalidHex)?.try_into() } } +#[cfg(feature = "schemars")] +impl schemars::JsonSchema for Hash { + fn schema_name() -> String { + "Hash".to_string() + } + + fn is_referenceable() -> bool { + false + } + + fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema { + let schema = String::json_schema(gen); + if let schemars::schema::Schema::Object(mut schema) = schema { + schema.extensions.insert( + "contentEncoding".to_owned(), + serde_json::Value::String("hex".to_string()), + ); + schema.extensions.insert( + "contentMediaType".to_owned(), + serde_json::Value::String("application/binary".to_string()), + ); + let string = *schema.string.unwrap_or_default().clone(); + schema.string = Some(Box::new(schemars::schema::StringValidation { + max_length: 32_u32.checked_mul(2).map(Some).unwrap_or_default(), + min_length: 32_u32.checked_mul(2).map(Some).unwrap_or_default(), + ..string + })); + schema.into() + } else { + schema + } + } +} impl From for [u8; 32] { #[must_use] fn from(x: Hash) -> Self { @@ -41397,6 +41950,39 @@ impl core::str::FromStr for Uint256 { hex::decode(s).map_err(|_| Error::InvalidHex)?.try_into() } } +#[cfg(feature = "schemars")] +impl schemars::JsonSchema for Uint256 { + fn schema_name() -> String { + "Uint256".to_string() + } + + fn is_referenceable() -> bool { + false + } + + fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema { + let schema = String::json_schema(gen); + if let schemars::schema::Schema::Object(mut schema) = schema { + schema.extensions.insert( + "contentEncoding".to_owned(), + serde_json::Value::String("hex".to_string()), + ); + schema.extensions.insert( + "contentMediaType".to_owned(), + serde_json::Value::String("application/binary".to_string()), + ); + let string = *schema.string.unwrap_or_default().clone(); + schema.string = Some(Box::new(schemars::schema::StringValidation { + max_length: 32_u32.checked_mul(2).map(Some).unwrap_or_default(), + min_length: 32_u32.checked_mul(2).map(Some).unwrap_or_default(), + ..string + })); + schema.into() + } else { + schema + } + } +} impl From for [u8; 32] { #[must_use] fn from(x: Uint256) -> Self { @@ -41518,6 +42104,7 @@ pub type Int64 = i64; derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[derive(Debug)] pub struct TimePoint(pub u64); @@ -41573,6 +42160,7 @@ impl WriteXdr for TimePoint { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[derive(Debug)] pub struct Duration(pub u64); @@ -41633,6 +42221,7 @@ impl WriteXdr for Duration { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ExtensionPoint { V0, @@ -41738,6 +42327,7 @@ impl WriteXdr for ExtensionPoint { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum CryptoKeyType { Ed25519 = 0, @@ -41863,6 +42453,7 @@ impl WriteXdr for CryptoKeyType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum PublicKeyType { PublicKeyTypeEd25519 = 0, @@ -41967,6 +42558,7 @@ impl WriteXdr for PublicKeyType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum SignerKeyType { Ed25519 = 0, @@ -42363,6 +42955,7 @@ impl WriteXdr for SignerKey { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[derive(Debug)] pub struct Signature(pub BytesM<64>); @@ -42496,6 +43089,39 @@ impl core::str::FromStr for SignatureHint { hex::decode(s).map_err(|_| Error::InvalidHex)?.try_into() } } +#[cfg(feature = "schemars")] +impl schemars::JsonSchema for SignatureHint { + fn schema_name() -> String { + "SignatureHint".to_string() + } + + fn is_referenceable() -> bool { + false + } + + fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema { + let schema = String::json_schema(gen); + if let schemars::schema::Schema::Object(mut schema) = schema { + schema.extensions.insert( + "contentEncoding".to_owned(), + serde_json::Value::String("hex".to_string()), + ); + schema.extensions.insert( + "contentMediaType".to_owned(), + serde_json::Value::String("application/binary".to_string()), + ); + let string = *schema.string.unwrap_or_default().clone(); + schema.string = Some(Box::new(schemars::schema::StringValidation { + max_length: 4_u32.checked_mul(2).map(Some).unwrap_or_default(), + min_length: 4_u32.checked_mul(2).map(Some).unwrap_or_default(), + ..string + })); + schema.into() + } else { + schema + } + } +} impl From for [u8; 4] { #[must_use] fn from(x: SignatureHint) -> Self { @@ -42696,6 +43322,7 @@ impl WriteXdr for AccountId { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct Curve25519Secret { pub key: [u8; 32], } @@ -42737,6 +43364,7 @@ impl WriteXdr for Curve25519Secret { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct Curve25519Public { pub key: [u8; 32], } @@ -42778,6 +43406,7 @@ impl WriteXdr for Curve25519Public { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct HmacSha256Key { pub key: [u8; 32], } @@ -42819,6 +43448,7 @@ impl WriteXdr for HmacSha256Key { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct HmacSha256Mac { pub mac: [u8; 32], } @@ -42844,12 +43474,873 @@ impl WriteXdr for HmacSha256Mac { } } +#[doc(hidden)] +#[macro_export] +macro_rules! _call_macro_with_each_type_a8ec9d9a49f25ea23e8e612173231a39cfdf209abcfa15580b47b2a63e940f47 { + // The x-macro takes a single ident, the name of a macro to call ... + ($macro_to_call_back:ident, $($context:tt),*) => {{ + // ... and calls it back, once for each XDR type. + $macro_to_call_back!(Value, $($context),*); + + $macro_to_call_back!(ScpBallot, $($context),*); + + $macro_to_call_back!(ScpStatementType, $($context),*); + + $macro_to_call_back!(ScpNomination, $($context),*); + + $macro_to_call_back!(ScpStatement, $($context),*); + + $macro_to_call_back!(ScpStatementPledges, $($context),*); + + $macro_to_call_back!(ScpStatementPrepare, $($context),*); + + $macro_to_call_back!(ScpStatementConfirm, $($context),*); + + $macro_to_call_back!(ScpStatementExternalize, $($context),*); + + $macro_to_call_back!(ScpEnvelope, $($context),*); + + $macro_to_call_back!(ScpQuorumSet, $($context),*); + + $macro_to_call_back!(ConfigSettingContractExecutionLanesV0, $($context),*); + + $macro_to_call_back!(ConfigSettingContractComputeV0, $($context),*); + + $macro_to_call_back!(ConfigSettingContractLedgerCostV0, $($context),*); + + $macro_to_call_back!(ConfigSettingContractHistoricalDataV0, $($context),*); + + $macro_to_call_back!(ConfigSettingContractEventsV0, $($context),*); + + $macro_to_call_back!(ConfigSettingContractBandwidthV0, $($context),*); + + $macro_to_call_back!(ContractCostType, $($context),*); + + $macro_to_call_back!(ContractCostParamEntry, $($context),*); + + $macro_to_call_back!(StateArchivalSettings, $($context),*); + + $macro_to_call_back!(EvictionIterator, $($context),*); + + $macro_to_call_back!(ContractCostParams, $($context),*); + + $macro_to_call_back!(ConfigSettingId, $($context),*); + + $macro_to_call_back!(ConfigSettingEntry, $($context),*); + + $macro_to_call_back!(ScEnvMetaKind, $($context),*); + + $macro_to_call_back!(ScEnvMetaEntry, $($context),*); + + $macro_to_call_back!(ScMetaV0, $($context),*); + + $macro_to_call_back!(ScMetaKind, $($context),*); + + $macro_to_call_back!(ScMetaEntry, $($context),*); + + $macro_to_call_back!(ScSpecType, $($context),*); + + $macro_to_call_back!(ScSpecTypeOption, $($context),*); + + $macro_to_call_back!(ScSpecTypeResult, $($context),*); + + $macro_to_call_back!(ScSpecTypeVec, $($context),*); + + $macro_to_call_back!(ScSpecTypeMap, $($context),*); + + $macro_to_call_back!(ScSpecTypeTuple, $($context),*); + + $macro_to_call_back!(ScSpecTypeBytesN, $($context),*); + + $macro_to_call_back!(ScSpecTypeUdt, $($context),*); + + $macro_to_call_back!(ScSpecTypeDef, $($context),*); + + $macro_to_call_back!(ScSpecUdtStructFieldV0, $($context),*); + + $macro_to_call_back!(ScSpecUdtStructV0, $($context),*); + + $macro_to_call_back!(ScSpecUdtUnionCaseVoidV0, $($context),*); + + $macro_to_call_back!(ScSpecUdtUnionCaseTupleV0, $($context),*); + + $macro_to_call_back!(ScSpecUdtUnionCaseV0Kind, $($context),*); + + $macro_to_call_back!(ScSpecUdtUnionCaseV0, $($context),*); + + $macro_to_call_back!(ScSpecUdtUnionV0, $($context),*); + + $macro_to_call_back!(ScSpecUdtEnumCaseV0, $($context),*); + + $macro_to_call_back!(ScSpecUdtEnumV0, $($context),*); + + $macro_to_call_back!(ScSpecUdtErrorEnumCaseV0, $($context),*); + + $macro_to_call_back!(ScSpecUdtErrorEnumV0, $($context),*); + + $macro_to_call_back!(ScSpecFunctionInputV0, $($context),*); + + $macro_to_call_back!(ScSpecFunctionV0, $($context),*); + + $macro_to_call_back!(ScSpecEntryKind, $($context),*); + + $macro_to_call_back!(ScSpecEntry, $($context),*); + + $macro_to_call_back!(ScValType, $($context),*); + + $macro_to_call_back!(ScErrorType, $($context),*); + + $macro_to_call_back!(ScErrorCode, $($context),*); + + $macro_to_call_back!(ScError, $($context),*); + + $macro_to_call_back!(UInt128Parts, $($context),*); + + $macro_to_call_back!(Int128Parts, $($context),*); + + $macro_to_call_back!(UInt256Parts, $($context),*); + + $macro_to_call_back!(Int256Parts, $($context),*); + + $macro_to_call_back!(ContractExecutableType, $($context),*); + + $macro_to_call_back!(ContractExecutable, $($context),*); + + $macro_to_call_back!(ScAddressType, $($context),*); + + $macro_to_call_back!(ScAddress, $($context),*); + + $macro_to_call_back!(ScVec, $($context),*); + + $macro_to_call_back!(ScMap, $($context),*); + + $macro_to_call_back!(ScBytes, $($context),*); + + $macro_to_call_back!(ScString, $($context),*); + + $macro_to_call_back!(ScSymbol, $($context),*); + + $macro_to_call_back!(ScNonceKey, $($context),*); + + $macro_to_call_back!(ScContractInstance, $($context),*); + + $macro_to_call_back!(ScVal, $($context),*); + + $macro_to_call_back!(ScMapEntry, $($context),*); + + $macro_to_call_back!(StoredTransactionSet, $($context),*); + + $macro_to_call_back!(StoredDebugTransactionSet, $($context),*); + + $macro_to_call_back!(PersistedScpStateV0, $($context),*); + + $macro_to_call_back!(PersistedScpStateV1, $($context),*); + + $macro_to_call_back!(PersistedScpState, $($context),*); + + $macro_to_call_back!(Thresholds, $($context),*); + + $macro_to_call_back!(String32, $($context),*); + + $macro_to_call_back!(String64, $($context),*); + + $macro_to_call_back!(SequenceNumber, $($context),*); + + $macro_to_call_back!(DataValue, $($context),*); + + $macro_to_call_back!(PoolId, $($context),*); + + $macro_to_call_back!(AssetCode4, $($context),*); + + $macro_to_call_back!(AssetCode12, $($context),*); + + $macro_to_call_back!(AssetType, $($context),*); + + $macro_to_call_back!(AssetCode, $($context),*); + + $macro_to_call_back!(AlphaNum4, $($context),*); + + $macro_to_call_back!(AlphaNum12, $($context),*); + + $macro_to_call_back!(Asset, $($context),*); + + $macro_to_call_back!(Price, $($context),*); + + $macro_to_call_back!(Liabilities, $($context),*); + + $macro_to_call_back!(ThresholdIndexes, $($context),*); + + $macro_to_call_back!(LedgerEntryType, $($context),*); + + $macro_to_call_back!(Signer, $($context),*); + + $macro_to_call_back!(AccountFlags, $($context),*); + + $macro_to_call_back!(SponsorshipDescriptor, $($context),*); + + $macro_to_call_back!(AccountEntryExtensionV3, $($context),*); + + $macro_to_call_back!(AccountEntryExtensionV2, $($context),*); + + $macro_to_call_back!(AccountEntryExtensionV2Ext, $($context),*); + + $macro_to_call_back!(AccountEntryExtensionV1, $($context),*); + + $macro_to_call_back!(AccountEntryExtensionV1Ext, $($context),*); + + $macro_to_call_back!(AccountEntry, $($context),*); + + $macro_to_call_back!(AccountEntryExt, $($context),*); + + $macro_to_call_back!(TrustLineFlags, $($context),*); + + $macro_to_call_back!(LiquidityPoolType, $($context),*); + + $macro_to_call_back!(TrustLineAsset, $($context),*); + + $macro_to_call_back!(TrustLineEntryExtensionV2, $($context),*); + + $macro_to_call_back!(TrustLineEntryExtensionV2Ext, $($context),*); + + $macro_to_call_back!(TrustLineEntry, $($context),*); + + $macro_to_call_back!(TrustLineEntryExt, $($context),*); + + $macro_to_call_back!(TrustLineEntryV1, $($context),*); + + $macro_to_call_back!(TrustLineEntryV1Ext, $($context),*); + + $macro_to_call_back!(OfferEntryFlags, $($context),*); + + $macro_to_call_back!(OfferEntry, $($context),*); + + $macro_to_call_back!(OfferEntryExt, $($context),*); + + $macro_to_call_back!(DataEntry, $($context),*); + + $macro_to_call_back!(DataEntryExt, $($context),*); + + $macro_to_call_back!(ClaimPredicateType, $($context),*); + + $macro_to_call_back!(ClaimPredicate, $($context),*); + + $macro_to_call_back!(ClaimantType, $($context),*); + + $macro_to_call_back!(Claimant, $($context),*); + + $macro_to_call_back!(ClaimantV0, $($context),*); + + $macro_to_call_back!(ClaimableBalanceIdType, $($context),*); + + $macro_to_call_back!(ClaimableBalanceId, $($context),*); + + $macro_to_call_back!(ClaimableBalanceFlags, $($context),*); + + $macro_to_call_back!(ClaimableBalanceEntryExtensionV1, $($context),*); + + $macro_to_call_back!(ClaimableBalanceEntryExtensionV1Ext, $($context),*); + + $macro_to_call_back!(ClaimableBalanceEntry, $($context),*); + + $macro_to_call_back!(ClaimableBalanceEntryExt, $($context),*); + + $macro_to_call_back!(LiquidityPoolConstantProductParameters, $($context),*); + + $macro_to_call_back!(LiquidityPoolEntry, $($context),*); + + $macro_to_call_back!(LiquidityPoolEntryBody, $($context),*); + + $macro_to_call_back!(LiquidityPoolEntryConstantProduct, $($context),*); + + $macro_to_call_back!(ContractDataDurability, $($context),*); + + $macro_to_call_back!(ContractDataEntry, $($context),*); + + $macro_to_call_back!(ContractCodeCostInputs, $($context),*); + + $macro_to_call_back!(ContractCodeEntry, $($context),*); + + $macro_to_call_back!(ContractCodeEntryExt, $($context),*); + + $macro_to_call_back!(ContractCodeEntryV1, $($context),*); + + $macro_to_call_back!(TtlEntry, $($context),*); + + $macro_to_call_back!(LedgerEntryExtensionV1, $($context),*); + + $macro_to_call_back!(LedgerEntryExtensionV1Ext, $($context),*); + + $macro_to_call_back!(LedgerEntry, $($context),*); + + $macro_to_call_back!(LedgerEntryData, $($context),*); + + $macro_to_call_back!(LedgerEntryExt, $($context),*); + + $macro_to_call_back!(LedgerKey, $($context),*); + + $macro_to_call_back!(LedgerKeyAccount, $($context),*); + + $macro_to_call_back!(LedgerKeyTrustLine, $($context),*); + + $macro_to_call_back!(LedgerKeyOffer, $($context),*); + + $macro_to_call_back!(LedgerKeyData, $($context),*); + + $macro_to_call_back!(LedgerKeyClaimableBalance, $($context),*); + + $macro_to_call_back!(LedgerKeyLiquidityPool, $($context),*); + + $macro_to_call_back!(LedgerKeyContractData, $($context),*); + + $macro_to_call_back!(LedgerKeyContractCode, $($context),*); + + $macro_to_call_back!(LedgerKeyConfigSetting, $($context),*); + + $macro_to_call_back!(LedgerKeyTtl, $($context),*); + + $macro_to_call_back!(EnvelopeType, $($context),*); + + $macro_to_call_back!(UpgradeType, $($context),*); + + $macro_to_call_back!(StellarValueType, $($context),*); + + $macro_to_call_back!(LedgerCloseValueSignature, $($context),*); + + $macro_to_call_back!(StellarValue, $($context),*); + + $macro_to_call_back!(StellarValueExt, $($context),*); + + $macro_to_call_back!(LedgerHeaderFlags, $($context),*); + + $macro_to_call_back!(LedgerHeaderExtensionV1, $($context),*); + + $macro_to_call_back!(LedgerHeaderExtensionV1Ext, $($context),*); + + $macro_to_call_back!(LedgerHeader, $($context),*); + + $macro_to_call_back!(LedgerHeaderExt, $($context),*); + + $macro_to_call_back!(LedgerUpgradeType, $($context),*); + + $macro_to_call_back!(ConfigUpgradeSetKey, $($context),*); + + $macro_to_call_back!(LedgerUpgrade, $($context),*); + + $macro_to_call_back!(ConfigUpgradeSet, $($context),*); + + $macro_to_call_back!(BucketEntryType, $($context),*); + + $macro_to_call_back!(BucketMetadata, $($context),*); + + $macro_to_call_back!(BucketMetadataExt, $($context),*); + + $macro_to_call_back!(BucketEntry, $($context),*); + + $macro_to_call_back!(TxSetComponentType, $($context),*); + + $macro_to_call_back!(TxSetComponent, $($context),*); + + $macro_to_call_back!(TxSetComponentTxsMaybeDiscountedFee, $($context),*); + + $macro_to_call_back!(TransactionPhase, $($context),*); + + $macro_to_call_back!(TransactionSet, $($context),*); + + $macro_to_call_back!(TransactionSetV1, $($context),*); + + $macro_to_call_back!(GeneralizedTransactionSet, $($context),*); + + $macro_to_call_back!(TransactionResultPair, $($context),*); + + $macro_to_call_back!(TransactionResultSet, $($context),*); + + $macro_to_call_back!(TransactionHistoryEntry, $($context),*); + + $macro_to_call_back!(TransactionHistoryEntryExt, $($context),*); + + $macro_to_call_back!(TransactionHistoryResultEntry, $($context),*); + + $macro_to_call_back!(TransactionHistoryResultEntryExt, $($context),*); + + $macro_to_call_back!(LedgerHeaderHistoryEntry, $($context),*); + + $macro_to_call_back!(LedgerHeaderHistoryEntryExt, $($context),*); + + $macro_to_call_back!(LedgerScpMessages, $($context),*); + + $macro_to_call_back!(ScpHistoryEntryV0, $($context),*); + + $macro_to_call_back!(ScpHistoryEntry, $($context),*); + + $macro_to_call_back!(LedgerEntryChangeType, $($context),*); + + $macro_to_call_back!(LedgerEntryChange, $($context),*); + + $macro_to_call_back!(LedgerEntryChanges, $($context),*); + + $macro_to_call_back!(OperationMeta, $($context),*); + + $macro_to_call_back!(TransactionMetaV1, $($context),*); + + $macro_to_call_back!(TransactionMetaV2, $($context),*); + + $macro_to_call_back!(ContractEventType, $($context),*); + + $macro_to_call_back!(ContractEvent, $($context),*); + + $macro_to_call_back!(ContractEventBody, $($context),*); + + $macro_to_call_back!(ContractEventV0, $($context),*); + + $macro_to_call_back!(DiagnosticEvent, $($context),*); + + $macro_to_call_back!(SorobanTransactionMetaExtV1, $($context),*); + + $macro_to_call_back!(SorobanTransactionMetaExt, $($context),*); + + $macro_to_call_back!(SorobanTransactionMeta, $($context),*); + + $macro_to_call_back!(TransactionMetaV3, $($context),*); + + $macro_to_call_back!(InvokeHostFunctionSuccessPreImage, $($context),*); + + $macro_to_call_back!(TransactionMeta, $($context),*); + + $macro_to_call_back!(TransactionResultMeta, $($context),*); + + $macro_to_call_back!(UpgradeEntryMeta, $($context),*); + + $macro_to_call_back!(LedgerCloseMetaV0, $($context),*); + + $macro_to_call_back!(LedgerCloseMetaExtV1, $($context),*); + + $macro_to_call_back!(LedgerCloseMetaExt, $($context),*); + + $macro_to_call_back!(LedgerCloseMetaV1, $($context),*); + + $macro_to_call_back!(LedgerCloseMeta, $($context),*); + + $macro_to_call_back!(ErrorCode, $($context),*); + + $macro_to_call_back!(SError, $($context),*); + + $macro_to_call_back!(SendMore, $($context),*); + + $macro_to_call_back!(SendMoreExtended, $($context),*); + + $macro_to_call_back!(AuthCert, $($context),*); + + $macro_to_call_back!(Hello, $($context),*); + + $macro_to_call_back!(Auth, $($context),*); + + $macro_to_call_back!(IpAddrType, $($context),*); + + $macro_to_call_back!(PeerAddress, $($context),*); + + $macro_to_call_back!(PeerAddressIp, $($context),*); + + $macro_to_call_back!(MessageType, $($context),*); + + $macro_to_call_back!(DontHave, $($context),*); + + $macro_to_call_back!(SurveyMessageCommandType, $($context),*); + + $macro_to_call_back!(SurveyMessageResponseType, $($context),*); + + $macro_to_call_back!(SurveyRequestMessage, $($context),*); + + $macro_to_call_back!(SignedSurveyRequestMessage, $($context),*); + + $macro_to_call_back!(EncryptedBody, $($context),*); + + $macro_to_call_back!(SurveyResponseMessage, $($context),*); + + $macro_to_call_back!(SignedSurveyResponseMessage, $($context),*); + + $macro_to_call_back!(PeerStats, $($context),*); + + $macro_to_call_back!(PeerStatList, $($context),*); + + $macro_to_call_back!(TopologyResponseBodyV0, $($context),*); + + $macro_to_call_back!(TopologyResponseBodyV1, $($context),*); + + $macro_to_call_back!(SurveyResponseBody, $($context),*); + + $macro_to_call_back!(TxAdvertVector, $($context),*); + + $macro_to_call_back!(FloodAdvert, $($context),*); + + $macro_to_call_back!(TxDemandVector, $($context),*); + + $macro_to_call_back!(FloodDemand, $($context),*); + + $macro_to_call_back!(StellarMessage, $($context),*); + + $macro_to_call_back!(AuthenticatedMessage, $($context),*); + + $macro_to_call_back!(AuthenticatedMessageV0, $($context),*); + + $macro_to_call_back!(LiquidityPoolParameters, $($context),*); + + $macro_to_call_back!(MuxedAccount, $($context),*); + + $macro_to_call_back!(MuxedAccountMed25519, $($context),*); + + $macro_to_call_back!(DecoratedSignature, $($context),*); + + $macro_to_call_back!(OperationType, $($context),*); + + $macro_to_call_back!(CreateAccountOp, $($context),*); + + $macro_to_call_back!(PaymentOp, $($context),*); + + $macro_to_call_back!(PathPaymentStrictReceiveOp, $($context),*); + + $macro_to_call_back!(PathPaymentStrictSendOp, $($context),*); + + $macro_to_call_back!(ManageSellOfferOp, $($context),*); + + $macro_to_call_back!(ManageBuyOfferOp, $($context),*); + + $macro_to_call_back!(CreatePassiveSellOfferOp, $($context),*); + + $macro_to_call_back!(SetOptionsOp, $($context),*); + + $macro_to_call_back!(ChangeTrustAsset, $($context),*); + + $macro_to_call_back!(ChangeTrustOp, $($context),*); + + $macro_to_call_back!(AllowTrustOp, $($context),*); + + $macro_to_call_back!(ManageDataOp, $($context),*); + + $macro_to_call_back!(BumpSequenceOp, $($context),*); + + $macro_to_call_back!(CreateClaimableBalanceOp, $($context),*); + + $macro_to_call_back!(ClaimClaimableBalanceOp, $($context),*); + + $macro_to_call_back!(BeginSponsoringFutureReservesOp, $($context),*); + + $macro_to_call_back!(RevokeSponsorshipType, $($context),*); + + $macro_to_call_back!(RevokeSponsorshipOp, $($context),*); + + $macro_to_call_back!(RevokeSponsorshipOpSigner, $($context),*); + + $macro_to_call_back!(ClawbackOp, $($context),*); + + $macro_to_call_back!(ClawbackClaimableBalanceOp, $($context),*); + + $macro_to_call_back!(SetTrustLineFlagsOp, $($context),*); + + $macro_to_call_back!(LiquidityPoolDepositOp, $($context),*); + + $macro_to_call_back!(LiquidityPoolWithdrawOp, $($context),*); + + $macro_to_call_back!(HostFunctionType, $($context),*); + + $macro_to_call_back!(ContractIdPreimageType, $($context),*); + + $macro_to_call_back!(ContractIdPreimage, $($context),*); + + $macro_to_call_back!(ContractIdPreimageFromAddress, $($context),*); + + $macro_to_call_back!(CreateContractArgs, $($context),*); + + $macro_to_call_back!(InvokeContractArgs, $($context),*); + + $macro_to_call_back!(HostFunction, $($context),*); + + $macro_to_call_back!(SorobanAuthorizedFunctionType, $($context),*); + + $macro_to_call_back!(SorobanAuthorizedFunction, $($context),*); + + $macro_to_call_back!(SorobanAuthorizedInvocation, $($context),*); + + $macro_to_call_back!(SorobanAddressCredentials, $($context),*); + + $macro_to_call_back!(SorobanCredentialsType, $($context),*); + + $macro_to_call_back!(SorobanCredentials, $($context),*); + + $macro_to_call_back!(SorobanAuthorizationEntry, $($context),*); + + $macro_to_call_back!(InvokeHostFunctionOp, $($context),*); + + $macro_to_call_back!(ExtendFootprintTtlOp, $($context),*); + + $macro_to_call_back!(RestoreFootprintOp, $($context),*); + + $macro_to_call_back!(Operation, $($context),*); + + $macro_to_call_back!(OperationBody, $($context),*); + + $macro_to_call_back!(HashIdPreimage, $($context),*); + + $macro_to_call_back!(HashIdPreimageOperationId, $($context),*); + + $macro_to_call_back!(HashIdPreimageRevokeId, $($context),*); + + $macro_to_call_back!(HashIdPreimageContractId, $($context),*); + + $macro_to_call_back!(HashIdPreimageSorobanAuthorization, $($context),*); + + $macro_to_call_back!(MemoType, $($context),*); + + $macro_to_call_back!(Memo, $($context),*); + + $macro_to_call_back!(TimeBounds, $($context),*); + + $macro_to_call_back!(LedgerBounds, $($context),*); + + $macro_to_call_back!(PreconditionsV2, $($context),*); + + $macro_to_call_back!(PreconditionType, $($context),*); + + $macro_to_call_back!(Preconditions, $($context),*); + + $macro_to_call_back!(LedgerFootprint, $($context),*); + + $macro_to_call_back!(SorobanResources, $($context),*); + + $macro_to_call_back!(SorobanTransactionData, $($context),*); + + $macro_to_call_back!(TransactionV0, $($context),*); + + $macro_to_call_back!(TransactionV0Ext, $($context),*); + + $macro_to_call_back!(TransactionV0Envelope, $($context),*); + + $macro_to_call_back!(Transaction, $($context),*); + + $macro_to_call_back!(TransactionExt, $($context),*); + + $macro_to_call_back!(TransactionV1Envelope, $($context),*); + + $macro_to_call_back!(FeeBumpTransaction, $($context),*); + + $macro_to_call_back!(FeeBumpTransactionInnerTx, $($context),*); + + $macro_to_call_back!(FeeBumpTransactionExt, $($context),*); + + $macro_to_call_back!(FeeBumpTransactionEnvelope, $($context),*); + + $macro_to_call_back!(TransactionEnvelope, $($context),*); + + $macro_to_call_back!(TransactionSignaturePayload, $($context),*); + + $macro_to_call_back!(TransactionSignaturePayloadTaggedTransaction, $($context),*); + + $macro_to_call_back!(ClaimAtomType, $($context),*); + + $macro_to_call_back!(ClaimOfferAtomV0, $($context),*); + + $macro_to_call_back!(ClaimOfferAtom, $($context),*); + + $macro_to_call_back!(ClaimLiquidityAtom, $($context),*); + + $macro_to_call_back!(ClaimAtom, $($context),*); + + $macro_to_call_back!(CreateAccountResultCode, $($context),*); + + $macro_to_call_back!(CreateAccountResult, $($context),*); + + $macro_to_call_back!(PaymentResultCode, $($context),*); + + $macro_to_call_back!(PaymentResult, $($context),*); + + $macro_to_call_back!(PathPaymentStrictReceiveResultCode, $($context),*); + + $macro_to_call_back!(SimplePaymentResult, $($context),*); + + $macro_to_call_back!(PathPaymentStrictReceiveResult, $($context),*); + + $macro_to_call_back!(PathPaymentStrictReceiveResultSuccess, $($context),*); + + $macro_to_call_back!(PathPaymentStrictSendResultCode, $($context),*); + + $macro_to_call_back!(PathPaymentStrictSendResult, $($context),*); + + $macro_to_call_back!(PathPaymentStrictSendResultSuccess, $($context),*); + + $macro_to_call_back!(ManageSellOfferResultCode, $($context),*); + + $macro_to_call_back!(ManageOfferEffect, $($context),*); + + $macro_to_call_back!(ManageOfferSuccessResult, $($context),*); + + $macro_to_call_back!(ManageOfferSuccessResultOffer, $($context),*); + + $macro_to_call_back!(ManageSellOfferResult, $($context),*); + + $macro_to_call_back!(ManageBuyOfferResultCode, $($context),*); + + $macro_to_call_back!(ManageBuyOfferResult, $($context),*); + + $macro_to_call_back!(SetOptionsResultCode, $($context),*); + + $macro_to_call_back!(SetOptionsResult, $($context),*); + + $macro_to_call_back!(ChangeTrustResultCode, $($context),*); + + $macro_to_call_back!(ChangeTrustResult, $($context),*); + + $macro_to_call_back!(AllowTrustResultCode, $($context),*); + + $macro_to_call_back!(AllowTrustResult, $($context),*); + + $macro_to_call_back!(AccountMergeResultCode, $($context),*); + + $macro_to_call_back!(AccountMergeResult, $($context),*); + + $macro_to_call_back!(InflationResultCode, $($context),*); + + $macro_to_call_back!(InflationPayout, $($context),*); + + $macro_to_call_back!(InflationResult, $($context),*); + + $macro_to_call_back!(ManageDataResultCode, $($context),*); + + $macro_to_call_back!(ManageDataResult, $($context),*); + + $macro_to_call_back!(BumpSequenceResultCode, $($context),*); + + $macro_to_call_back!(BumpSequenceResult, $($context),*); + + $macro_to_call_back!(CreateClaimableBalanceResultCode, $($context),*); + + $macro_to_call_back!(CreateClaimableBalanceResult, $($context),*); + + $macro_to_call_back!(ClaimClaimableBalanceResultCode, $($context),*); + + $macro_to_call_back!(ClaimClaimableBalanceResult, $($context),*); + + $macro_to_call_back!(BeginSponsoringFutureReservesResultCode, $($context),*); + + $macro_to_call_back!(BeginSponsoringFutureReservesResult, $($context),*); + + $macro_to_call_back!(EndSponsoringFutureReservesResultCode, $($context),*); + + $macro_to_call_back!(EndSponsoringFutureReservesResult, $($context),*); + + $macro_to_call_back!(RevokeSponsorshipResultCode, $($context),*); + + $macro_to_call_back!(RevokeSponsorshipResult, $($context),*); + + $macro_to_call_back!(ClawbackResultCode, $($context),*); + + $macro_to_call_back!(ClawbackResult, $($context),*); + + $macro_to_call_back!(ClawbackClaimableBalanceResultCode, $($context),*); + + $macro_to_call_back!(ClawbackClaimableBalanceResult, $($context),*); + + $macro_to_call_back!(SetTrustLineFlagsResultCode, $($context),*); + + $macro_to_call_back!(SetTrustLineFlagsResult, $($context),*); + + $macro_to_call_back!(LiquidityPoolDepositResultCode, $($context),*); + + $macro_to_call_back!(LiquidityPoolDepositResult, $($context),*); + + $macro_to_call_back!(LiquidityPoolWithdrawResultCode, $($context),*); + + $macro_to_call_back!(LiquidityPoolWithdrawResult, $($context),*); + + $macro_to_call_back!(InvokeHostFunctionResultCode, $($context),*); + + $macro_to_call_back!(InvokeHostFunctionResult, $($context),*); + + $macro_to_call_back!(ExtendFootprintTtlResultCode, $($context),*); + + $macro_to_call_back!(ExtendFootprintTtlResult, $($context),*); + + $macro_to_call_back!(RestoreFootprintResultCode, $($context),*); + + $macro_to_call_back!(RestoreFootprintResult, $($context),*); + + $macro_to_call_back!(OperationResultCode, $($context),*); + + $macro_to_call_back!(OperationResult, $($context),*); + + $macro_to_call_back!(OperationResultTr, $($context),*); + + $macro_to_call_back!(TransactionResultCode, $($context),*); + + $macro_to_call_back!(InnerTransactionResult, $($context),*); + + $macro_to_call_back!(InnerTransactionResultResult, $($context),*); + + $macro_to_call_back!(InnerTransactionResultExt, $($context),*); + + $macro_to_call_back!(InnerTransactionResultPair, $($context),*); + + $macro_to_call_back!(TransactionResult, $($context),*); + + $macro_to_call_back!(TransactionResultResult, $($context),*); + + $macro_to_call_back!(TransactionResultExt, $($context),*); + + $macro_to_call_back!(Hash, $($context),*); + + $macro_to_call_back!(Uint256, $($context),*); + + $macro_to_call_back!(Uint32, $($context),*); + + $macro_to_call_back!(Int32, $($context),*); + + $macro_to_call_back!(Uint64, $($context),*); + + $macro_to_call_back!(Int64, $($context),*); + + $macro_to_call_back!(TimePoint, $($context),*); + + $macro_to_call_back!(Duration, $($context),*); + + $macro_to_call_back!(ExtensionPoint, $($context),*); + + $macro_to_call_back!(CryptoKeyType, $($context),*); + + $macro_to_call_back!(PublicKeyType, $($context),*); + + $macro_to_call_back!(SignerKeyType, $($context),*); + + $macro_to_call_back!(PublicKey, $($context),*); + + $macro_to_call_back!(SignerKey, $($context),*); + + $macro_to_call_back!(SignerKeyEd25519SignedPayload, $($context),*); + + $macro_to_call_back!(Signature, $($context),*); + + $macro_to_call_back!(SignatureHint, $($context),*); + + $macro_to_call_back!(NodeId, $($context),*); + + $macro_to_call_back!(AccountId, $($context),*); + + $macro_to_call_back!(Curve25519Secret, $($context),*); + + $macro_to_call_back!(Curve25519Public, $($context),*); + + $macro_to_call_back!(HmacSha256Key, $($context),*); + + $macro_to_call_back!(HmacSha256Mac, $($context),*); + + + }}; +} +pub use _call_macro_with_each_type_a8ec9d9a49f25ea23e8e612173231a39cfdf209abcfa15580b47b2a63e940f47 as call_macro_with_each_type; #[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr( all(feature = "serde", feature = "alloc"), derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub enum TypeVariant { Value, ScpBallot, @@ -44577,6 +46068,623 @@ impl TypeVariant { pub const fn variants() -> [TypeVariant; 425] { Self::VARIANTS } + + #[cfg(feature = "schemars")] + #[must_use] + #[allow(clippy::too_many_lines)] + pub fn json_schema(&self, gen: schemars::gen::SchemaGenerator) -> schemars::schema::RootSchema { + match self { + Self::Value => gen.into_root_schema_for::(), + Self::ScpBallot => gen.into_root_schema_for::(), + Self::ScpStatementType => gen.into_root_schema_for::(), + Self::ScpNomination => gen.into_root_schema_for::(), + Self::ScpStatement => gen.into_root_schema_for::(), + Self::ScpStatementPledges => gen.into_root_schema_for::(), + Self::ScpStatementPrepare => gen.into_root_schema_for::(), + Self::ScpStatementConfirm => gen.into_root_schema_for::(), + Self::ScpStatementExternalize => gen.into_root_schema_for::(), + Self::ScpEnvelope => gen.into_root_schema_for::(), + Self::ScpQuorumSet => gen.into_root_schema_for::(), + Self::ConfigSettingContractExecutionLanesV0 => { + gen.into_root_schema_for::() + } + Self::ConfigSettingContractComputeV0 => { + gen.into_root_schema_for::() + } + Self::ConfigSettingContractLedgerCostV0 => { + gen.into_root_schema_for::() + } + Self::ConfigSettingContractHistoricalDataV0 => { + gen.into_root_schema_for::() + } + Self::ConfigSettingContractEventsV0 => { + gen.into_root_schema_for::() + } + Self::ConfigSettingContractBandwidthV0 => { + gen.into_root_schema_for::() + } + Self::ContractCostType => gen.into_root_schema_for::(), + Self::ContractCostParamEntry => gen.into_root_schema_for::(), + Self::StateArchivalSettings => gen.into_root_schema_for::(), + Self::EvictionIterator => gen.into_root_schema_for::(), + Self::ContractCostParams => gen.into_root_schema_for::(), + Self::ConfigSettingId => gen.into_root_schema_for::(), + Self::ConfigSettingEntry => gen.into_root_schema_for::(), + Self::ScEnvMetaKind => gen.into_root_schema_for::(), + Self::ScEnvMetaEntry => gen.into_root_schema_for::(), + Self::ScMetaV0 => gen.into_root_schema_for::(), + Self::ScMetaKind => gen.into_root_schema_for::(), + Self::ScMetaEntry => gen.into_root_schema_for::(), + Self::ScSpecType => gen.into_root_schema_for::(), + Self::ScSpecTypeOption => gen.into_root_schema_for::(), + Self::ScSpecTypeResult => gen.into_root_schema_for::(), + Self::ScSpecTypeVec => gen.into_root_schema_for::(), + Self::ScSpecTypeMap => gen.into_root_schema_for::(), + Self::ScSpecTypeTuple => gen.into_root_schema_for::(), + Self::ScSpecTypeBytesN => gen.into_root_schema_for::(), + Self::ScSpecTypeUdt => gen.into_root_schema_for::(), + Self::ScSpecTypeDef => gen.into_root_schema_for::(), + Self::ScSpecUdtStructFieldV0 => gen.into_root_schema_for::(), + Self::ScSpecUdtStructV0 => gen.into_root_schema_for::(), + Self::ScSpecUdtUnionCaseVoidV0 => { + gen.into_root_schema_for::() + } + Self::ScSpecUdtUnionCaseTupleV0 => { + gen.into_root_schema_for::() + } + Self::ScSpecUdtUnionCaseV0Kind => { + gen.into_root_schema_for::() + } + Self::ScSpecUdtUnionCaseV0 => gen.into_root_schema_for::(), + Self::ScSpecUdtUnionV0 => gen.into_root_schema_for::(), + Self::ScSpecUdtEnumCaseV0 => gen.into_root_schema_for::(), + Self::ScSpecUdtEnumV0 => gen.into_root_schema_for::(), + Self::ScSpecUdtErrorEnumCaseV0 => { + gen.into_root_schema_for::() + } + Self::ScSpecUdtErrorEnumV0 => gen.into_root_schema_for::(), + Self::ScSpecFunctionInputV0 => gen.into_root_schema_for::(), + Self::ScSpecFunctionV0 => gen.into_root_schema_for::(), + Self::ScSpecEntryKind => gen.into_root_schema_for::(), + Self::ScSpecEntry => gen.into_root_schema_for::(), + Self::ScValType => gen.into_root_schema_for::(), + Self::ScErrorType => gen.into_root_schema_for::(), + Self::ScErrorCode => gen.into_root_schema_for::(), + Self::ScError => gen.into_root_schema_for::(), + Self::UInt128Parts => gen.into_root_schema_for::(), + Self::Int128Parts => gen.into_root_schema_for::(), + Self::UInt256Parts => gen.into_root_schema_for::(), + Self::Int256Parts => gen.into_root_schema_for::(), + Self::ContractExecutableType => gen.into_root_schema_for::(), + Self::ContractExecutable => gen.into_root_schema_for::(), + Self::ScAddressType => gen.into_root_schema_for::(), + Self::ScAddress => gen.into_root_schema_for::(), + Self::ScVec => gen.into_root_schema_for::(), + Self::ScMap => gen.into_root_schema_for::(), + Self::ScBytes => gen.into_root_schema_for::(), + Self::ScString => gen.into_root_schema_for::(), + Self::ScSymbol => gen.into_root_schema_for::(), + Self::ScNonceKey => gen.into_root_schema_for::(), + Self::ScContractInstance => gen.into_root_schema_for::(), + Self::ScVal => gen.into_root_schema_for::(), + Self::ScMapEntry => gen.into_root_schema_for::(), + Self::StoredTransactionSet => gen.into_root_schema_for::(), + Self::StoredDebugTransactionSet => { + gen.into_root_schema_for::() + } + Self::PersistedScpStateV0 => gen.into_root_schema_for::(), + Self::PersistedScpStateV1 => gen.into_root_schema_for::(), + Self::PersistedScpState => gen.into_root_schema_for::(), + Self::Thresholds => gen.into_root_schema_for::(), + Self::String32 => gen.into_root_schema_for::(), + Self::String64 => gen.into_root_schema_for::(), + Self::SequenceNumber => gen.into_root_schema_for::(), + Self::DataValue => gen.into_root_schema_for::(), + Self::PoolId => gen.into_root_schema_for::(), + Self::AssetCode4 => gen.into_root_schema_for::(), + Self::AssetCode12 => gen.into_root_schema_for::(), + Self::AssetType => gen.into_root_schema_for::(), + Self::AssetCode => gen.into_root_schema_for::(), + Self::AlphaNum4 => gen.into_root_schema_for::(), + Self::AlphaNum12 => gen.into_root_schema_for::(), + Self::Asset => gen.into_root_schema_for::(), + Self::Price => gen.into_root_schema_for::(), + Self::Liabilities => gen.into_root_schema_for::(), + Self::ThresholdIndexes => gen.into_root_schema_for::(), + Self::LedgerEntryType => gen.into_root_schema_for::(), + Self::Signer => gen.into_root_schema_for::(), + Self::AccountFlags => gen.into_root_schema_for::(), + Self::SponsorshipDescriptor => gen.into_root_schema_for::(), + Self::AccountEntryExtensionV3 => gen.into_root_schema_for::(), + Self::AccountEntryExtensionV2 => gen.into_root_schema_for::(), + Self::AccountEntryExtensionV2Ext => { + gen.into_root_schema_for::() + } + Self::AccountEntryExtensionV1 => gen.into_root_schema_for::(), + Self::AccountEntryExtensionV1Ext => { + gen.into_root_schema_for::() + } + Self::AccountEntry => gen.into_root_schema_for::(), + Self::AccountEntryExt => gen.into_root_schema_for::(), + Self::TrustLineFlags => gen.into_root_schema_for::(), + Self::LiquidityPoolType => gen.into_root_schema_for::(), + Self::TrustLineAsset => gen.into_root_schema_for::(), + Self::TrustLineEntryExtensionV2 => { + gen.into_root_schema_for::() + } + Self::TrustLineEntryExtensionV2Ext => { + gen.into_root_schema_for::() + } + Self::TrustLineEntry => gen.into_root_schema_for::(), + Self::TrustLineEntryExt => gen.into_root_schema_for::(), + Self::TrustLineEntryV1 => gen.into_root_schema_for::(), + Self::TrustLineEntryV1Ext => gen.into_root_schema_for::(), + Self::OfferEntryFlags => gen.into_root_schema_for::(), + Self::OfferEntry => gen.into_root_schema_for::(), + Self::OfferEntryExt => gen.into_root_schema_for::(), + Self::DataEntry => gen.into_root_schema_for::(), + Self::DataEntryExt => gen.into_root_schema_for::(), + Self::ClaimPredicateType => gen.into_root_schema_for::(), + Self::ClaimPredicate => gen.into_root_schema_for::(), + Self::ClaimantType => gen.into_root_schema_for::(), + Self::Claimant => gen.into_root_schema_for::(), + Self::ClaimantV0 => gen.into_root_schema_for::(), + Self::ClaimableBalanceIdType => gen.into_root_schema_for::(), + Self::ClaimableBalanceId => gen.into_root_schema_for::(), + Self::ClaimableBalanceFlags => gen.into_root_schema_for::(), + Self::ClaimableBalanceEntryExtensionV1 => { + gen.into_root_schema_for::() + } + Self::ClaimableBalanceEntryExtensionV1Ext => { + gen.into_root_schema_for::() + } + Self::ClaimableBalanceEntry => gen.into_root_schema_for::(), + Self::ClaimableBalanceEntryExt => { + gen.into_root_schema_for::() + } + Self::LiquidityPoolConstantProductParameters => { + gen.into_root_schema_for::() + } + Self::LiquidityPoolEntry => gen.into_root_schema_for::(), + Self::LiquidityPoolEntryBody => gen.into_root_schema_for::(), + Self::LiquidityPoolEntryConstantProduct => { + gen.into_root_schema_for::() + } + Self::ContractDataDurability => gen.into_root_schema_for::(), + Self::ContractDataEntry => gen.into_root_schema_for::(), + Self::ContractCodeCostInputs => gen.into_root_schema_for::(), + Self::ContractCodeEntry => gen.into_root_schema_for::(), + Self::ContractCodeEntryExt => gen.into_root_schema_for::(), + Self::ContractCodeEntryV1 => gen.into_root_schema_for::(), + Self::TtlEntry => gen.into_root_schema_for::(), + Self::LedgerEntryExtensionV1 => gen.into_root_schema_for::(), + Self::LedgerEntryExtensionV1Ext => { + gen.into_root_schema_for::() + } + Self::LedgerEntry => gen.into_root_schema_for::(), + Self::LedgerEntryData => gen.into_root_schema_for::(), + Self::LedgerEntryExt => gen.into_root_schema_for::(), + Self::LedgerKey => gen.into_root_schema_for::(), + Self::LedgerKeyAccount => gen.into_root_schema_for::(), + Self::LedgerKeyTrustLine => gen.into_root_schema_for::(), + Self::LedgerKeyOffer => gen.into_root_schema_for::(), + Self::LedgerKeyData => gen.into_root_schema_for::(), + Self::LedgerKeyClaimableBalance => { + gen.into_root_schema_for::() + } + Self::LedgerKeyLiquidityPool => gen.into_root_schema_for::(), + Self::LedgerKeyContractData => gen.into_root_schema_for::(), + Self::LedgerKeyContractCode => gen.into_root_schema_for::(), + Self::LedgerKeyConfigSetting => gen.into_root_schema_for::(), + Self::LedgerKeyTtl => gen.into_root_schema_for::(), + Self::EnvelopeType => gen.into_root_schema_for::(), + Self::UpgradeType => gen.into_root_schema_for::(), + Self::StellarValueType => gen.into_root_schema_for::(), + Self::LedgerCloseValueSignature => { + gen.into_root_schema_for::() + } + Self::StellarValue => gen.into_root_schema_for::(), + Self::StellarValueExt => gen.into_root_schema_for::(), + Self::LedgerHeaderFlags => gen.into_root_schema_for::(), + Self::LedgerHeaderExtensionV1 => gen.into_root_schema_for::(), + Self::LedgerHeaderExtensionV1Ext => { + gen.into_root_schema_for::() + } + Self::LedgerHeader => gen.into_root_schema_for::(), + Self::LedgerHeaderExt => gen.into_root_schema_for::(), + Self::LedgerUpgradeType => gen.into_root_schema_for::(), + Self::ConfigUpgradeSetKey => gen.into_root_schema_for::(), + Self::LedgerUpgrade => gen.into_root_schema_for::(), + Self::ConfigUpgradeSet => gen.into_root_schema_for::(), + Self::BucketEntryType => gen.into_root_schema_for::(), + Self::BucketMetadata => gen.into_root_schema_for::(), + Self::BucketMetadataExt => gen.into_root_schema_for::(), + Self::BucketEntry => gen.into_root_schema_for::(), + Self::TxSetComponentType => gen.into_root_schema_for::(), + Self::TxSetComponent => gen.into_root_schema_for::(), + Self::TxSetComponentTxsMaybeDiscountedFee => { + gen.into_root_schema_for::() + } + Self::TransactionPhase => gen.into_root_schema_for::(), + Self::TransactionSet => gen.into_root_schema_for::(), + Self::TransactionSetV1 => gen.into_root_schema_for::(), + Self::GeneralizedTransactionSet => { + gen.into_root_schema_for::() + } + Self::TransactionResultPair => gen.into_root_schema_for::(), + Self::TransactionResultSet => gen.into_root_schema_for::(), + Self::TransactionHistoryEntry => gen.into_root_schema_for::(), + Self::TransactionHistoryEntryExt => { + gen.into_root_schema_for::() + } + Self::TransactionHistoryResultEntry => { + gen.into_root_schema_for::() + } + Self::TransactionHistoryResultEntryExt => { + gen.into_root_schema_for::() + } + Self::LedgerHeaderHistoryEntry => { + gen.into_root_schema_for::() + } + Self::LedgerHeaderHistoryEntryExt => { + gen.into_root_schema_for::() + } + Self::LedgerScpMessages => gen.into_root_schema_for::(), + Self::ScpHistoryEntryV0 => gen.into_root_schema_for::(), + Self::ScpHistoryEntry => gen.into_root_schema_for::(), + Self::LedgerEntryChangeType => gen.into_root_schema_for::(), + Self::LedgerEntryChange => gen.into_root_schema_for::(), + Self::LedgerEntryChanges => gen.into_root_schema_for::(), + Self::OperationMeta => gen.into_root_schema_for::(), + Self::TransactionMetaV1 => gen.into_root_schema_for::(), + Self::TransactionMetaV2 => gen.into_root_schema_for::(), + Self::ContractEventType => gen.into_root_schema_for::(), + Self::ContractEvent => gen.into_root_schema_for::(), + Self::ContractEventBody => gen.into_root_schema_for::(), + Self::ContractEventV0 => gen.into_root_schema_for::(), + Self::DiagnosticEvent => gen.into_root_schema_for::(), + Self::SorobanTransactionMetaExtV1 => { + gen.into_root_schema_for::() + } + Self::SorobanTransactionMetaExt => { + gen.into_root_schema_for::() + } + Self::SorobanTransactionMeta => gen.into_root_schema_for::(), + Self::TransactionMetaV3 => gen.into_root_schema_for::(), + Self::InvokeHostFunctionSuccessPreImage => { + gen.into_root_schema_for::() + } + Self::TransactionMeta => gen.into_root_schema_for::(), + Self::TransactionResultMeta => gen.into_root_schema_for::(), + Self::UpgradeEntryMeta => gen.into_root_schema_for::(), + Self::LedgerCloseMetaV0 => gen.into_root_schema_for::(), + Self::LedgerCloseMetaExtV1 => gen.into_root_schema_for::(), + Self::LedgerCloseMetaExt => gen.into_root_schema_for::(), + Self::LedgerCloseMetaV1 => gen.into_root_schema_for::(), + Self::LedgerCloseMeta => gen.into_root_schema_for::(), + Self::ErrorCode => gen.into_root_schema_for::(), + Self::SError => gen.into_root_schema_for::(), + Self::SendMore => gen.into_root_schema_for::(), + Self::SendMoreExtended => gen.into_root_schema_for::(), + Self::AuthCert => gen.into_root_schema_for::(), + Self::Hello => gen.into_root_schema_for::(), + Self::Auth => gen.into_root_schema_for::(), + Self::IpAddrType => gen.into_root_schema_for::(), + Self::PeerAddress => gen.into_root_schema_for::(), + Self::PeerAddressIp => gen.into_root_schema_for::(), + Self::MessageType => gen.into_root_schema_for::(), + Self::DontHave => gen.into_root_schema_for::(), + Self::SurveyMessageCommandType => { + gen.into_root_schema_for::() + } + Self::SurveyMessageResponseType => { + gen.into_root_schema_for::() + } + Self::SurveyRequestMessage => gen.into_root_schema_for::(), + Self::SignedSurveyRequestMessage => { + gen.into_root_schema_for::() + } + Self::EncryptedBody => gen.into_root_schema_for::(), + Self::SurveyResponseMessage => gen.into_root_schema_for::(), + Self::SignedSurveyResponseMessage => { + gen.into_root_schema_for::() + } + Self::PeerStats => gen.into_root_schema_for::(), + Self::PeerStatList => gen.into_root_schema_for::(), + Self::TopologyResponseBodyV0 => gen.into_root_schema_for::(), + Self::TopologyResponseBodyV1 => gen.into_root_schema_for::(), + Self::SurveyResponseBody => gen.into_root_schema_for::(), + Self::TxAdvertVector => gen.into_root_schema_for::(), + Self::FloodAdvert => gen.into_root_schema_for::(), + Self::TxDemandVector => gen.into_root_schema_for::(), + Self::FloodDemand => gen.into_root_schema_for::(), + Self::StellarMessage => gen.into_root_schema_for::(), + Self::AuthenticatedMessage => gen.into_root_schema_for::(), + Self::AuthenticatedMessageV0 => gen.into_root_schema_for::(), + Self::LiquidityPoolParameters => gen.into_root_schema_for::(), + Self::MuxedAccount => gen.into_root_schema_for::(), + Self::MuxedAccountMed25519 => gen.into_root_schema_for::(), + Self::DecoratedSignature => gen.into_root_schema_for::(), + Self::OperationType => gen.into_root_schema_for::(), + Self::CreateAccountOp => gen.into_root_schema_for::(), + Self::PaymentOp => gen.into_root_schema_for::(), + Self::PathPaymentStrictReceiveOp => { + gen.into_root_schema_for::() + } + Self::PathPaymentStrictSendOp => gen.into_root_schema_for::(), + Self::ManageSellOfferOp => gen.into_root_schema_for::(), + Self::ManageBuyOfferOp => gen.into_root_schema_for::(), + Self::CreatePassiveSellOfferOp => { + gen.into_root_schema_for::() + } + Self::SetOptionsOp => gen.into_root_schema_for::(), + Self::ChangeTrustAsset => gen.into_root_schema_for::(), + Self::ChangeTrustOp => gen.into_root_schema_for::(), + Self::AllowTrustOp => gen.into_root_schema_for::(), + Self::ManageDataOp => gen.into_root_schema_for::(), + Self::BumpSequenceOp => gen.into_root_schema_for::(), + Self::CreateClaimableBalanceOp => { + gen.into_root_schema_for::() + } + Self::ClaimClaimableBalanceOp => gen.into_root_schema_for::(), + Self::BeginSponsoringFutureReservesOp => { + gen.into_root_schema_for::() + } + Self::RevokeSponsorshipType => gen.into_root_schema_for::(), + Self::RevokeSponsorshipOp => gen.into_root_schema_for::(), + Self::RevokeSponsorshipOpSigner => { + gen.into_root_schema_for::() + } + Self::ClawbackOp => gen.into_root_schema_for::(), + Self::ClawbackClaimableBalanceOp => { + gen.into_root_schema_for::() + } + Self::SetTrustLineFlagsOp => gen.into_root_schema_for::(), + Self::LiquidityPoolDepositOp => gen.into_root_schema_for::(), + Self::LiquidityPoolWithdrawOp => gen.into_root_schema_for::(), + Self::HostFunctionType => gen.into_root_schema_for::(), + Self::ContractIdPreimageType => gen.into_root_schema_for::(), + Self::ContractIdPreimage => gen.into_root_schema_for::(), + Self::ContractIdPreimageFromAddress => { + gen.into_root_schema_for::() + } + Self::CreateContractArgs => gen.into_root_schema_for::(), + Self::InvokeContractArgs => gen.into_root_schema_for::(), + Self::HostFunction => gen.into_root_schema_for::(), + Self::SorobanAuthorizedFunctionType => { + gen.into_root_schema_for::() + } + Self::SorobanAuthorizedFunction => { + gen.into_root_schema_for::() + } + Self::SorobanAuthorizedInvocation => { + gen.into_root_schema_for::() + } + Self::SorobanAddressCredentials => { + gen.into_root_schema_for::() + } + Self::SorobanCredentialsType => gen.into_root_schema_for::(), + Self::SorobanCredentials => gen.into_root_schema_for::(), + Self::SorobanAuthorizationEntry => { + gen.into_root_schema_for::() + } + Self::InvokeHostFunctionOp => gen.into_root_schema_for::(), + Self::ExtendFootprintTtlOp => gen.into_root_schema_for::(), + Self::RestoreFootprintOp => gen.into_root_schema_for::(), + Self::Operation => gen.into_root_schema_for::(), + Self::OperationBody => gen.into_root_schema_for::(), + Self::HashIdPreimage => gen.into_root_schema_for::(), + Self::HashIdPreimageOperationId => { + gen.into_root_schema_for::() + } + Self::HashIdPreimageRevokeId => gen.into_root_schema_for::(), + Self::HashIdPreimageContractId => { + gen.into_root_schema_for::() + } + Self::HashIdPreimageSorobanAuthorization => { + gen.into_root_schema_for::() + } + Self::MemoType => gen.into_root_schema_for::(), + Self::Memo => gen.into_root_schema_for::(), + Self::TimeBounds => gen.into_root_schema_for::(), + Self::LedgerBounds => gen.into_root_schema_for::(), + Self::PreconditionsV2 => gen.into_root_schema_for::(), + Self::PreconditionType => gen.into_root_schema_for::(), + Self::Preconditions => gen.into_root_schema_for::(), + Self::LedgerFootprint => gen.into_root_schema_for::(), + Self::SorobanResources => gen.into_root_schema_for::(), + Self::SorobanTransactionData => gen.into_root_schema_for::(), + Self::TransactionV0 => gen.into_root_schema_for::(), + Self::TransactionV0Ext => gen.into_root_schema_for::(), + Self::TransactionV0Envelope => gen.into_root_schema_for::(), + Self::Transaction => gen.into_root_schema_for::(), + Self::TransactionExt => gen.into_root_schema_for::(), + Self::TransactionV1Envelope => gen.into_root_schema_for::(), + Self::FeeBumpTransaction => gen.into_root_schema_for::(), + Self::FeeBumpTransactionInnerTx => { + gen.into_root_schema_for::() + } + Self::FeeBumpTransactionExt => gen.into_root_schema_for::(), + Self::FeeBumpTransactionEnvelope => { + gen.into_root_schema_for::() + } + Self::TransactionEnvelope => gen.into_root_schema_for::(), + Self::TransactionSignaturePayload => { + gen.into_root_schema_for::() + } + Self::TransactionSignaturePayloadTaggedTransaction => { + gen.into_root_schema_for::() + } + Self::ClaimAtomType => gen.into_root_schema_for::(), + Self::ClaimOfferAtomV0 => gen.into_root_schema_for::(), + Self::ClaimOfferAtom => gen.into_root_schema_for::(), + Self::ClaimLiquidityAtom => gen.into_root_schema_for::(), + Self::ClaimAtom => gen.into_root_schema_for::(), + Self::CreateAccountResultCode => gen.into_root_schema_for::(), + Self::CreateAccountResult => gen.into_root_schema_for::(), + Self::PaymentResultCode => gen.into_root_schema_for::(), + Self::PaymentResult => gen.into_root_schema_for::(), + Self::PathPaymentStrictReceiveResultCode => { + gen.into_root_schema_for::() + } + Self::SimplePaymentResult => gen.into_root_schema_for::(), + Self::PathPaymentStrictReceiveResult => { + gen.into_root_schema_for::() + } + Self::PathPaymentStrictReceiveResultSuccess => { + gen.into_root_schema_for::() + } + Self::PathPaymentStrictSendResultCode => { + gen.into_root_schema_for::() + } + Self::PathPaymentStrictSendResult => { + gen.into_root_schema_for::() + } + Self::PathPaymentStrictSendResultSuccess => { + gen.into_root_schema_for::() + } + Self::ManageSellOfferResultCode => { + gen.into_root_schema_for::() + } + Self::ManageOfferEffect => gen.into_root_schema_for::(), + Self::ManageOfferSuccessResult => { + gen.into_root_schema_for::() + } + Self::ManageOfferSuccessResultOffer => { + gen.into_root_schema_for::() + } + Self::ManageSellOfferResult => gen.into_root_schema_for::(), + Self::ManageBuyOfferResultCode => { + gen.into_root_schema_for::() + } + Self::ManageBuyOfferResult => gen.into_root_schema_for::(), + Self::SetOptionsResultCode => gen.into_root_schema_for::(), + Self::SetOptionsResult => gen.into_root_schema_for::(), + Self::ChangeTrustResultCode => gen.into_root_schema_for::(), + Self::ChangeTrustResult => gen.into_root_schema_for::(), + Self::AllowTrustResultCode => gen.into_root_schema_for::(), + Self::AllowTrustResult => gen.into_root_schema_for::(), + Self::AccountMergeResultCode => gen.into_root_schema_for::(), + Self::AccountMergeResult => gen.into_root_schema_for::(), + Self::InflationResultCode => gen.into_root_schema_for::(), + Self::InflationPayout => gen.into_root_schema_for::(), + Self::InflationResult => gen.into_root_schema_for::(), + Self::ManageDataResultCode => gen.into_root_schema_for::(), + Self::ManageDataResult => gen.into_root_schema_for::(), + Self::BumpSequenceResultCode => gen.into_root_schema_for::(), + Self::BumpSequenceResult => gen.into_root_schema_for::(), + Self::CreateClaimableBalanceResultCode => { + gen.into_root_schema_for::() + } + Self::CreateClaimableBalanceResult => { + gen.into_root_schema_for::() + } + Self::ClaimClaimableBalanceResultCode => { + gen.into_root_schema_for::() + } + Self::ClaimClaimableBalanceResult => { + gen.into_root_schema_for::() + } + Self::BeginSponsoringFutureReservesResultCode => { + gen.into_root_schema_for::() + } + Self::BeginSponsoringFutureReservesResult => { + gen.into_root_schema_for::() + } + Self::EndSponsoringFutureReservesResultCode => { + gen.into_root_schema_for::() + } + Self::EndSponsoringFutureReservesResult => { + gen.into_root_schema_for::() + } + Self::RevokeSponsorshipResultCode => { + gen.into_root_schema_for::() + } + Self::RevokeSponsorshipResult => gen.into_root_schema_for::(), + Self::ClawbackResultCode => gen.into_root_schema_for::(), + Self::ClawbackResult => gen.into_root_schema_for::(), + Self::ClawbackClaimableBalanceResultCode => { + gen.into_root_schema_for::() + } + Self::ClawbackClaimableBalanceResult => { + gen.into_root_schema_for::() + } + Self::SetTrustLineFlagsResultCode => { + gen.into_root_schema_for::() + } + Self::SetTrustLineFlagsResult => gen.into_root_schema_for::(), + Self::LiquidityPoolDepositResultCode => { + gen.into_root_schema_for::() + } + Self::LiquidityPoolDepositResult => { + gen.into_root_schema_for::() + } + Self::LiquidityPoolWithdrawResultCode => { + gen.into_root_schema_for::() + } + Self::LiquidityPoolWithdrawResult => { + gen.into_root_schema_for::() + } + Self::InvokeHostFunctionResultCode => { + gen.into_root_schema_for::() + } + Self::InvokeHostFunctionResult => { + gen.into_root_schema_for::() + } + Self::ExtendFootprintTtlResultCode => { + gen.into_root_schema_for::() + } + Self::ExtendFootprintTtlResult => { + gen.into_root_schema_for::() + } + Self::RestoreFootprintResultCode => { + gen.into_root_schema_for::() + } + Self::RestoreFootprintResult => gen.into_root_schema_for::(), + Self::OperationResultCode => gen.into_root_schema_for::(), + Self::OperationResult => gen.into_root_schema_for::(), + Self::OperationResultTr => gen.into_root_schema_for::(), + Self::TransactionResultCode => gen.into_root_schema_for::(), + Self::InnerTransactionResult => gen.into_root_schema_for::(), + Self::InnerTransactionResultResult => { + gen.into_root_schema_for::() + } + Self::InnerTransactionResultExt => { + gen.into_root_schema_for::() + } + Self::InnerTransactionResultPair => { + gen.into_root_schema_for::() + } + Self::TransactionResult => gen.into_root_schema_for::(), + Self::TransactionResultResult => gen.into_root_schema_for::(), + Self::TransactionResultExt => gen.into_root_schema_for::(), + Self::Hash => gen.into_root_schema_for::(), + Self::Uint256 => gen.into_root_schema_for::(), + Self::Uint32 => gen.into_root_schema_for::(), + Self::Int32 => gen.into_root_schema_for::(), + Self::Uint64 => gen.into_root_schema_for::(), + Self::Int64 => gen.into_root_schema_for::(), + Self::TimePoint => gen.into_root_schema_for::(), + Self::Duration => gen.into_root_schema_for::(), + Self::ExtensionPoint => gen.into_root_schema_for::(), + Self::CryptoKeyType => gen.into_root_schema_for::(), + Self::PublicKeyType => gen.into_root_schema_for::(), + Self::SignerKeyType => gen.into_root_schema_for::(), + Self::PublicKey => gen.into_root_schema_for::(), + Self::SignerKey => gen.into_root_schema_for::(), + Self::SignerKeyEd25519SignedPayload => { + gen.into_root_schema_for::() + } + Self::Signature => gen.into_root_schema_for::(), + Self::SignatureHint => gen.into_root_schema_for::(), + Self::NodeId => gen.into_root_schema_for::(), + Self::AccountId => gen.into_root_schema_for::(), + Self::Curve25519Secret => gen.into_root_schema_for::(), + Self::Curve25519Public => gen.into_root_schema_for::(), + Self::HmacSha256Key => gen.into_root_schema_for::(), + Self::HmacSha256Mac => gen.into_root_schema_for::(), + } + } } impl Name for TypeVariant { @@ -45048,6 +47156,7 @@ impl core::str::FromStr for TypeVariant { serde(rename_all = "snake_case"), serde(untagged) )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub enum Type { Value(Box), ScpBallot(Box), diff --git a/src/curr/jsonschema.rs b/src/curr/jsonschema.rs new file mode 100644 index 00000000..ce23b940 --- /dev/null +++ b/src/curr/jsonschema.rs @@ -0,0 +1,28 @@ +#![cfg(feature = "schemars")] +use schemars::{gen::SchemaGenerator, schema::Schema, JsonSchema}; + +macro_rules! impl_json_schema_string { + ($type:ident) => { + impl JsonSchema for super::$type { + fn schema_name() -> String { + stringify!($type).to_string() + } + + fn json_schema(gen: &mut SchemaGenerator) -> Schema { + String::json_schema(gen) + } + } + }; +} + +impl_json_schema_string!(PublicKey); +impl_json_schema_string!(AccountId); +impl_json_schema_string!(MuxedAccount); +impl_json_schema_string!(MuxedAccountMed25519); +impl_json_schema_string!(SignerKey); +impl_json_schema_string!(SignerKeyEd25519SignedPayload); +impl_json_schema_string!(NodeId); +impl_json_schema_string!(ScAddress); +impl_json_schema_string!(AssetCode); +impl_json_schema_string!(AssetCode4); +impl_json_schema_string!(AssetCode12); diff --git a/src/curr/mod.rs b/src/curr/mod.rs index 288c1e2e..ec2f1e37 100644 --- a/src/curr/mod.rs +++ b/src/curr/mod.rs @@ -1,6 +1,7 @@ mod generated; pub use generated::*; +mod jsonschema; mod str; mod scval_conversions; diff --git a/src/lib.rs b/src/lib.rs index e4c8d923..b0ac5358 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -92,6 +92,16 @@ //! ```console //! stellar-xdr decode --type BucketEntry --input stream-framed --output json-formatted bucket.xdr //! ``` +//! +//! #### Bindings +//! +//! The crate has language bindings in other languages, where the crate is +//! embedded as Wasm: +//! +//! ##### JavaScript/TypeScript +//! +//! The source repositories `bindings/js/pkg` directory contains a prebuilt +//! bundler (e.g. webpack, etc) compatible npm package. #[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Ord, Hash)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] diff --git a/src/next/generated.rs b/src/next/generated.rs index 5e1bb265..baea275c 100644 --- a/src/next/generated.rs +++ b/src/next/generated.rs @@ -956,6 +956,32 @@ impl Default for VecM { } } +#[cfg(feature = "schemars")] +impl schemars::JsonSchema for VecM { + fn schema_name() -> String { + format!("VecM<{}, {}>", T::schema_name(), MAX) + } + + fn is_referenceable() -> bool { + false + } + + fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema { + let schema = Vec::::json_schema(gen); + if let schemars::schema::Schema::Object(mut schema) = schema { + if let Some(array) = schema.array.clone() { + schema.array = Some(Box::new(schemars::schema::ArrayValidation { + max_items: Some(MAX), + ..*array + })); + } + schema.into() + } else { + schema + } + } +} + impl VecM { pub const MAX_LEN: usize = { MAX as usize }; @@ -1391,6 +1417,40 @@ impl Deref for BytesM { } } +#[cfg(feature = "schemars")] +impl schemars::JsonSchema for BytesM { + fn schema_name() -> String { + format!("BytesM<{MAX}>") + } + + fn is_referenceable() -> bool { + false + } + + fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema { + let schema = String::json_schema(gen); + if let schemars::schema::Schema::Object(mut schema) = schema { + schema.extensions.insert( + "contentEncoding".to_owned(), + serde_json::Value::String("hex".to_string()), + ); + schema.extensions.insert( + "contentMediaType".to_owned(), + serde_json::Value::String("application/binary".to_string()), + ); + let string = *schema.string.unwrap_or_default().clone(); + schema.string = Some(Box::new(schemars::schema::StringValidation { + max_length: MAX.checked_mul(2).map(Some).unwrap_or_default(), + min_length: None, + ..string + })); + schema.into() + } else { + schema + } + } +} + impl Default for BytesM { fn default() -> Self { Self(Vec::default()) @@ -1779,6 +1839,27 @@ impl Default for StringM { } } +#[cfg(feature = "schemars")] +impl schemars::JsonSchema for StringM { + fn schema_name() -> String { + format!("StringM<{MAX}>") + } + + fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema { + let schema = String::json_schema(gen); + if let schemars::schema::Schema::Object(mut schema) = schema { + let string = *schema.string.unwrap_or_default().clone(); + schema.string = Some(Box::new(schemars::schema::StringValidation { + max_length: Some(MAX), + ..string + })); + schema.into() + } else { + schema + } + } +} + impl StringM { pub const MAX_LEN: usize = { MAX as usize }; @@ -2095,6 +2176,17 @@ pub struct Frame(pub T) where T: ReadXdr; +#[cfg(feature = "schemars")] +impl schemars::JsonSchema for Frame { + fn schema_name() -> String { + format!("Frame<{}>", T::schema_name()) + } + + fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema { + T::json_schema(gen) + } +} + impl ReadXdr for Frame where T: ReadXdr, @@ -2758,6 +2850,7 @@ mod test { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[derive(Debug)] pub struct Value(pub BytesM); @@ -2866,6 +2959,7 @@ impl AsRef<[u8]> for Value { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScpBallot { pub counter: u32, pub value: Value, @@ -2914,6 +3008,7 @@ impl WriteXdr for ScpBallot { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ScpStatementType { Prepare = 0, @@ -3030,6 +3125,7 @@ impl WriteXdr for ScpStatementType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScpNomination { pub quorum_set_hash: Hash, pub votes: VecM, @@ -3082,6 +3178,7 @@ impl WriteXdr for ScpNomination { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScpStatementPrepare { pub quorum_set_hash: Hash, pub ballot: ScpBallot, @@ -3142,6 +3239,7 @@ impl WriteXdr for ScpStatementPrepare { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScpStatementConfirm { pub ballot: ScpBallot, pub n_prepared: u32, @@ -3197,6 +3295,7 @@ impl WriteXdr for ScpStatementConfirm { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScpStatementExternalize { pub commit: ScpBallot, pub n_h: u32, @@ -3272,6 +3371,7 @@ impl WriteXdr for ScpStatementExternalize { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ScpStatementPledges { Prepare(ScpStatementPrepare), @@ -3426,6 +3526,7 @@ impl WriteXdr for ScpStatementPledges { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScpStatement { pub node_id: NodeId, pub slot_index: u64, @@ -3474,6 +3575,7 @@ impl WriteXdr for ScpStatement { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScpEnvelope { pub statement: ScpStatement, pub signature: Signature, @@ -3520,6 +3622,7 @@ impl WriteXdr for ScpEnvelope { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScpQuorumSet { pub threshold: u32, pub validators: VecM, @@ -3568,6 +3671,7 @@ impl WriteXdr for ScpQuorumSet { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ConfigSettingContractExecutionLanesV0 { pub ledger_max_tx_count: u32, } @@ -3618,6 +3722,7 @@ impl WriteXdr for ConfigSettingContractExecutionLanesV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ConfigSettingContractComputeV0 { pub ledger_max_instructions: i64, pub tx_max_instructions: i64, @@ -3699,6 +3804,7 @@ impl WriteXdr for ConfigSettingContractComputeV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ConfigSettingContractLedgerCostV0 { pub ledger_max_read_ledger_entries: u32, pub ledger_max_read_bytes: u32, @@ -3782,6 +3888,7 @@ impl WriteXdr for ConfigSettingContractLedgerCostV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ConfigSettingContractHistoricalDataV0 { pub fee_historical1_kb: i64, } @@ -3826,6 +3933,7 @@ impl WriteXdr for ConfigSettingContractHistoricalDataV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ConfigSettingContractEventsV0 { pub tx_max_contract_events_size_bytes: u32, pub fee_contract_events1_kb: i64, @@ -3876,6 +3984,7 @@ impl WriteXdr for ConfigSettingContractEventsV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ConfigSettingContractBandwidthV0 { pub ledger_max_txs_size_bytes: u32, pub tx_max_size_bytes: u32, @@ -4021,6 +4130,7 @@ impl WriteXdr for ConfigSettingContractBandwidthV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ContractCostType { WasmInsnExec = 0, @@ -4348,6 +4458,7 @@ impl WriteXdr for ContractCostType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ContractCostParamEntry { pub ext: ExtensionPoint, pub const_term: i64, @@ -4415,6 +4526,7 @@ impl WriteXdr for ContractCostParamEntry { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct StateArchivalSettings { pub max_entry_ttl: u32, pub min_temporary_ttl: u32, @@ -4484,6 +4596,7 @@ impl WriteXdr for StateArchivalSettings { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct EvictionIterator { pub bucket_list_level: u32, pub is_curr_bucket: bool, @@ -4537,6 +4650,7 @@ pub const CONTRACT_COST_COUNT_LIMIT: u64 = 1024; derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[derive(Debug)] pub struct ContractCostParams(pub VecM); @@ -4658,6 +4772,7 @@ impl AsRef<[ContractCostParamEntry]> for ContractCostParams { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ConfigSettingId { ContractMaxSizeBytes = 0, @@ -4855,6 +4970,7 @@ impl WriteXdr for ConfigSettingId { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ConfigSettingEntry { ContractMaxSizeBytes(u32), @@ -5081,6 +5197,7 @@ impl WriteXdr for ConfigSettingEntry { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ScEnvMetaKind { ScEnvMetaKindInterfaceVersion = 0, @@ -5183,6 +5300,7 @@ impl WriteXdr for ScEnvMetaKind { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ScEnvMetaEntry { ScEnvMetaKindInterfaceVersion(u64), @@ -5284,6 +5402,7 @@ impl WriteXdr for ScEnvMetaEntry { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScMetaV0 { pub key: StringM, pub val: StringM, @@ -5329,6 +5448,7 @@ impl WriteXdr for ScMetaV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ScMetaKind { ScMetaV0 = 0, @@ -5431,6 +5551,7 @@ impl WriteXdr for ScMetaKind { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ScMetaEntry { ScMetaV0(ScMetaV0), @@ -5568,6 +5689,7 @@ pub const SC_SPEC_DOC_LIMIT: u64 = 1024; derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ScSpecType { Val = 0, @@ -5792,6 +5914,7 @@ impl WriteXdr for ScSpecType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScSpecTypeOption { pub value_type: Box, } @@ -5834,6 +5957,7 @@ impl WriteXdr for ScSpecTypeOption { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScSpecTypeResult { pub ok_type: Box, pub error_type: Box, @@ -5878,6 +6002,7 @@ impl WriteXdr for ScSpecTypeResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScSpecTypeVec { pub element_type: Box, } @@ -5920,6 +6045,7 @@ impl WriteXdr for ScSpecTypeVec { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScSpecTypeMap { pub key_type: Box, pub value_type: Box, @@ -5964,6 +6090,7 @@ impl WriteXdr for ScSpecTypeMap { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScSpecTypeTuple { pub value_types: VecM, } @@ -6005,6 +6132,7 @@ impl WriteXdr for ScSpecTypeTuple { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScSpecTypeBytesN { pub n: u32, } @@ -6046,6 +6174,7 @@ impl WriteXdr for ScSpecTypeBytesN { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScSpecTypeUdt { pub name: StringM<60>, } @@ -6120,6 +6249,7 @@ impl WriteXdr for ScSpecTypeUdt { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ScSpecTypeDef { Val, @@ -6392,6 +6522,7 @@ impl WriteXdr for ScSpecTypeDef { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScSpecUdtStructFieldV0 { pub doc: StringM<1024>, pub name: StringM<30>, @@ -6442,6 +6573,7 @@ impl WriteXdr for ScSpecUdtStructFieldV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScSpecUdtStructV0 { pub doc: StringM<1024>, pub lib: StringM<80>, @@ -6493,6 +6625,7 @@ impl WriteXdr for ScSpecUdtStructV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScSpecUdtUnionCaseVoidV0 { pub doc: StringM<1024>, pub name: StringM<60>, @@ -6539,6 +6672,7 @@ impl WriteXdr for ScSpecUdtUnionCaseVoidV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScSpecUdtUnionCaseTupleV0 { pub doc: StringM<1024>, pub name: StringM<60>, @@ -6588,6 +6722,7 @@ impl WriteXdr for ScSpecUdtUnionCaseTupleV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ScSpecUdtUnionCaseV0Kind { VoidV0 = 0, @@ -6698,6 +6833,7 @@ impl WriteXdr for ScSpecUdtUnionCaseV0Kind { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ScSpecUdtUnionCaseV0 { VoidV0(ScSpecUdtUnionCaseVoidV0), @@ -6811,6 +6947,7 @@ impl WriteXdr for ScSpecUdtUnionCaseV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScSpecUdtUnionV0 { pub doc: StringM<1024>, pub lib: StringM<80>, @@ -6863,6 +7000,7 @@ impl WriteXdr for ScSpecUdtUnionV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScSpecUdtEnumCaseV0 { pub doc: StringM<1024>, pub name: StringM<60>, @@ -6913,6 +7051,7 @@ impl WriteXdr for ScSpecUdtEnumCaseV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScSpecUdtEnumV0 { pub doc: StringM<1024>, pub lib: StringM<80>, @@ -6965,6 +7104,7 @@ impl WriteXdr for ScSpecUdtEnumV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScSpecUdtErrorEnumCaseV0 { pub doc: StringM<1024>, pub name: StringM<60>, @@ -7015,6 +7155,7 @@ impl WriteXdr for ScSpecUdtErrorEnumCaseV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScSpecUdtErrorEnumV0 { pub doc: StringM<1024>, pub lib: StringM<80>, @@ -7067,6 +7208,7 @@ impl WriteXdr for ScSpecUdtErrorEnumV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScSpecFunctionInputV0 { pub doc: StringM<1024>, pub name: StringM<30>, @@ -7117,6 +7259,7 @@ impl WriteXdr for ScSpecFunctionInputV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScSpecFunctionV0 { pub doc: StringM<1024>, pub name: ScSymbol, @@ -7172,6 +7315,7 @@ impl WriteXdr for ScSpecFunctionV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ScSpecEntryKind { FunctionV0 = 0, @@ -7306,6 +7450,7 @@ impl WriteXdr for ScSpecEntryKind { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ScSpecEntry { FunctionV0(ScSpecFunctionV0), @@ -7489,6 +7634,7 @@ impl WriteXdr for ScSpecEntry { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ScValType { Bool = 0, @@ -7708,6 +7854,7 @@ impl WriteXdr for ScValType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ScErrorType { Contract = 0, @@ -7859,6 +8006,7 @@ impl WriteXdr for ScErrorType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ScErrorCode { ArithDomain = 0, @@ -8020,6 +8168,7 @@ impl WriteXdr for ScErrorCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ScError { Contract(u32), @@ -8177,6 +8326,7 @@ impl WriteXdr for ScError { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct UInt128Parts { pub hi: u64, pub lo: u64, @@ -8221,6 +8371,7 @@ impl WriteXdr for UInt128Parts { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct Int128Parts { pub hi: i64, pub lo: u64, @@ -8267,6 +8418,7 @@ impl WriteXdr for Int128Parts { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct UInt256Parts { pub hi_hi: u64, pub hi_lo: u64, @@ -8319,6 +8471,7 @@ impl WriteXdr for UInt256Parts { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct Int256Parts { pub hi_hi: i64, pub hi_lo: u64, @@ -8371,6 +8524,7 @@ impl WriteXdr for Int256Parts { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ContractExecutableType { Wasm = 0, @@ -8481,6 +8635,7 @@ impl WriteXdr for ContractExecutableType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ContractExecutable { Wasm(Hash), @@ -8589,6 +8744,7 @@ impl WriteXdr for ContractExecutable { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ScAddressType { Account = 0, @@ -8804,6 +8960,7 @@ pub const SCSYMBOL_LIMIT: u64 = 32; derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[derive(Debug)] pub struct ScVec(pub VecM); @@ -8909,6 +9066,7 @@ impl AsRef<[ScVal]> for ScVec { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[derive(Debug)] pub struct ScMap(pub VecM); @@ -9014,6 +9172,7 @@ impl AsRef<[ScMapEntry]> for ScMap { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[derive(Debug)] pub struct ScBytes(pub BytesM); @@ -9119,6 +9278,7 @@ impl AsRef<[u8]> for ScBytes { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[derive(Debug)] pub struct ScString(pub StringM); @@ -9224,6 +9384,7 @@ impl AsRef<[u8]> for ScString { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[derive(Debug)] pub struct ScSymbol(pub StringM<32>); @@ -9330,6 +9491,7 @@ impl AsRef<[u8]> for ScSymbol { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScNonceKey { pub nonce: i64, } @@ -9371,6 +9533,7 @@ impl WriteXdr for ScNonceKey { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScContractInstance { pub executable: ContractExecutable, pub storage: Option, @@ -9473,6 +9636,7 @@ impl WriteXdr for ScContractInstance { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ScVal { Bool(bool), @@ -9725,6 +9889,7 @@ impl WriteXdr for ScVal { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScMapEntry { pub key: ScVal, pub val: ScVal, @@ -9773,6 +9938,7 @@ impl WriteXdr for ScMapEntry { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum StoredTransactionSet { V0(TransactionSet), @@ -9878,6 +10044,7 @@ impl WriteXdr for StoredTransactionSet { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct StoredDebugTransactionSet { pub tx_set: StoredTransactionSet, pub ledger_seq: u32, @@ -9927,6 +10094,7 @@ impl WriteXdr for StoredDebugTransactionSet { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct PersistedScpStateV0 { pub scp_envelopes: VecM, pub quorum_sets: VecM, @@ -9976,6 +10144,7 @@ impl WriteXdr for PersistedScpStateV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct PersistedScpStateV1 { pub scp_envelopes: VecM, pub quorum_sets: VecM, @@ -10024,6 +10193,7 @@ impl WriteXdr for PersistedScpStateV1 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum PersistedScpState { V0(PersistedScpStateV0), @@ -10153,6 +10323,39 @@ impl core::str::FromStr for Thresholds { hex::decode(s).map_err(|_| Error::InvalidHex)?.try_into() } } +#[cfg(feature = "schemars")] +impl schemars::JsonSchema for Thresholds { + fn schema_name() -> String { + "Thresholds".to_string() + } + + fn is_referenceable() -> bool { + false + } + + fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema { + let schema = String::json_schema(gen); + if let schemars::schema::Schema::Object(mut schema) = schema { + schema.extensions.insert( + "contentEncoding".to_owned(), + serde_json::Value::String("hex".to_string()), + ); + schema.extensions.insert( + "contentMediaType".to_owned(), + serde_json::Value::String("application/binary".to_string()), + ); + let string = *schema.string.unwrap_or_default().clone(); + schema.string = Some(Box::new(schemars::schema::StringValidation { + max_length: 4_u32.checked_mul(2).map(Some).unwrap_or_default(), + min_length: 4_u32.checked_mul(2).map(Some).unwrap_or_default(), + ..string + })); + schema.into() + } else { + schema + } + } +} impl From for [u8; 4] { #[must_use] fn from(x: Thresholds) -> Self { @@ -10243,6 +10446,7 @@ impl AsRef<[u8]> for Thresholds { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[derive(Debug)] pub struct String32(pub StringM<32>); @@ -10348,6 +10552,7 @@ impl AsRef<[u8]> for String32 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[derive(Debug)] pub struct String64(pub StringM<64>); @@ -10452,6 +10657,7 @@ impl AsRef<[u8]> for String64 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[derive(Debug)] pub struct SequenceNumber(pub i64); @@ -10508,6 +10714,7 @@ impl WriteXdr for SequenceNumber { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[derive(Debug)] pub struct DataValue(pub BytesM<64>); @@ -10612,6 +10819,7 @@ impl AsRef<[u8]> for DataValue { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[derive(Debug)] pub struct PoolId(pub Hash); @@ -10876,6 +11084,7 @@ impl AsRef<[u8]> for AssetCode12 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum AssetType { Native = 0, @@ -11101,6 +11310,7 @@ impl WriteXdr for AssetCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct AlphaNum4 { pub asset_code: AssetCode4, pub issuer: AccountId, @@ -11146,6 +11356,7 @@ impl WriteXdr for AlphaNum4 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct AlphaNum12 { pub asset_code: AssetCode12, pub issuer: AccountId, @@ -11200,6 +11411,7 @@ impl WriteXdr for AlphaNum12 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum Asset { Native, @@ -11313,6 +11525,7 @@ impl WriteXdr for Asset { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct Price { pub n: i32, pub d: i32, @@ -11358,6 +11571,7 @@ impl WriteXdr for Price { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct Liabilities { pub buying: i64, pub selling: i64, @@ -11406,6 +11620,7 @@ impl WriteXdr for Liabilities { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ThresholdIndexes { MasterWeight = 0, @@ -11530,6 +11745,7 @@ impl WriteXdr for ThresholdIndexes { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum LedgerEntryType { Account = 0, @@ -11680,6 +11896,7 @@ impl WriteXdr for LedgerEntryType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct Signer { pub key: SignerKey, pub weight: u32, @@ -11738,6 +11955,7 @@ impl WriteXdr for Signer { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum AccountFlags { RequiredFlag = 1, @@ -11878,6 +12096,7 @@ pub const MAX_SIGNERS: u64 = 20; derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[derive(Debug)] pub struct SponsorshipDescriptor(pub Option); @@ -11944,6 +12163,7 @@ impl WriteXdr for SponsorshipDescriptor { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct AccountEntryExtensionV3 { pub ext: ExtensionPoint, pub seq_ledger: u32, @@ -11995,6 +12215,7 @@ impl WriteXdr for AccountEntryExtensionV3 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum AccountEntryExtensionV2Ext { V0, @@ -12109,6 +12330,7 @@ impl WriteXdr for AccountEntryExtensionV2Ext { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct AccountEntryExtensionV2 { pub num_sponsored: u32, pub num_sponsoring: u32, @@ -12163,6 +12385,7 @@ impl WriteXdr for AccountEntryExtensionV2 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum AccountEntryExtensionV1Ext { V0, @@ -12275,6 +12498,7 @@ impl WriteXdr for AccountEntryExtensionV1Ext { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct AccountEntryExtensionV1 { pub liabilities: Liabilities, pub ext: AccountEntryExtensionV1Ext, @@ -12323,6 +12547,7 @@ impl WriteXdr for AccountEntryExtensionV1 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum AccountEntryExt { V0, @@ -12450,6 +12675,7 @@ impl WriteXdr for AccountEntryExt { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct AccountEntry { pub account_id: AccountId, pub balance: i64, @@ -12526,6 +12752,7 @@ impl WriteXdr for AccountEntry { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum TrustLineFlags { AuthorizedFlag = 1, @@ -12665,6 +12892,7 @@ pub const MASK_TRUSTLINE_FLAGS_V17: u64 = 7; derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum LiquidityPoolType { LiquidityPoolConstantProduct = 0, @@ -12778,6 +13006,7 @@ impl WriteXdr for LiquidityPoolType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum TrustLineAsset { Native, @@ -12899,6 +13128,7 @@ impl WriteXdr for TrustLineAsset { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum TrustLineEntryExtensionV2Ext { V0, @@ -13004,6 +13234,7 @@ impl WriteXdr for TrustLineEntryExtensionV2Ext { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct TrustLineEntryExtensionV2 { pub liquidity_pool_use_count: i32, pub ext: TrustLineEntryExtensionV2Ext, @@ -13052,6 +13283,7 @@ impl WriteXdr for TrustLineEntryExtensionV2 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum TrustLineEntryV1Ext { V0, @@ -13164,6 +13396,7 @@ impl WriteXdr for TrustLineEntryV1Ext { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct TrustLineEntryV1 { pub liabilities: Liabilities, pub ext: TrustLineEntryV1Ext, @@ -13224,6 +13457,7 @@ impl WriteXdr for TrustLineEntryV1 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum TrustLineEntryExt { V0, @@ -13355,6 +13589,7 @@ impl WriteXdr for TrustLineEntryExt { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct TrustLineEntry { pub account_id: AccountId, pub asset: TrustLineAsset, @@ -13414,6 +13649,7 @@ impl WriteXdr for TrustLineEntry { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum OfferEntryFlags { PassiveFlag = 1, @@ -13524,6 +13760,7 @@ pub const MASK_OFFERENTRY_FLAGS: u64 = 1; derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum OfferEntryExt { V0, @@ -13642,6 +13879,7 @@ impl WriteXdr for OfferEntryExt { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct OfferEntry { pub seller_id: AccountId, pub offer_id: i64, @@ -13706,6 +13944,7 @@ impl WriteXdr for OfferEntry { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum DataEntryExt { V0, @@ -13814,6 +14053,7 @@ impl WriteXdr for DataEntryExt { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct DataEntry { pub account_id: AccountId, pub data_name: String64, @@ -13870,6 +14110,7 @@ impl WriteXdr for DataEntry { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ClaimPredicateType { Unconditional = 0, @@ -14012,6 +14253,7 @@ impl WriteXdr for ClaimPredicateType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ClaimPredicate { Unconditional, @@ -14154,6 +14396,7 @@ impl WriteXdr for ClaimPredicate { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ClaimantType { ClaimantTypeV0 = 0, @@ -14255,6 +14498,7 @@ impl WriteXdr for ClaimantType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ClaimantV0 { pub destination: AccountId, pub predicate: ClaimPredicate, @@ -14305,6 +14549,7 @@ impl WriteXdr for ClaimantV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum Claimant { ClaimantTypeV0(ClaimantV0), @@ -14404,6 +14649,7 @@ impl WriteXdr for Claimant { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ClaimableBalanceIdType { ClaimableBalanceIdTypeV0 = 0, @@ -14507,6 +14753,7 @@ impl WriteXdr for ClaimableBalanceIdType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ClaimableBalanceId { ClaimableBalanceIdTypeV0(Hash), @@ -14611,6 +14858,7 @@ impl WriteXdr for ClaimableBalanceId { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ClaimableBalanceFlags { ClaimableBalanceClawbackEnabledFlag = 1, @@ -14722,6 +14970,7 @@ pub const MASK_CLAIMABLE_BALANCE_FLAGS: u64 = 0x1; derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ClaimableBalanceEntryExtensionV1Ext { V0, @@ -14827,6 +15076,7 @@ impl WriteXdr for ClaimableBalanceEntryExtensionV1Ext { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ClaimableBalanceEntryExtensionV1 { pub ext: ClaimableBalanceEntryExtensionV1Ext, pub flags: u32, @@ -14875,6 +15125,7 @@ impl WriteXdr for ClaimableBalanceEntryExtensionV1 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ClaimableBalanceEntryExt { V0, @@ -14998,6 +15249,7 @@ impl WriteXdr for ClaimableBalanceEntryExt { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ClaimableBalanceEntry { pub balance_id: ClaimableBalanceId, pub claimants: VecM, @@ -15053,6 +15305,7 @@ impl WriteXdr for ClaimableBalanceEntry { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LiquidityPoolConstantProductParameters { pub asset_a: Asset, pub asset_b: Asset, @@ -15106,6 +15359,7 @@ impl WriteXdr for LiquidityPoolConstantProductParameters { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LiquidityPoolEntryConstantProduct { pub params: LiquidityPoolConstantProductParameters, pub reserve_a: i64, @@ -15170,6 +15424,7 @@ impl WriteXdr for LiquidityPoolEntryConstantProduct { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum LiquidityPoolEntryBody { LiquidityPoolConstantProduct(LiquidityPoolEntryConstantProduct), @@ -15290,6 +15545,7 @@ impl WriteXdr for LiquidityPoolEntryBody { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LiquidityPoolEntry { pub liquidity_pool_id: PoolId, pub body: LiquidityPoolEntryBody, @@ -15335,6 +15591,7 @@ impl WriteXdr for LiquidityPoolEntry { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ContractDataDurability { Temporary = 0, @@ -15445,6 +15702,7 @@ impl WriteXdr for ContractDataDurability { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ContractDataEntry { pub ext: ExtensionPoint, pub contract: ScAddress, @@ -15507,6 +15765,7 @@ impl WriteXdr for ContractDataEntry { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ContractCodeCostInputs { pub ext: ExtensionPoint, pub n_instructions: u32, @@ -15579,6 +15838,7 @@ impl WriteXdr for ContractCodeCostInputs { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ContractCodeEntryV1 { pub ext: ExtensionPoint, pub cost_inputs: ContractCodeCostInputs, @@ -15631,6 +15891,7 @@ impl WriteXdr for ContractCodeEntryV1 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ContractCodeEntryExt { V0, @@ -15746,6 +16007,7 @@ impl WriteXdr for ContractCodeEntryExt { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ContractCodeEntry { pub ext: ContractCodeEntryExt, pub hash: Hash, @@ -15794,6 +16056,7 @@ impl WriteXdr for ContractCodeEntry { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct TtlEntry { pub key_hash: Hash, pub live_until_ledger_seq: u32, @@ -15840,6 +16103,7 @@ impl WriteXdr for TtlEntry { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum LedgerEntryExtensionV1Ext { V0, @@ -15945,6 +16209,7 @@ impl WriteXdr for LedgerEntryExtensionV1Ext { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LedgerEntryExtensionV1 { pub sponsoring_id: SponsorshipDescriptor, pub ext: LedgerEntryExtensionV1Ext, @@ -16009,6 +16274,7 @@ impl WriteXdr for LedgerEntryExtensionV1 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum LedgerEntryData { Account(AccountEntry), @@ -16188,6 +16454,7 @@ impl WriteXdr for LedgerEntryData { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum LedgerEntryExt { V0, @@ -16326,6 +16593,7 @@ impl WriteXdr for LedgerEntryExt { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LedgerEntry { pub last_modified_ledger_seq: u32, pub data: LedgerEntryData, @@ -16373,6 +16641,7 @@ impl WriteXdr for LedgerEntry { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LedgerKeyAccount { pub account_id: AccountId, } @@ -16415,6 +16684,7 @@ impl WriteXdr for LedgerKeyAccount { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LedgerKeyTrustLine { pub account_id: AccountId, pub asset: TrustLineAsset, @@ -16460,6 +16730,7 @@ impl WriteXdr for LedgerKeyTrustLine { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LedgerKeyOffer { pub seller_id: AccountId, pub offer_id: i64, @@ -16505,6 +16776,7 @@ impl WriteXdr for LedgerKeyOffer { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LedgerKeyData { pub account_id: AccountId, pub data_name: String64, @@ -16549,6 +16821,7 @@ impl WriteXdr for LedgerKeyData { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LedgerKeyClaimableBalance { pub balance_id: ClaimableBalanceId, } @@ -16590,6 +16863,7 @@ impl WriteXdr for LedgerKeyClaimableBalance { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LedgerKeyLiquidityPool { pub liquidity_pool_id: PoolId, } @@ -16633,6 +16907,7 @@ impl WriteXdr for LedgerKeyLiquidityPool { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LedgerKeyContractData { pub contract: ScAddress, pub key: ScVal, @@ -16680,6 +16955,7 @@ impl WriteXdr for LedgerKeyContractData { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LedgerKeyContractCode { pub hash: Hash, } @@ -16721,6 +16997,7 @@ impl WriteXdr for LedgerKeyContractCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LedgerKeyConfigSetting { pub config_setting_id: ConfigSettingId, } @@ -16763,6 +17040,7 @@ impl WriteXdr for LedgerKeyConfigSetting { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LedgerKeyTtl { pub key_hash: Hash, } @@ -16865,6 +17143,7 @@ impl WriteXdr for LedgerKeyTtl { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum LedgerKey { Account(LedgerKeyAccount), @@ -17050,6 +17329,7 @@ impl WriteXdr for LedgerKey { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum EnvelopeType { TxV0 = 0, @@ -17197,6 +17477,7 @@ impl WriteXdr for EnvelopeType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[derive(Debug)] pub struct UpgradeType(pub BytesM<128>); @@ -17306,6 +17587,7 @@ impl AsRef<[u8]> for UpgradeType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum StellarValueType { Basic = 0, @@ -17410,6 +17692,7 @@ impl WriteXdr for StellarValueType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LedgerCloseValueSignature { pub node_id: NodeId, pub signature: Signature, @@ -17458,6 +17741,7 @@ impl WriteXdr for LedgerCloseValueSignature { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum StellarValueExt { Basic, @@ -17579,6 +17863,7 @@ impl WriteXdr for StellarValueExt { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct StellarValue { pub tx_set_hash: Hash, pub close_time: TimePoint, @@ -17640,6 +17925,7 @@ pub const MASK_LEDGER_HEADER_FLAGS: u64 = 0x7; derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum LedgerHeaderFlags { TradingFlag = 1, @@ -17752,6 +18038,7 @@ impl WriteXdr for LedgerHeaderFlags { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum LedgerHeaderExtensionV1Ext { V0, @@ -17857,6 +18144,7 @@ impl WriteXdr for LedgerHeaderExtensionV1Ext { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LedgerHeaderExtensionV1 { pub flags: u32, pub ext: LedgerHeaderExtensionV1Ext, @@ -17905,6 +18193,7 @@ impl WriteXdr for LedgerHeaderExtensionV1 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum LedgerHeaderExt { V0, @@ -18043,6 +18332,7 @@ impl WriteXdr for LedgerHeaderExt { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LedgerHeader { pub ledger_version: u32, pub previous_ledger_hash: Hash, @@ -18133,6 +18423,7 @@ impl WriteXdr for LedgerHeader { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum LedgerUpgradeType { Version = 1, @@ -18267,6 +18558,7 @@ impl WriteXdr for LedgerUpgradeType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ConfigUpgradeSetKey { pub contract_id: Hash, pub content_hash: Hash, @@ -18328,6 +18620,7 @@ impl WriteXdr for ConfigUpgradeSetKey { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum LedgerUpgrade { Version(u32), @@ -18473,6 +18766,7 @@ impl WriteXdr for LedgerUpgrade { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ConfigUpgradeSet { pub updated_entry: VecM, } @@ -18520,6 +18814,7 @@ impl WriteXdr for ConfigUpgradeSet { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum BucketEntryType { Metaentry = -1, @@ -18637,6 +18932,7 @@ impl WriteXdr for BucketEntryType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum BucketMetadataExt { V0, @@ -18744,6 +19040,7 @@ impl WriteXdr for BucketMetadataExt { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct BucketMetadata { pub ledger_version: u32, pub ext: BucketMetadataExt, @@ -18796,6 +19093,7 @@ impl WriteXdr for BucketMetadata { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum BucketEntry { Liveentry(LedgerEntry), @@ -18918,6 +19216,7 @@ impl WriteXdr for BucketEntry { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum TxSetComponentType { TxsetCompTxsMaybeDiscountedFee = 0, @@ -19020,6 +19319,7 @@ impl WriteXdr for TxSetComponentType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct TxSetComponentTxsMaybeDiscountedFee { pub base_fee: Option, pub txs: VecM, @@ -19070,6 +19370,7 @@ impl WriteXdr for TxSetComponentTxsMaybeDiscountedFee { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum TxSetComponent { TxsetCompTxsMaybeDiscountedFee(TxSetComponentTxsMaybeDiscountedFee), @@ -19177,6 +19478,7 @@ impl WriteXdr for TxSetComponent { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum TransactionPhase { V0(VecM), @@ -19276,6 +19578,7 @@ impl WriteXdr for TransactionPhase { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct TransactionSet { pub previous_ledger_hash: Hash, pub txs: VecM, @@ -19321,6 +19624,7 @@ impl WriteXdr for TransactionSet { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct TransactionSetV1 { pub previous_ledger_hash: Hash, pub phases: VecM, @@ -19368,6 +19672,7 @@ impl WriteXdr for TransactionSetV1 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum GeneralizedTransactionSet { V1(TransactionSetV1), @@ -19467,6 +19772,7 @@ impl WriteXdr for GeneralizedTransactionSet { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct TransactionResultPair { pub transaction_hash: Hash, pub result: TransactionResult, @@ -19511,6 +19817,7 @@ impl WriteXdr for TransactionResultPair { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct TransactionResultSet { pub results: VecM, } @@ -19556,6 +19863,7 @@ impl WriteXdr for TransactionResultSet { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum TransactionHistoryEntryExt { V0, @@ -19670,6 +19978,7 @@ impl WriteXdr for TransactionHistoryEntryExt { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct TransactionHistoryEntry { pub ledger_seq: u32, pub tx_set: TransactionSet, @@ -19719,6 +20028,7 @@ impl WriteXdr for TransactionHistoryEntry { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum TransactionHistoryResultEntryExt { V0, @@ -19826,6 +20136,7 @@ impl WriteXdr for TransactionHistoryResultEntryExt { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct TransactionHistoryResultEntry { pub ledger_seq: u32, pub tx_result_set: TransactionResultSet, @@ -19875,6 +20186,7 @@ impl WriteXdr for TransactionHistoryResultEntry { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum LedgerHeaderHistoryEntryExt { V0, @@ -19982,6 +20294,7 @@ impl WriteXdr for LedgerHeaderHistoryEntryExt { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LedgerHeaderHistoryEntry { pub hash: Hash, pub header: LedgerHeader, @@ -20030,6 +20343,7 @@ impl WriteXdr for LedgerHeaderHistoryEntry { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LedgerScpMessages { pub ledger_seq: u32, pub messages: VecM, @@ -20075,6 +20389,7 @@ impl WriteXdr for LedgerScpMessages { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ScpHistoryEntryV0 { pub quorum_sets: VecM, pub ledger_messages: LedgerScpMessages, @@ -20121,6 +20436,7 @@ impl WriteXdr for ScpHistoryEntryV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ScpHistoryEntry { V0(ScpHistoryEntryV0), @@ -20223,6 +20539,7 @@ impl WriteXdr for ScpHistoryEntry { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum LedgerEntryChangeType { Created = 0, @@ -20345,6 +20662,7 @@ impl WriteXdr for LedgerEntryChangeType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum LedgerEntryChange { Created(LedgerEntry), @@ -20461,6 +20779,7 @@ impl WriteXdr for LedgerEntryChange { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[derive(Debug)] pub struct LedgerEntryChanges(pub VecM); @@ -20568,6 +20887,7 @@ impl AsRef<[LedgerEntryChange]> for LedgerEntryChanges { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct OperationMeta { pub changes: LedgerEntryChanges, } @@ -20610,6 +20930,7 @@ impl WriteXdr for OperationMeta { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct TransactionMetaV1 { pub tx_changes: LedgerEntryChanges, pub operations: VecM, @@ -20658,6 +20979,7 @@ impl WriteXdr for TransactionMetaV1 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct TransactionMetaV2 { pub tx_changes_before: LedgerEntryChanges, pub operations: VecM, @@ -20708,6 +21030,7 @@ impl WriteXdr for TransactionMetaV2 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ContractEventType { System = 0, @@ -20819,6 +21142,7 @@ impl WriteXdr for ContractEventType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ContractEventV0 { pub topics: VecM, pub data: ScVal, @@ -20869,6 +21193,7 @@ impl WriteXdr for ContractEventV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ContractEventBody { V0(ContractEventV0), @@ -20983,6 +21308,7 @@ impl WriteXdr for ContractEventBody { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ContractEvent { pub ext: ExtensionPoint, pub contract_id: Option, @@ -21034,6 +21360,7 @@ impl WriteXdr for ContractEvent { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct DiagnosticEvent { pub in_successful_contract_call: bool, pub event: ContractEvent, @@ -21107,6 +21434,7 @@ impl WriteXdr for DiagnosticEvent { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct SorobanTransactionMetaExtV1 { pub ext: ExtensionPoint, pub total_non_refundable_resource_fee_charged: i64, @@ -21162,6 +21490,7 @@ impl WriteXdr for SorobanTransactionMetaExtV1 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum SorobanTransactionMetaExt { V0, @@ -21274,6 +21603,7 @@ impl WriteXdr for SorobanTransactionMetaExt { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct SorobanTransactionMeta { pub ext: SorobanTransactionMetaExt, pub events: VecM, @@ -21332,6 +21662,7 @@ impl WriteXdr for SorobanTransactionMeta { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct TransactionMetaV3 { pub ext: ExtensionPoint, pub tx_changes_before: LedgerEntryChanges, @@ -21386,6 +21717,7 @@ impl WriteXdr for TransactionMetaV3 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct InvokeHostFunctionSuccessPreImage { pub return_value: ScVal, pub events: VecM, @@ -21438,6 +21770,7 @@ impl WriteXdr for InvokeHostFunctionSuccessPreImage { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum TransactionMeta { V0(VecM), @@ -21553,6 +21886,7 @@ impl WriteXdr for TransactionMeta { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct TransactionResultMeta { pub result: TransactionResultPair, pub fee_processing: LedgerEntryChanges, @@ -21601,6 +21935,7 @@ impl WriteXdr for TransactionResultMeta { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct UpgradeEntryMeta { pub upgrade: LedgerUpgrade, pub changes: LedgerEntryChanges, @@ -21658,6 +21993,7 @@ impl WriteXdr for UpgradeEntryMeta { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LedgerCloseMetaV0 { pub ledger_header: LedgerHeaderHistoryEntry, pub tx_set: TransactionSet, @@ -21712,6 +22048,7 @@ impl WriteXdr for LedgerCloseMetaV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LedgerCloseMetaExtV1 { pub ext: ExtensionPoint, pub soroban_fee_write1_kb: i64, @@ -21760,6 +22097,7 @@ impl WriteXdr for LedgerCloseMetaExtV1 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum LedgerCloseMetaExt { V0, @@ -21889,6 +22227,7 @@ impl WriteXdr for LedgerCloseMetaExt { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LedgerCloseMetaV1 { pub ext: LedgerCloseMetaExt, pub ledger_header: LedgerHeaderHistoryEntry, @@ -21958,6 +22297,7 @@ impl WriteXdr for LedgerCloseMetaV1 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum LedgerCloseMeta { V0(LedgerCloseMetaV0), @@ -22066,6 +22406,7 @@ impl WriteXdr for LedgerCloseMeta { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ErrorCode { Misc = 0, @@ -22185,6 +22526,7 @@ impl WriteXdr for ErrorCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct SError { pub code: ErrorCode, pub msg: StringM<100>, @@ -22229,6 +22571,7 @@ impl WriteXdr for SError { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct SendMore { pub num_messages: u32, } @@ -22271,6 +22614,7 @@ impl WriteXdr for SendMore { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct SendMoreExtended { pub num_messages: u32, pub num_bytes: u32, @@ -22317,6 +22661,7 @@ impl WriteXdr for SendMoreExtended { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct AuthCert { pub pubkey: Curve25519Public, pub expiration: u64, @@ -22372,6 +22717,7 @@ impl WriteXdr for AuthCert { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct Hello { pub ledger_version: u32, pub overlay_version: u32, @@ -22445,6 +22791,7 @@ pub const AUTH_MSG_FLAG_FLOW_CONTROL_BYTES_REQUESTED: u64 = 200; derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct Auth { pub flags: i32, } @@ -22488,6 +22835,7 @@ impl WriteXdr for Auth { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum IpAddrType { IPv4 = 0, @@ -22595,6 +22943,7 @@ impl WriteXdr for IpAddrType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum PeerAddressIp { IPv4([u8; 4]), @@ -22707,6 +23056,7 @@ impl WriteXdr for PeerAddressIp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct PeerAddress { pub ip: PeerAddressIp, pub port: u32, @@ -22784,6 +23134,7 @@ impl WriteXdr for PeerAddress { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum MessageType { ErrorMsg = 0, @@ -22984,6 +23335,7 @@ impl WriteXdr for MessageType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct DontHave { pub type_: MessageType, pub req_hash: Uint256, @@ -23029,6 +23381,7 @@ impl WriteXdr for DontHave { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum SurveyMessageCommandType { SurveyTopology = 0, @@ -23131,6 +23484,7 @@ impl WriteXdr for SurveyMessageCommandType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum SurveyMessageResponseType { V0 = 0, @@ -23239,6 +23593,7 @@ impl WriteXdr for SurveyMessageResponseType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct SurveyRequestMessage { pub surveyor_peer_id: NodeId, pub surveyed_peer_id: NodeId, @@ -23293,6 +23648,7 @@ impl WriteXdr for SurveyRequestMessage { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct SignedSurveyRequestMessage { pub request_signature: Signature, pub request: SurveyRequestMessage, @@ -23335,6 +23691,7 @@ impl WriteXdr for SignedSurveyRequestMessage { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[derive(Debug)] pub struct EncryptedBody(pub BytesM<64000>); @@ -23446,6 +23803,7 @@ impl AsRef<[u8]> for EncryptedBody { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct SurveyResponseMessage { pub surveyor_peer_id: NodeId, pub surveyed_peer_id: NodeId, @@ -23500,6 +23858,7 @@ impl WriteXdr for SurveyResponseMessage { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct SignedSurveyResponseMessage { pub response_signature: Signature, pub response: SurveyResponseMessage, @@ -23560,6 +23919,7 @@ impl WriteXdr for SignedSurveyResponseMessage { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct PeerStats { pub id: NodeId, pub version_str: StringM<100>, @@ -23641,6 +24001,7 @@ impl WriteXdr for PeerStats { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[derive(Debug)] pub struct PeerStatList(pub VecM); @@ -23752,6 +24113,7 @@ impl AsRef<[PeerStats]> for PeerStatList { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct TopologyResponseBodyV0 { pub inbound_peers: PeerStatList, pub outbound_peers: PeerStatList, @@ -23809,6 +24171,7 @@ impl WriteXdr for TopologyResponseBodyV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct TopologyResponseBodyV1 { pub inbound_peers: PeerStatList, pub outbound_peers: PeerStatList, @@ -23869,6 +24232,7 @@ impl WriteXdr for TopologyResponseBodyV1 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum SurveyResponseBody { V0(TopologyResponseBodyV0), @@ -23980,6 +24344,7 @@ pub const TX_ADVERT_VECTOR_MAX_SIZE: u64 = 1000; derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[derive(Debug)] pub struct TxAdvertVector(pub VecM); @@ -24087,6 +24452,7 @@ impl AsRef<[Hash]> for TxAdvertVector { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct FloodAdvert { pub tx_hashes: TxAdvertVector, } @@ -24134,6 +24500,7 @@ pub const TX_DEMAND_VECTOR_MAX_SIZE: u64 = 1000; derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[derive(Debug)] pub struct TxDemandVector(pub VecM); @@ -24241,6 +24608,7 @@ impl AsRef<[Hash]> for TxDemandVector { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct FloodDemand { pub tx_hashes: TxDemandVector, } @@ -24329,6 +24697,7 @@ impl WriteXdr for FloodDemand { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum StellarMessage { ErrorMsg(SError), @@ -24574,6 +24943,7 @@ impl WriteXdr for StellarMessage { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct AuthenticatedMessageV0 { pub sequence: u64, pub message: StellarMessage, @@ -24628,6 +24998,7 @@ impl WriteXdr for AuthenticatedMessageV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum AuthenticatedMessage { V0(AuthenticatedMessageV0), @@ -24736,6 +25107,7 @@ pub const MAX_OPS_PER_TX: u64 = 100; derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum LiquidityPoolParameters { LiquidityPoolConstantProduct(LiquidityPoolConstantProductParameters), @@ -24997,6 +25369,7 @@ impl WriteXdr for MuxedAccount { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct DecoratedSignature { pub hint: SignatureHint, pub signature: Signature, @@ -25068,6 +25441,7 @@ impl WriteXdr for DecoratedSignature { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum OperationType { CreateAccount = 0, @@ -25303,6 +25677,7 @@ impl WriteXdr for OperationType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct CreateAccountOp { pub destination: AccountId, pub starting_balance: i64, @@ -25349,6 +25724,7 @@ impl WriteXdr for CreateAccountOp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct PaymentOp { pub destination: MuxedAccount, pub asset: Asset, @@ -25405,6 +25781,7 @@ impl WriteXdr for PaymentOp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct PathPaymentStrictReceiveOp { pub send_asset: Asset, pub send_max: i64, @@ -25470,6 +25847,7 @@ impl WriteXdr for PathPaymentStrictReceiveOp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct PathPaymentStrictSendOp { pub send_asset: Asset, pub send_amount: i64, @@ -25532,6 +25910,7 @@ impl WriteXdr for PathPaymentStrictSendOp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ManageSellOfferOp { pub selling: Asset, pub buying: Asset, @@ -25592,6 +25971,7 @@ impl WriteXdr for ManageSellOfferOp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ManageBuyOfferOp { pub selling: Asset, pub buying: Asset, @@ -25648,6 +26028,7 @@ impl WriteXdr for ManageBuyOfferOp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct CreatePassiveSellOfferOp { pub selling: Asset, pub buying: Asset, @@ -25713,6 +26094,7 @@ impl WriteXdr for CreatePassiveSellOfferOp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct SetOptionsOp { pub inflation_dest: Option, pub clear_flags: Option, @@ -25791,6 +26173,7 @@ impl WriteXdr for SetOptionsOp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ChangeTrustAsset { Native, @@ -25913,6 +26296,7 @@ impl WriteXdr for ChangeTrustAsset { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ChangeTrustOp { pub line: ChangeTrustAsset, pub limit: i64, @@ -25961,6 +26345,7 @@ impl WriteXdr for ChangeTrustOp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct AllowTrustOp { pub trustor: AccountId, pub asset: AssetCode, @@ -26009,6 +26394,7 @@ impl WriteXdr for AllowTrustOp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ManageDataOp { pub data_name: String64, pub data_value: Option, @@ -26053,6 +26439,7 @@ impl WriteXdr for ManageDataOp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct BumpSequenceOp { pub bump_to: SequenceNumber, } @@ -26096,6 +26483,7 @@ impl WriteXdr for BumpSequenceOp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct CreateClaimableBalanceOp { pub asset: Asset, pub amount: i64, @@ -26143,6 +26531,7 @@ impl WriteXdr for CreateClaimableBalanceOp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ClaimClaimableBalanceOp { pub balance_id: ClaimableBalanceId, } @@ -26184,6 +26573,7 @@ impl WriteXdr for ClaimClaimableBalanceOp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct BeginSponsoringFutureReservesOp { pub sponsored_id: AccountId, } @@ -26227,6 +26617,7 @@ impl WriteXdr for BeginSponsoringFutureReservesOp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum RevokeSponsorshipType { LedgerEntry = 0, @@ -26334,6 +26725,7 @@ impl WriteXdr for RevokeSponsorshipType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct RevokeSponsorshipOpSigner { pub account_id: AccountId, pub signer_key: SignerKey, @@ -26386,6 +26778,7 @@ impl WriteXdr for RevokeSponsorshipOpSigner { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum RevokeSponsorshipOp { LedgerEntry(LedgerKey), @@ -26496,6 +26889,7 @@ impl WriteXdr for RevokeSponsorshipOp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ClawbackOp { pub asset: Asset, pub from: MuxedAccount, @@ -26543,6 +26937,7 @@ impl WriteXdr for ClawbackOp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ClawbackClaimableBalanceOp { pub balance_id: ClaimableBalanceId, } @@ -26588,6 +26983,7 @@ impl WriteXdr for ClawbackClaimableBalanceOp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct SetTrustLineFlagsOp { pub trustor: AccountId, pub asset: Asset, @@ -26650,6 +27046,7 @@ pub const LIQUIDITY_POOL_FEE_V18: u64 = 30; derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LiquidityPoolDepositOp { pub liquidity_pool_id: PoolId, pub max_amount_a: i64, @@ -26706,6 +27103,7 @@ impl WriteXdr for LiquidityPoolDepositOp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LiquidityPoolWithdrawOp { pub liquidity_pool_id: PoolId, pub amount: i64, @@ -26759,6 +27157,7 @@ impl WriteXdr for LiquidityPoolWithdrawOp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum HostFunctionType { InvokeContract = 0, @@ -26872,6 +27271,7 @@ impl WriteXdr for HostFunctionType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ContractIdPreimageType { Address = 0, @@ -26979,6 +27379,7 @@ impl WriteXdr for ContractIdPreimageType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ContractIdPreimageFromAddress { pub address: ScAddress, pub salt: Uint256, @@ -27031,6 +27432,7 @@ impl WriteXdr for ContractIdPreimageFromAddress { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ContractIdPreimage { Address(ContractIdPreimageFromAddress), @@ -27140,6 +27542,7 @@ impl WriteXdr for ContractIdPreimage { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct CreateContractArgs { pub contract_id_preimage: ContractIdPreimage, pub executable: ContractExecutable, @@ -27185,6 +27588,7 @@ impl WriteXdr for CreateContractArgs { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct InvokeContractArgs { pub contract_address: ScAddress, pub function_name: ScSymbol, @@ -27238,6 +27642,7 @@ impl WriteXdr for InvokeContractArgs { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum HostFunction { InvokeContract(InvokeContractArgs), @@ -27359,6 +27764,7 @@ impl WriteXdr for HostFunction { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum SorobanAuthorizedFunctionType { ContractFn = 0, @@ -27469,6 +27875,7 @@ impl WriteXdr for SorobanAuthorizedFunctionType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum SorobanAuthorizedFunction { ContractFn(InvokeContractArgs), @@ -27581,6 +27988,7 @@ impl WriteXdr for SorobanAuthorizedFunction { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct SorobanAuthorizedInvocation { pub function: SorobanAuthorizedFunction, pub sub_invocations: VecM, @@ -27628,6 +28036,7 @@ impl WriteXdr for SorobanAuthorizedInvocation { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct SorobanAddressCredentials { pub address: ScAddress, pub nonce: i64, @@ -27680,6 +28089,7 @@ impl WriteXdr for SorobanAddressCredentials { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum SorobanCredentialsType { SourceAccount = 0, @@ -27790,6 +28200,7 @@ impl WriteXdr for SorobanCredentialsType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum SorobanCredentials { SourceAccount, @@ -27899,6 +28310,7 @@ impl WriteXdr for SorobanCredentials { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct SorobanAuthorizationEntry { pub credentials: SorobanCredentials, pub root_invocation: SorobanAuthorizedInvocation, @@ -27946,6 +28358,7 @@ impl WriteXdr for SorobanAuthorizationEntry { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct InvokeHostFunctionOp { pub host_function: HostFunction, pub auth: VecM, @@ -27991,6 +28404,7 @@ impl WriteXdr for InvokeHostFunctionOp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ExtendFootprintTtlOp { pub ext: ExtensionPoint, pub extend_to: u32, @@ -28035,6 +28449,7 @@ impl WriteXdr for ExtendFootprintTtlOp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct RestoreFootprintOp { pub ext: ExtensionPoint, } @@ -28130,6 +28545,7 @@ impl WriteXdr for RestoreFootprintOp { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum OperationBody { CreateAccount(CreateAccountOp), @@ -28510,6 +28926,7 @@ impl WriteXdr for OperationBody { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct Operation { pub source_account: Option, pub body: OperationBody, @@ -28556,6 +28973,7 @@ impl WriteXdr for Operation { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct HashIdPreimageOperationId { pub source_account: AccountId, pub seq_num: SequenceNumber, @@ -28607,6 +29025,7 @@ impl WriteXdr for HashIdPreimageOperationId { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct HashIdPreimageRevokeId { pub source_account: AccountId, pub seq_num: SequenceNumber, @@ -28661,6 +29080,7 @@ impl WriteXdr for HashIdPreimageRevokeId { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct HashIdPreimageContractId { pub network_id: Hash, pub contract_id_preimage: ContractIdPreimage, @@ -28708,6 +29128,7 @@ impl WriteXdr for HashIdPreimageContractId { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct HashIdPreimageSorobanAuthorization { pub network_id: Hash, pub nonce: i64, @@ -28788,6 +29209,7 @@ impl WriteXdr for HashIdPreimageSorobanAuthorization { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum HashIdPreimage { OpId(HashIdPreimageOperationId), @@ -28922,6 +29344,7 @@ impl WriteXdr for HashIdPreimage { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum MemoType { None = 0, @@ -29050,6 +29473,7 @@ impl WriteXdr for MemoType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum Memo { None, @@ -29175,6 +29599,7 @@ impl WriteXdr for Memo { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct TimeBounds { pub min_time: TimePoint, pub max_time: TimePoint, @@ -29220,6 +29645,7 @@ impl WriteXdr for TimeBounds { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LedgerBounds { pub min_ledger: u32, pub max_ledger: u32, @@ -29292,6 +29718,7 @@ impl WriteXdr for LedgerBounds { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct PreconditionsV2 { pub time_bounds: Option, pub ledger_bounds: Option, @@ -29351,6 +29778,7 @@ impl WriteXdr for PreconditionsV2 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum PreconditionType { None = 0, @@ -29467,6 +29895,7 @@ impl WriteXdr for PreconditionType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum Preconditions { None, @@ -29580,6 +30009,7 @@ impl WriteXdr for Preconditions { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct LedgerFootprint { pub read_only: VecM, pub read_write: VecM, @@ -29632,6 +30062,7 @@ impl WriteXdr for LedgerFootprint { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct SorobanResources { pub footprint: LedgerFootprint, pub instructions: u32, @@ -29693,6 +30124,7 @@ impl WriteXdr for SorobanResources { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct SorobanTransactionData { pub ext: ExtensionPoint, pub resources: SorobanResources, @@ -29742,6 +30174,7 @@ impl WriteXdr for SorobanTransactionData { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum TransactionV0Ext { V0, @@ -29851,6 +30284,7 @@ impl WriteXdr for TransactionV0Ext { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct TransactionV0 { pub source_account_ed25519: Uint256, pub fee: u32, @@ -29913,6 +30347,7 @@ impl WriteXdr for TransactionV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct TransactionV0Envelope { pub tx: TransactionV0, pub signatures: VecM, @@ -29961,6 +30396,7 @@ impl WriteXdr for TransactionV0Envelope { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum TransactionExt { V0, @@ -30088,6 +30524,7 @@ impl WriteXdr for TransactionExt { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct Transaction { pub source_account: MuxedAccount, pub fee: u32, @@ -30150,6 +30587,7 @@ impl WriteXdr for Transaction { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct TransactionV1Envelope { pub tx: Transaction, pub signatures: VecM, @@ -30196,6 +30634,7 @@ impl WriteXdr for TransactionV1Envelope { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum FeeBumpTransactionInnerTx { Tx(TransactionV1Envelope), @@ -30296,6 +30735,7 @@ impl WriteXdr for FeeBumpTransactionInnerTx { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum FeeBumpTransactionExt { V0, @@ -30407,6 +30847,7 @@ impl WriteXdr for FeeBumpTransactionExt { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct FeeBumpTransaction { pub fee_source: MuxedAccount, pub fee: i64, @@ -30460,6 +30901,7 @@ impl WriteXdr for FeeBumpTransaction { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct FeeBumpTransactionEnvelope { pub tx: FeeBumpTransaction, pub signatures: VecM, @@ -30510,6 +30952,7 @@ impl WriteXdr for FeeBumpTransactionEnvelope { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum TransactionEnvelope { TxV0(TransactionV0Envelope), @@ -30629,6 +31072,7 @@ impl WriteXdr for TransactionEnvelope { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum TransactionSignaturePayloadTaggedTransaction { Tx(Transaction), @@ -30741,6 +31185,7 @@ impl WriteXdr for TransactionSignaturePayloadTaggedTransaction { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct TransactionSignaturePayload { pub network_id: Hash, pub tagged_transaction: TransactionSignaturePayloadTaggedTransaction, @@ -30788,6 +31233,7 @@ impl WriteXdr for TransactionSignaturePayload { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ClaimAtomType { V0 = 0, @@ -30908,6 +31354,7 @@ impl WriteXdr for ClaimAtomType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ClaimOfferAtomV0 { pub seller_ed25519: Uint256, pub offer_id: i64, @@ -30974,6 +31421,7 @@ impl WriteXdr for ClaimOfferAtomV0 { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ClaimOfferAtom { pub seller_id: AccountId, pub offer_id: i64, @@ -31038,6 +31486,7 @@ impl WriteXdr for ClaimOfferAtom { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ClaimLiquidityAtom { pub liquidity_pool_id: PoolId, pub asset_sold: Asset, @@ -31097,6 +31546,7 @@ impl WriteXdr for ClaimLiquidityAtom { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ClaimAtom { V0(ClaimOfferAtomV0), @@ -31220,6 +31670,7 @@ impl WriteXdr for ClaimAtom { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum CreateAccountResultCode { Success = 0, @@ -31351,6 +31802,7 @@ impl WriteXdr for CreateAccountResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum CreateAccountResult { Success, @@ -31494,6 +31946,7 @@ impl WriteXdr for CreateAccountResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum PaymentResultCode { Success = 0, @@ -31655,6 +32108,7 @@ impl WriteXdr for PaymentResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum PaymentResult { Success, @@ -31845,6 +32299,7 @@ impl WriteXdr for PaymentResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum PathPaymentStrictReceiveResultCode { Success = 0, @@ -32011,6 +32466,7 @@ impl WriteXdr for PathPaymentStrictReceiveResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct SimplePaymentResult { pub destination: AccountId, pub asset: Asset, @@ -32059,6 +32515,7 @@ impl WriteXdr for SimplePaymentResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct PathPaymentStrictReceiveResultSuccess { pub offers: VecM, pub last: SimplePaymentResult, @@ -32125,6 +32582,7 @@ impl WriteXdr for PathPaymentStrictReceiveResultSuccess { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum PathPaymentStrictReceiveResult { Success(PathPaymentStrictReceiveResultSuccess), @@ -32338,6 +32796,7 @@ impl WriteXdr for PathPaymentStrictReceiveResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum PathPaymentStrictSendResultCode { Success = 0, @@ -32503,6 +32962,7 @@ impl WriteXdr for PathPaymentStrictSendResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct PathPaymentStrictSendResultSuccess { pub offers: VecM, pub last: SimplePaymentResult, @@ -32568,6 +33028,7 @@ impl WriteXdr for PathPaymentStrictSendResultSuccess { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum PathPaymentStrictSendResult { Success(PathPaymentStrictSendResultSuccess), @@ -32780,6 +33241,7 @@ impl WriteXdr for PathPaymentStrictSendResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ManageSellOfferResultCode { Success = 0, @@ -32947,6 +33409,7 @@ impl WriteXdr for ManageSellOfferResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ManageOfferEffect { Created = 0, @@ -33062,6 +33525,7 @@ impl WriteXdr for ManageOfferEffect { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ManageOfferSuccessResultOffer { Created(OfferEntry), @@ -33185,6 +33649,7 @@ impl WriteXdr for ManageOfferSuccessResultOffer { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct ManageOfferSuccessResult { pub offers_claimed: VecM, pub offer: ManageOfferSuccessResultOffer, @@ -33244,6 +33709,7 @@ impl WriteXdr for ManageOfferSuccessResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ManageSellOfferResult { Success(ManageOfferSuccessResult), @@ -33453,6 +33919,7 @@ impl WriteXdr for ManageSellOfferResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ManageBuyOfferResultCode { Success = 0, @@ -33632,6 +34099,7 @@ impl WriteXdr for ManageBuyOfferResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ManageBuyOfferResult { Success(ManageOfferSuccessResult), @@ -33834,6 +34302,7 @@ impl WriteXdr for ManageBuyOfferResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum SetOptionsResultCode { Success = 0, @@ -34001,6 +34470,7 @@ impl WriteXdr for SetOptionsResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum SetOptionsResult { Success, @@ -34188,6 +34658,7 @@ impl WriteXdr for SetOptionsResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ChangeTrustResultCode { Success = 0, @@ -34343,6 +34814,7 @@ impl WriteXdr for ChangeTrustResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ChangeTrustResult { Success, @@ -34514,6 +34986,7 @@ impl WriteXdr for ChangeTrustResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum AllowTrustResultCode { Success = 0, @@ -34657,6 +35130,7 @@ impl WriteXdr for AllowTrustResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum AllowTrustResult { Success, @@ -34812,6 +35286,7 @@ impl WriteXdr for AllowTrustResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum AccountMergeResultCode { Success = 0, @@ -34961,6 +35436,7 @@ impl WriteXdr for AccountMergeResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum AccountMergeResult { Success(i64), @@ -35116,6 +35592,7 @@ impl WriteXdr for AccountMergeResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum InflationResultCode { Success = 0, @@ -35221,6 +35698,7 @@ impl WriteXdr for InflationResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct InflationPayout { pub destination: AccountId, pub amount: i64, @@ -35269,6 +35747,7 @@ impl WriteXdr for InflationPayout { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum InflationResult { Success(VecM), @@ -35384,6 +35863,7 @@ impl WriteXdr for InflationResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ManageDataResultCode { Success = 0, @@ -35515,6 +35995,7 @@ impl WriteXdr for ManageDataResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ManageDataResult { Success, @@ -35649,6 +36130,7 @@ impl WriteXdr for ManageDataResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum BumpSequenceResultCode { Success = 0, @@ -35759,6 +36241,7 @@ impl WriteXdr for BumpSequenceResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum BumpSequenceResult { Success, @@ -35871,6 +36354,7 @@ impl WriteXdr for BumpSequenceResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum CreateClaimableBalanceResultCode { Success = 0, @@ -36009,6 +36493,7 @@ impl WriteXdr for CreateClaimableBalanceResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum CreateClaimableBalanceResult { Success(ClaimableBalanceId), @@ -36155,6 +36640,7 @@ impl WriteXdr for CreateClaimableBalanceResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ClaimClaimableBalanceResultCode { Success = 0, @@ -36292,6 +36778,7 @@ impl WriteXdr for ClaimClaimableBalanceResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ClaimClaimableBalanceResult { Success, @@ -36437,6 +36924,7 @@ impl WriteXdr for ClaimClaimableBalanceResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum BeginSponsoringFutureReservesResultCode { Success = 0, @@ -36559,6 +37047,7 @@ impl WriteXdr for BeginSponsoringFutureReservesResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum BeginSponsoringFutureReservesResult { Success, @@ -36684,6 +37173,7 @@ impl WriteXdr for BeginSponsoringFutureReservesResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum EndSponsoringFutureReservesResultCode { Success = 0, @@ -36795,6 +37285,7 @@ impl WriteXdr for EndSponsoringFutureReservesResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum EndSponsoringFutureReservesResult { Success, @@ -36911,6 +37402,7 @@ impl WriteXdr for EndSponsoringFutureReservesResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum RevokeSponsorshipResultCode { Success = 0, @@ -37048,6 +37540,7 @@ impl WriteXdr for RevokeSponsorshipResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum RevokeSponsorshipResult { Success, @@ -37194,6 +37687,7 @@ impl WriteXdr for RevokeSponsorshipResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ClawbackResultCode { Success = 0, @@ -37325,6 +37819,7 @@ impl WriteXdr for ClawbackResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ClawbackResult { Success, @@ -37462,6 +37957,7 @@ impl WriteXdr for ClawbackResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ClawbackClaimableBalanceResultCode { Success = 0, @@ -37584,6 +38080,7 @@ impl WriteXdr for ClawbackClaimableBalanceResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ClawbackClaimableBalanceResult { Success, @@ -37714,6 +38211,7 @@ impl WriteXdr for ClawbackClaimableBalanceResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum SetTrustLineFlagsResultCode { Success = 0, @@ -37851,6 +38349,7 @@ impl WriteXdr for SetTrustLineFlagsResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum SetTrustLineFlagsResult { Success, @@ -38004,6 +38503,7 @@ impl WriteXdr for SetTrustLineFlagsResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum LiquidityPoolDepositResultCode { Success = 0, @@ -38153,6 +38653,7 @@ impl WriteXdr for LiquidityPoolDepositResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum LiquidityPoolDepositResult { Success, @@ -38317,6 +38818,7 @@ impl WriteXdr for LiquidityPoolDepositResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum LiquidityPoolWithdrawResultCode { Success = 0, @@ -38454,6 +38956,7 @@ impl WriteXdr for LiquidityPoolWithdrawResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum LiquidityPoolWithdrawResult { Success, @@ -38601,6 +39104,7 @@ impl WriteXdr for LiquidityPoolWithdrawResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum InvokeHostFunctionResultCode { Success = 0, @@ -38738,6 +39242,7 @@ impl WriteXdr for InvokeHostFunctionResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum InvokeHostFunctionResult { Success(Hash), @@ -38887,6 +39392,7 @@ impl WriteXdr for InvokeHostFunctionResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum ExtendFootprintTtlResultCode { Success = 0, @@ -39012,6 +39518,7 @@ impl WriteXdr for ExtendFootprintTtlResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ExtendFootprintTtlResult { Success, @@ -39147,6 +39654,7 @@ impl WriteXdr for ExtendFootprintTtlResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum RestoreFootprintResultCode { Success = 0, @@ -39272,6 +39780,7 @@ impl WriteXdr for RestoreFootprintResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum RestoreFootprintResult { Success, @@ -39408,6 +39917,7 @@ impl WriteXdr for RestoreFootprintResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum OperationResultCode { OpInner = 0, @@ -39596,6 +40106,7 @@ impl WriteXdr for OperationResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum OperationResultTr { CreateAccount(CreateAccountResult), @@ -39984,6 +40495,7 @@ impl WriteXdr for OperationResultTr { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum OperationResult { OpInner(OperationResultTr), @@ -40151,6 +40663,7 @@ impl WriteXdr for OperationResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum TransactionResultCode { TxFeeBumpInnerSuccess = 1, @@ -40366,6 +40879,7 @@ impl WriteXdr for TransactionResultCode { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum InnerTransactionResultResult { TxSuccess(VecM), @@ -40586,6 +41100,7 @@ impl WriteXdr for InnerTransactionResultResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum InnerTransactionResultExt { V0, @@ -40719,6 +41234,7 @@ impl WriteXdr for InnerTransactionResultExt { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct InnerTransactionResult { pub fee_charged: i64, pub result: InnerTransactionResultResult, @@ -40767,6 +41283,7 @@ impl WriteXdr for InnerTransactionResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct InnerTransactionResultPair { pub transaction_hash: Hash, pub result: InnerTransactionResult, @@ -40834,6 +41351,7 @@ impl WriteXdr for InnerTransactionResultPair { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum TransactionResultResult { TxFeeBumpInnerSuccess(InnerTransactionResultPair), @@ -41072,6 +41590,7 @@ impl WriteXdr for TransactionResultResult { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum TransactionResultExt { V0, @@ -41206,6 +41725,7 @@ impl WriteXdr for TransactionResultExt { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct TransactionResult { pub fee_charged: i64, pub result: TransactionResultResult, @@ -41279,6 +41799,39 @@ impl core::str::FromStr for Hash { hex::decode(s).map_err(|_| Error::InvalidHex)?.try_into() } } +#[cfg(feature = "schemars")] +impl schemars::JsonSchema for Hash { + fn schema_name() -> String { + "Hash".to_string() + } + + fn is_referenceable() -> bool { + false + } + + fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema { + let schema = String::json_schema(gen); + if let schemars::schema::Schema::Object(mut schema) = schema { + schema.extensions.insert( + "contentEncoding".to_owned(), + serde_json::Value::String("hex".to_string()), + ); + schema.extensions.insert( + "contentMediaType".to_owned(), + serde_json::Value::String("application/binary".to_string()), + ); + let string = *schema.string.unwrap_or_default().clone(); + schema.string = Some(Box::new(schemars::schema::StringValidation { + max_length: 32_u32.checked_mul(2).map(Some).unwrap_or_default(), + min_length: 32_u32.checked_mul(2).map(Some).unwrap_or_default(), + ..string + })); + schema.into() + } else { + schema + } + } +} impl From for [u8; 32] { #[must_use] fn from(x: Hash) -> Self { @@ -41397,6 +41950,39 @@ impl core::str::FromStr for Uint256 { hex::decode(s).map_err(|_| Error::InvalidHex)?.try_into() } } +#[cfg(feature = "schemars")] +impl schemars::JsonSchema for Uint256 { + fn schema_name() -> String { + "Uint256".to_string() + } + + fn is_referenceable() -> bool { + false + } + + fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema { + let schema = String::json_schema(gen); + if let schemars::schema::Schema::Object(mut schema) = schema { + schema.extensions.insert( + "contentEncoding".to_owned(), + serde_json::Value::String("hex".to_string()), + ); + schema.extensions.insert( + "contentMediaType".to_owned(), + serde_json::Value::String("application/binary".to_string()), + ); + let string = *schema.string.unwrap_or_default().clone(); + schema.string = Some(Box::new(schemars::schema::StringValidation { + max_length: 32_u32.checked_mul(2).map(Some).unwrap_or_default(), + min_length: 32_u32.checked_mul(2).map(Some).unwrap_or_default(), + ..string + })); + schema.into() + } else { + schema + } + } +} impl From for [u8; 32] { #[must_use] fn from(x: Uint256) -> Self { @@ -41518,6 +42104,7 @@ pub type Int64 = i64; derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[derive(Debug)] pub struct TimePoint(pub u64); @@ -41573,6 +42160,7 @@ impl WriteXdr for TimePoint { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[derive(Debug)] pub struct Duration(pub u64); @@ -41633,6 +42221,7 @@ impl WriteXdr for Duration { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] pub enum ExtensionPoint { V0, @@ -41738,6 +42327,7 @@ impl WriteXdr for ExtensionPoint { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum CryptoKeyType { Ed25519 = 0, @@ -41863,6 +42453,7 @@ impl WriteXdr for CryptoKeyType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum PublicKeyType { PublicKeyTypeEd25519 = 0, @@ -41967,6 +42558,7 @@ impl WriteXdr for PublicKeyType { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] pub enum SignerKeyType { Ed25519 = 0, @@ -42363,6 +42955,7 @@ impl WriteXdr for SignerKey { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[derive(Debug)] pub struct Signature(pub BytesM<64>); @@ -42496,6 +43089,39 @@ impl core::str::FromStr for SignatureHint { hex::decode(s).map_err(|_| Error::InvalidHex)?.try_into() } } +#[cfg(feature = "schemars")] +impl schemars::JsonSchema for SignatureHint { + fn schema_name() -> String { + "SignatureHint".to_string() + } + + fn is_referenceable() -> bool { + false + } + + fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema { + let schema = String::json_schema(gen); + if let schemars::schema::Schema::Object(mut schema) = schema { + schema.extensions.insert( + "contentEncoding".to_owned(), + serde_json::Value::String("hex".to_string()), + ); + schema.extensions.insert( + "contentMediaType".to_owned(), + serde_json::Value::String("application/binary".to_string()), + ); + let string = *schema.string.unwrap_or_default().clone(); + schema.string = Some(Box::new(schemars::schema::StringValidation { + max_length: 4_u32.checked_mul(2).map(Some).unwrap_or_default(), + min_length: 4_u32.checked_mul(2).map(Some).unwrap_or_default(), + ..string + })); + schema.into() + } else { + schema + } + } +} impl From for [u8; 4] { #[must_use] fn from(x: SignatureHint) -> Self { @@ -42696,6 +43322,7 @@ impl WriteXdr for AccountId { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct Curve25519Secret { pub key: [u8; 32], } @@ -42737,6 +43364,7 @@ impl WriteXdr for Curve25519Secret { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct Curve25519Public { pub key: [u8; 32], } @@ -42778,6 +43406,7 @@ impl WriteXdr for Curve25519Public { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct HmacSha256Key { pub key: [u8; 32], } @@ -42819,6 +43448,7 @@ impl WriteXdr for HmacSha256Key { derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct HmacSha256Mac { pub mac: [u8; 32], } @@ -42844,12 +43474,873 @@ impl WriteXdr for HmacSha256Mac { } } +#[doc(hidden)] +#[macro_export] +macro_rules! _call_macro_with_each_type_53647236d6ceadfee429747f7d6725f269c6917f9a37b47038496c410a3a8868 { + // The x-macro takes a single ident, the name of a macro to call ... + ($macro_to_call_back:ident, $($context:tt),*) => {{ + // ... and calls it back, once for each XDR type. + $macro_to_call_back!(Value, $($context),*); + + $macro_to_call_back!(ScpBallot, $($context),*); + + $macro_to_call_back!(ScpStatementType, $($context),*); + + $macro_to_call_back!(ScpNomination, $($context),*); + + $macro_to_call_back!(ScpStatement, $($context),*); + + $macro_to_call_back!(ScpStatementPledges, $($context),*); + + $macro_to_call_back!(ScpStatementPrepare, $($context),*); + + $macro_to_call_back!(ScpStatementConfirm, $($context),*); + + $macro_to_call_back!(ScpStatementExternalize, $($context),*); + + $macro_to_call_back!(ScpEnvelope, $($context),*); + + $macro_to_call_back!(ScpQuorumSet, $($context),*); + + $macro_to_call_back!(ConfigSettingContractExecutionLanesV0, $($context),*); + + $macro_to_call_back!(ConfigSettingContractComputeV0, $($context),*); + + $macro_to_call_back!(ConfigSettingContractLedgerCostV0, $($context),*); + + $macro_to_call_back!(ConfigSettingContractHistoricalDataV0, $($context),*); + + $macro_to_call_back!(ConfigSettingContractEventsV0, $($context),*); + + $macro_to_call_back!(ConfigSettingContractBandwidthV0, $($context),*); + + $macro_to_call_back!(ContractCostType, $($context),*); + + $macro_to_call_back!(ContractCostParamEntry, $($context),*); + + $macro_to_call_back!(StateArchivalSettings, $($context),*); + + $macro_to_call_back!(EvictionIterator, $($context),*); + + $macro_to_call_back!(ContractCostParams, $($context),*); + + $macro_to_call_back!(ConfigSettingId, $($context),*); + + $macro_to_call_back!(ConfigSettingEntry, $($context),*); + + $macro_to_call_back!(ScEnvMetaKind, $($context),*); + + $macro_to_call_back!(ScEnvMetaEntry, $($context),*); + + $macro_to_call_back!(ScMetaV0, $($context),*); + + $macro_to_call_back!(ScMetaKind, $($context),*); + + $macro_to_call_back!(ScMetaEntry, $($context),*); + + $macro_to_call_back!(ScSpecType, $($context),*); + + $macro_to_call_back!(ScSpecTypeOption, $($context),*); + + $macro_to_call_back!(ScSpecTypeResult, $($context),*); + + $macro_to_call_back!(ScSpecTypeVec, $($context),*); + + $macro_to_call_back!(ScSpecTypeMap, $($context),*); + + $macro_to_call_back!(ScSpecTypeTuple, $($context),*); + + $macro_to_call_back!(ScSpecTypeBytesN, $($context),*); + + $macro_to_call_back!(ScSpecTypeUdt, $($context),*); + + $macro_to_call_back!(ScSpecTypeDef, $($context),*); + + $macro_to_call_back!(ScSpecUdtStructFieldV0, $($context),*); + + $macro_to_call_back!(ScSpecUdtStructV0, $($context),*); + + $macro_to_call_back!(ScSpecUdtUnionCaseVoidV0, $($context),*); + + $macro_to_call_back!(ScSpecUdtUnionCaseTupleV0, $($context),*); + + $macro_to_call_back!(ScSpecUdtUnionCaseV0Kind, $($context),*); + + $macro_to_call_back!(ScSpecUdtUnionCaseV0, $($context),*); + + $macro_to_call_back!(ScSpecUdtUnionV0, $($context),*); + + $macro_to_call_back!(ScSpecUdtEnumCaseV0, $($context),*); + + $macro_to_call_back!(ScSpecUdtEnumV0, $($context),*); + + $macro_to_call_back!(ScSpecUdtErrorEnumCaseV0, $($context),*); + + $macro_to_call_back!(ScSpecUdtErrorEnumV0, $($context),*); + + $macro_to_call_back!(ScSpecFunctionInputV0, $($context),*); + + $macro_to_call_back!(ScSpecFunctionV0, $($context),*); + + $macro_to_call_back!(ScSpecEntryKind, $($context),*); + + $macro_to_call_back!(ScSpecEntry, $($context),*); + + $macro_to_call_back!(ScValType, $($context),*); + + $macro_to_call_back!(ScErrorType, $($context),*); + + $macro_to_call_back!(ScErrorCode, $($context),*); + + $macro_to_call_back!(ScError, $($context),*); + + $macro_to_call_back!(UInt128Parts, $($context),*); + + $macro_to_call_back!(Int128Parts, $($context),*); + + $macro_to_call_back!(UInt256Parts, $($context),*); + + $macro_to_call_back!(Int256Parts, $($context),*); + + $macro_to_call_back!(ContractExecutableType, $($context),*); + + $macro_to_call_back!(ContractExecutable, $($context),*); + + $macro_to_call_back!(ScAddressType, $($context),*); + + $macro_to_call_back!(ScAddress, $($context),*); + + $macro_to_call_back!(ScVec, $($context),*); + + $macro_to_call_back!(ScMap, $($context),*); + + $macro_to_call_back!(ScBytes, $($context),*); + + $macro_to_call_back!(ScString, $($context),*); + + $macro_to_call_back!(ScSymbol, $($context),*); + + $macro_to_call_back!(ScNonceKey, $($context),*); + + $macro_to_call_back!(ScContractInstance, $($context),*); + + $macro_to_call_back!(ScVal, $($context),*); + + $macro_to_call_back!(ScMapEntry, $($context),*); + + $macro_to_call_back!(StoredTransactionSet, $($context),*); + + $macro_to_call_back!(StoredDebugTransactionSet, $($context),*); + + $macro_to_call_back!(PersistedScpStateV0, $($context),*); + + $macro_to_call_back!(PersistedScpStateV1, $($context),*); + + $macro_to_call_back!(PersistedScpState, $($context),*); + + $macro_to_call_back!(Thresholds, $($context),*); + + $macro_to_call_back!(String32, $($context),*); + + $macro_to_call_back!(String64, $($context),*); + + $macro_to_call_back!(SequenceNumber, $($context),*); + + $macro_to_call_back!(DataValue, $($context),*); + + $macro_to_call_back!(PoolId, $($context),*); + + $macro_to_call_back!(AssetCode4, $($context),*); + + $macro_to_call_back!(AssetCode12, $($context),*); + + $macro_to_call_back!(AssetType, $($context),*); + + $macro_to_call_back!(AssetCode, $($context),*); + + $macro_to_call_back!(AlphaNum4, $($context),*); + + $macro_to_call_back!(AlphaNum12, $($context),*); + + $macro_to_call_back!(Asset, $($context),*); + + $macro_to_call_back!(Price, $($context),*); + + $macro_to_call_back!(Liabilities, $($context),*); + + $macro_to_call_back!(ThresholdIndexes, $($context),*); + + $macro_to_call_back!(LedgerEntryType, $($context),*); + + $macro_to_call_back!(Signer, $($context),*); + + $macro_to_call_back!(AccountFlags, $($context),*); + + $macro_to_call_back!(SponsorshipDescriptor, $($context),*); + + $macro_to_call_back!(AccountEntryExtensionV3, $($context),*); + + $macro_to_call_back!(AccountEntryExtensionV2, $($context),*); + + $macro_to_call_back!(AccountEntryExtensionV2Ext, $($context),*); + + $macro_to_call_back!(AccountEntryExtensionV1, $($context),*); + + $macro_to_call_back!(AccountEntryExtensionV1Ext, $($context),*); + + $macro_to_call_back!(AccountEntry, $($context),*); + + $macro_to_call_back!(AccountEntryExt, $($context),*); + + $macro_to_call_back!(TrustLineFlags, $($context),*); + + $macro_to_call_back!(LiquidityPoolType, $($context),*); + + $macro_to_call_back!(TrustLineAsset, $($context),*); + + $macro_to_call_back!(TrustLineEntryExtensionV2, $($context),*); + + $macro_to_call_back!(TrustLineEntryExtensionV2Ext, $($context),*); + + $macro_to_call_back!(TrustLineEntry, $($context),*); + + $macro_to_call_back!(TrustLineEntryExt, $($context),*); + + $macro_to_call_back!(TrustLineEntryV1, $($context),*); + + $macro_to_call_back!(TrustLineEntryV1Ext, $($context),*); + + $macro_to_call_back!(OfferEntryFlags, $($context),*); + + $macro_to_call_back!(OfferEntry, $($context),*); + + $macro_to_call_back!(OfferEntryExt, $($context),*); + + $macro_to_call_back!(DataEntry, $($context),*); + + $macro_to_call_back!(DataEntryExt, $($context),*); + + $macro_to_call_back!(ClaimPredicateType, $($context),*); + + $macro_to_call_back!(ClaimPredicate, $($context),*); + + $macro_to_call_back!(ClaimantType, $($context),*); + + $macro_to_call_back!(Claimant, $($context),*); + + $macro_to_call_back!(ClaimantV0, $($context),*); + + $macro_to_call_back!(ClaimableBalanceIdType, $($context),*); + + $macro_to_call_back!(ClaimableBalanceId, $($context),*); + + $macro_to_call_back!(ClaimableBalanceFlags, $($context),*); + + $macro_to_call_back!(ClaimableBalanceEntryExtensionV1, $($context),*); + + $macro_to_call_back!(ClaimableBalanceEntryExtensionV1Ext, $($context),*); + + $macro_to_call_back!(ClaimableBalanceEntry, $($context),*); + + $macro_to_call_back!(ClaimableBalanceEntryExt, $($context),*); + + $macro_to_call_back!(LiquidityPoolConstantProductParameters, $($context),*); + + $macro_to_call_back!(LiquidityPoolEntry, $($context),*); + + $macro_to_call_back!(LiquidityPoolEntryBody, $($context),*); + + $macro_to_call_back!(LiquidityPoolEntryConstantProduct, $($context),*); + + $macro_to_call_back!(ContractDataDurability, $($context),*); + + $macro_to_call_back!(ContractDataEntry, $($context),*); + + $macro_to_call_back!(ContractCodeCostInputs, $($context),*); + + $macro_to_call_back!(ContractCodeEntry, $($context),*); + + $macro_to_call_back!(ContractCodeEntryExt, $($context),*); + + $macro_to_call_back!(ContractCodeEntryV1, $($context),*); + + $macro_to_call_back!(TtlEntry, $($context),*); + + $macro_to_call_back!(LedgerEntryExtensionV1, $($context),*); + + $macro_to_call_back!(LedgerEntryExtensionV1Ext, $($context),*); + + $macro_to_call_back!(LedgerEntry, $($context),*); + + $macro_to_call_back!(LedgerEntryData, $($context),*); + + $macro_to_call_back!(LedgerEntryExt, $($context),*); + + $macro_to_call_back!(LedgerKey, $($context),*); + + $macro_to_call_back!(LedgerKeyAccount, $($context),*); + + $macro_to_call_back!(LedgerKeyTrustLine, $($context),*); + + $macro_to_call_back!(LedgerKeyOffer, $($context),*); + + $macro_to_call_back!(LedgerKeyData, $($context),*); + + $macro_to_call_back!(LedgerKeyClaimableBalance, $($context),*); + + $macro_to_call_back!(LedgerKeyLiquidityPool, $($context),*); + + $macro_to_call_back!(LedgerKeyContractData, $($context),*); + + $macro_to_call_back!(LedgerKeyContractCode, $($context),*); + + $macro_to_call_back!(LedgerKeyConfigSetting, $($context),*); + + $macro_to_call_back!(LedgerKeyTtl, $($context),*); + + $macro_to_call_back!(EnvelopeType, $($context),*); + + $macro_to_call_back!(UpgradeType, $($context),*); + + $macro_to_call_back!(StellarValueType, $($context),*); + + $macro_to_call_back!(LedgerCloseValueSignature, $($context),*); + + $macro_to_call_back!(StellarValue, $($context),*); + + $macro_to_call_back!(StellarValueExt, $($context),*); + + $macro_to_call_back!(LedgerHeaderFlags, $($context),*); + + $macro_to_call_back!(LedgerHeaderExtensionV1, $($context),*); + + $macro_to_call_back!(LedgerHeaderExtensionV1Ext, $($context),*); + + $macro_to_call_back!(LedgerHeader, $($context),*); + + $macro_to_call_back!(LedgerHeaderExt, $($context),*); + + $macro_to_call_back!(LedgerUpgradeType, $($context),*); + + $macro_to_call_back!(ConfigUpgradeSetKey, $($context),*); + + $macro_to_call_back!(LedgerUpgrade, $($context),*); + + $macro_to_call_back!(ConfigUpgradeSet, $($context),*); + + $macro_to_call_back!(BucketEntryType, $($context),*); + + $macro_to_call_back!(BucketMetadata, $($context),*); + + $macro_to_call_back!(BucketMetadataExt, $($context),*); + + $macro_to_call_back!(BucketEntry, $($context),*); + + $macro_to_call_back!(TxSetComponentType, $($context),*); + + $macro_to_call_back!(TxSetComponent, $($context),*); + + $macro_to_call_back!(TxSetComponentTxsMaybeDiscountedFee, $($context),*); + + $macro_to_call_back!(TransactionPhase, $($context),*); + + $macro_to_call_back!(TransactionSet, $($context),*); + + $macro_to_call_back!(TransactionSetV1, $($context),*); + + $macro_to_call_back!(GeneralizedTransactionSet, $($context),*); + + $macro_to_call_back!(TransactionResultPair, $($context),*); + + $macro_to_call_back!(TransactionResultSet, $($context),*); + + $macro_to_call_back!(TransactionHistoryEntry, $($context),*); + + $macro_to_call_back!(TransactionHistoryEntryExt, $($context),*); + + $macro_to_call_back!(TransactionHistoryResultEntry, $($context),*); + + $macro_to_call_back!(TransactionHistoryResultEntryExt, $($context),*); + + $macro_to_call_back!(LedgerHeaderHistoryEntry, $($context),*); + + $macro_to_call_back!(LedgerHeaderHistoryEntryExt, $($context),*); + + $macro_to_call_back!(LedgerScpMessages, $($context),*); + + $macro_to_call_back!(ScpHistoryEntryV0, $($context),*); + + $macro_to_call_back!(ScpHistoryEntry, $($context),*); + + $macro_to_call_back!(LedgerEntryChangeType, $($context),*); + + $macro_to_call_back!(LedgerEntryChange, $($context),*); + + $macro_to_call_back!(LedgerEntryChanges, $($context),*); + + $macro_to_call_back!(OperationMeta, $($context),*); + + $macro_to_call_back!(TransactionMetaV1, $($context),*); + + $macro_to_call_back!(TransactionMetaV2, $($context),*); + + $macro_to_call_back!(ContractEventType, $($context),*); + + $macro_to_call_back!(ContractEvent, $($context),*); + + $macro_to_call_back!(ContractEventBody, $($context),*); + + $macro_to_call_back!(ContractEventV0, $($context),*); + + $macro_to_call_back!(DiagnosticEvent, $($context),*); + + $macro_to_call_back!(SorobanTransactionMetaExtV1, $($context),*); + + $macro_to_call_back!(SorobanTransactionMetaExt, $($context),*); + + $macro_to_call_back!(SorobanTransactionMeta, $($context),*); + + $macro_to_call_back!(TransactionMetaV3, $($context),*); + + $macro_to_call_back!(InvokeHostFunctionSuccessPreImage, $($context),*); + + $macro_to_call_back!(TransactionMeta, $($context),*); + + $macro_to_call_back!(TransactionResultMeta, $($context),*); + + $macro_to_call_back!(UpgradeEntryMeta, $($context),*); + + $macro_to_call_back!(LedgerCloseMetaV0, $($context),*); + + $macro_to_call_back!(LedgerCloseMetaExtV1, $($context),*); + + $macro_to_call_back!(LedgerCloseMetaExt, $($context),*); + + $macro_to_call_back!(LedgerCloseMetaV1, $($context),*); + + $macro_to_call_back!(LedgerCloseMeta, $($context),*); + + $macro_to_call_back!(ErrorCode, $($context),*); + + $macro_to_call_back!(SError, $($context),*); + + $macro_to_call_back!(SendMore, $($context),*); + + $macro_to_call_back!(SendMoreExtended, $($context),*); + + $macro_to_call_back!(AuthCert, $($context),*); + + $macro_to_call_back!(Hello, $($context),*); + + $macro_to_call_back!(Auth, $($context),*); + + $macro_to_call_back!(IpAddrType, $($context),*); + + $macro_to_call_back!(PeerAddress, $($context),*); + + $macro_to_call_back!(PeerAddressIp, $($context),*); + + $macro_to_call_back!(MessageType, $($context),*); + + $macro_to_call_back!(DontHave, $($context),*); + + $macro_to_call_back!(SurveyMessageCommandType, $($context),*); + + $macro_to_call_back!(SurveyMessageResponseType, $($context),*); + + $macro_to_call_back!(SurveyRequestMessage, $($context),*); + + $macro_to_call_back!(SignedSurveyRequestMessage, $($context),*); + + $macro_to_call_back!(EncryptedBody, $($context),*); + + $macro_to_call_back!(SurveyResponseMessage, $($context),*); + + $macro_to_call_back!(SignedSurveyResponseMessage, $($context),*); + + $macro_to_call_back!(PeerStats, $($context),*); + + $macro_to_call_back!(PeerStatList, $($context),*); + + $macro_to_call_back!(TopologyResponseBodyV0, $($context),*); + + $macro_to_call_back!(TopologyResponseBodyV1, $($context),*); + + $macro_to_call_back!(SurveyResponseBody, $($context),*); + + $macro_to_call_back!(TxAdvertVector, $($context),*); + + $macro_to_call_back!(FloodAdvert, $($context),*); + + $macro_to_call_back!(TxDemandVector, $($context),*); + + $macro_to_call_back!(FloodDemand, $($context),*); + + $macro_to_call_back!(StellarMessage, $($context),*); + + $macro_to_call_back!(AuthenticatedMessage, $($context),*); + + $macro_to_call_back!(AuthenticatedMessageV0, $($context),*); + + $macro_to_call_back!(LiquidityPoolParameters, $($context),*); + + $macro_to_call_back!(MuxedAccount, $($context),*); + + $macro_to_call_back!(MuxedAccountMed25519, $($context),*); + + $macro_to_call_back!(DecoratedSignature, $($context),*); + + $macro_to_call_back!(OperationType, $($context),*); + + $macro_to_call_back!(CreateAccountOp, $($context),*); + + $macro_to_call_back!(PaymentOp, $($context),*); + + $macro_to_call_back!(PathPaymentStrictReceiveOp, $($context),*); + + $macro_to_call_back!(PathPaymentStrictSendOp, $($context),*); + + $macro_to_call_back!(ManageSellOfferOp, $($context),*); + + $macro_to_call_back!(ManageBuyOfferOp, $($context),*); + + $macro_to_call_back!(CreatePassiveSellOfferOp, $($context),*); + + $macro_to_call_back!(SetOptionsOp, $($context),*); + + $macro_to_call_back!(ChangeTrustAsset, $($context),*); + + $macro_to_call_back!(ChangeTrustOp, $($context),*); + + $macro_to_call_back!(AllowTrustOp, $($context),*); + + $macro_to_call_back!(ManageDataOp, $($context),*); + + $macro_to_call_back!(BumpSequenceOp, $($context),*); + + $macro_to_call_back!(CreateClaimableBalanceOp, $($context),*); + + $macro_to_call_back!(ClaimClaimableBalanceOp, $($context),*); + + $macro_to_call_back!(BeginSponsoringFutureReservesOp, $($context),*); + + $macro_to_call_back!(RevokeSponsorshipType, $($context),*); + + $macro_to_call_back!(RevokeSponsorshipOp, $($context),*); + + $macro_to_call_back!(RevokeSponsorshipOpSigner, $($context),*); + + $macro_to_call_back!(ClawbackOp, $($context),*); + + $macro_to_call_back!(ClawbackClaimableBalanceOp, $($context),*); + + $macro_to_call_back!(SetTrustLineFlagsOp, $($context),*); + + $macro_to_call_back!(LiquidityPoolDepositOp, $($context),*); + + $macro_to_call_back!(LiquidityPoolWithdrawOp, $($context),*); + + $macro_to_call_back!(HostFunctionType, $($context),*); + + $macro_to_call_back!(ContractIdPreimageType, $($context),*); + + $macro_to_call_back!(ContractIdPreimage, $($context),*); + + $macro_to_call_back!(ContractIdPreimageFromAddress, $($context),*); + + $macro_to_call_back!(CreateContractArgs, $($context),*); + + $macro_to_call_back!(InvokeContractArgs, $($context),*); + + $macro_to_call_back!(HostFunction, $($context),*); + + $macro_to_call_back!(SorobanAuthorizedFunctionType, $($context),*); + + $macro_to_call_back!(SorobanAuthorizedFunction, $($context),*); + + $macro_to_call_back!(SorobanAuthorizedInvocation, $($context),*); + + $macro_to_call_back!(SorobanAddressCredentials, $($context),*); + + $macro_to_call_back!(SorobanCredentialsType, $($context),*); + + $macro_to_call_back!(SorobanCredentials, $($context),*); + + $macro_to_call_back!(SorobanAuthorizationEntry, $($context),*); + + $macro_to_call_back!(InvokeHostFunctionOp, $($context),*); + + $macro_to_call_back!(ExtendFootprintTtlOp, $($context),*); + + $macro_to_call_back!(RestoreFootprintOp, $($context),*); + + $macro_to_call_back!(Operation, $($context),*); + + $macro_to_call_back!(OperationBody, $($context),*); + + $macro_to_call_back!(HashIdPreimage, $($context),*); + + $macro_to_call_back!(HashIdPreimageOperationId, $($context),*); + + $macro_to_call_back!(HashIdPreimageRevokeId, $($context),*); + + $macro_to_call_back!(HashIdPreimageContractId, $($context),*); + + $macro_to_call_back!(HashIdPreimageSorobanAuthorization, $($context),*); + + $macro_to_call_back!(MemoType, $($context),*); + + $macro_to_call_back!(Memo, $($context),*); + + $macro_to_call_back!(TimeBounds, $($context),*); + + $macro_to_call_back!(LedgerBounds, $($context),*); + + $macro_to_call_back!(PreconditionsV2, $($context),*); + + $macro_to_call_back!(PreconditionType, $($context),*); + + $macro_to_call_back!(Preconditions, $($context),*); + + $macro_to_call_back!(LedgerFootprint, $($context),*); + + $macro_to_call_back!(SorobanResources, $($context),*); + + $macro_to_call_back!(SorobanTransactionData, $($context),*); + + $macro_to_call_back!(TransactionV0, $($context),*); + + $macro_to_call_back!(TransactionV0Ext, $($context),*); + + $macro_to_call_back!(TransactionV0Envelope, $($context),*); + + $macro_to_call_back!(Transaction, $($context),*); + + $macro_to_call_back!(TransactionExt, $($context),*); + + $macro_to_call_back!(TransactionV1Envelope, $($context),*); + + $macro_to_call_back!(FeeBumpTransaction, $($context),*); + + $macro_to_call_back!(FeeBumpTransactionInnerTx, $($context),*); + + $macro_to_call_back!(FeeBumpTransactionExt, $($context),*); + + $macro_to_call_back!(FeeBumpTransactionEnvelope, $($context),*); + + $macro_to_call_back!(TransactionEnvelope, $($context),*); + + $macro_to_call_back!(TransactionSignaturePayload, $($context),*); + + $macro_to_call_back!(TransactionSignaturePayloadTaggedTransaction, $($context),*); + + $macro_to_call_back!(ClaimAtomType, $($context),*); + + $macro_to_call_back!(ClaimOfferAtomV0, $($context),*); + + $macro_to_call_back!(ClaimOfferAtom, $($context),*); + + $macro_to_call_back!(ClaimLiquidityAtom, $($context),*); + + $macro_to_call_back!(ClaimAtom, $($context),*); + + $macro_to_call_back!(CreateAccountResultCode, $($context),*); + + $macro_to_call_back!(CreateAccountResult, $($context),*); + + $macro_to_call_back!(PaymentResultCode, $($context),*); + + $macro_to_call_back!(PaymentResult, $($context),*); + + $macro_to_call_back!(PathPaymentStrictReceiveResultCode, $($context),*); + + $macro_to_call_back!(SimplePaymentResult, $($context),*); + + $macro_to_call_back!(PathPaymentStrictReceiveResult, $($context),*); + + $macro_to_call_back!(PathPaymentStrictReceiveResultSuccess, $($context),*); + + $macro_to_call_back!(PathPaymentStrictSendResultCode, $($context),*); + + $macro_to_call_back!(PathPaymentStrictSendResult, $($context),*); + + $macro_to_call_back!(PathPaymentStrictSendResultSuccess, $($context),*); + + $macro_to_call_back!(ManageSellOfferResultCode, $($context),*); + + $macro_to_call_back!(ManageOfferEffect, $($context),*); + + $macro_to_call_back!(ManageOfferSuccessResult, $($context),*); + + $macro_to_call_back!(ManageOfferSuccessResultOffer, $($context),*); + + $macro_to_call_back!(ManageSellOfferResult, $($context),*); + + $macro_to_call_back!(ManageBuyOfferResultCode, $($context),*); + + $macro_to_call_back!(ManageBuyOfferResult, $($context),*); + + $macro_to_call_back!(SetOptionsResultCode, $($context),*); + + $macro_to_call_back!(SetOptionsResult, $($context),*); + + $macro_to_call_back!(ChangeTrustResultCode, $($context),*); + + $macro_to_call_back!(ChangeTrustResult, $($context),*); + + $macro_to_call_back!(AllowTrustResultCode, $($context),*); + + $macro_to_call_back!(AllowTrustResult, $($context),*); + + $macro_to_call_back!(AccountMergeResultCode, $($context),*); + + $macro_to_call_back!(AccountMergeResult, $($context),*); + + $macro_to_call_back!(InflationResultCode, $($context),*); + + $macro_to_call_back!(InflationPayout, $($context),*); + + $macro_to_call_back!(InflationResult, $($context),*); + + $macro_to_call_back!(ManageDataResultCode, $($context),*); + + $macro_to_call_back!(ManageDataResult, $($context),*); + + $macro_to_call_back!(BumpSequenceResultCode, $($context),*); + + $macro_to_call_back!(BumpSequenceResult, $($context),*); + + $macro_to_call_back!(CreateClaimableBalanceResultCode, $($context),*); + + $macro_to_call_back!(CreateClaimableBalanceResult, $($context),*); + + $macro_to_call_back!(ClaimClaimableBalanceResultCode, $($context),*); + + $macro_to_call_back!(ClaimClaimableBalanceResult, $($context),*); + + $macro_to_call_back!(BeginSponsoringFutureReservesResultCode, $($context),*); + + $macro_to_call_back!(BeginSponsoringFutureReservesResult, $($context),*); + + $macro_to_call_back!(EndSponsoringFutureReservesResultCode, $($context),*); + + $macro_to_call_back!(EndSponsoringFutureReservesResult, $($context),*); + + $macro_to_call_back!(RevokeSponsorshipResultCode, $($context),*); + + $macro_to_call_back!(RevokeSponsorshipResult, $($context),*); + + $macro_to_call_back!(ClawbackResultCode, $($context),*); + + $macro_to_call_back!(ClawbackResult, $($context),*); + + $macro_to_call_back!(ClawbackClaimableBalanceResultCode, $($context),*); + + $macro_to_call_back!(ClawbackClaimableBalanceResult, $($context),*); + + $macro_to_call_back!(SetTrustLineFlagsResultCode, $($context),*); + + $macro_to_call_back!(SetTrustLineFlagsResult, $($context),*); + + $macro_to_call_back!(LiquidityPoolDepositResultCode, $($context),*); + + $macro_to_call_back!(LiquidityPoolDepositResult, $($context),*); + + $macro_to_call_back!(LiquidityPoolWithdrawResultCode, $($context),*); + + $macro_to_call_back!(LiquidityPoolWithdrawResult, $($context),*); + + $macro_to_call_back!(InvokeHostFunctionResultCode, $($context),*); + + $macro_to_call_back!(InvokeHostFunctionResult, $($context),*); + + $macro_to_call_back!(ExtendFootprintTtlResultCode, $($context),*); + + $macro_to_call_back!(ExtendFootprintTtlResult, $($context),*); + + $macro_to_call_back!(RestoreFootprintResultCode, $($context),*); + + $macro_to_call_back!(RestoreFootprintResult, $($context),*); + + $macro_to_call_back!(OperationResultCode, $($context),*); + + $macro_to_call_back!(OperationResult, $($context),*); + + $macro_to_call_back!(OperationResultTr, $($context),*); + + $macro_to_call_back!(TransactionResultCode, $($context),*); + + $macro_to_call_back!(InnerTransactionResult, $($context),*); + + $macro_to_call_back!(InnerTransactionResultResult, $($context),*); + + $macro_to_call_back!(InnerTransactionResultExt, $($context),*); + + $macro_to_call_back!(InnerTransactionResultPair, $($context),*); + + $macro_to_call_back!(TransactionResult, $($context),*); + + $macro_to_call_back!(TransactionResultResult, $($context),*); + + $macro_to_call_back!(TransactionResultExt, $($context),*); + + $macro_to_call_back!(Hash, $($context),*); + + $macro_to_call_back!(Uint256, $($context),*); + + $macro_to_call_back!(Uint32, $($context),*); + + $macro_to_call_back!(Int32, $($context),*); + + $macro_to_call_back!(Uint64, $($context),*); + + $macro_to_call_back!(Int64, $($context),*); + + $macro_to_call_back!(TimePoint, $($context),*); + + $macro_to_call_back!(Duration, $($context),*); + + $macro_to_call_back!(ExtensionPoint, $($context),*); + + $macro_to_call_back!(CryptoKeyType, $($context),*); + + $macro_to_call_back!(PublicKeyType, $($context),*); + + $macro_to_call_back!(SignerKeyType, $($context),*); + + $macro_to_call_back!(PublicKey, $($context),*); + + $macro_to_call_back!(SignerKey, $($context),*); + + $macro_to_call_back!(SignerKeyEd25519SignedPayload, $($context),*); + + $macro_to_call_back!(Signature, $($context),*); + + $macro_to_call_back!(SignatureHint, $($context),*); + + $macro_to_call_back!(NodeId, $($context),*); + + $macro_to_call_back!(AccountId, $($context),*); + + $macro_to_call_back!(Curve25519Secret, $($context),*); + + $macro_to_call_back!(Curve25519Public, $($context),*); + + $macro_to_call_back!(HmacSha256Key, $($context),*); + + $macro_to_call_back!(HmacSha256Mac, $($context),*); + + + }}; +} +pub use _call_macro_with_each_type_53647236d6ceadfee429747f7d6725f269c6917f9a37b47038496c410a3a8868 as call_macro_with_each_type; #[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr( all(feature = "serde", feature = "alloc"), derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub enum TypeVariant { Value, ScpBallot, @@ -44577,6 +46068,623 @@ impl TypeVariant { pub const fn variants() -> [TypeVariant; 425] { Self::VARIANTS } + + #[cfg(feature = "schemars")] + #[must_use] + #[allow(clippy::too_many_lines)] + pub fn json_schema(&self, gen: schemars::gen::SchemaGenerator) -> schemars::schema::RootSchema { + match self { + Self::Value => gen.into_root_schema_for::(), + Self::ScpBallot => gen.into_root_schema_for::(), + Self::ScpStatementType => gen.into_root_schema_for::(), + Self::ScpNomination => gen.into_root_schema_for::(), + Self::ScpStatement => gen.into_root_schema_for::(), + Self::ScpStatementPledges => gen.into_root_schema_for::(), + Self::ScpStatementPrepare => gen.into_root_schema_for::(), + Self::ScpStatementConfirm => gen.into_root_schema_for::(), + Self::ScpStatementExternalize => gen.into_root_schema_for::(), + Self::ScpEnvelope => gen.into_root_schema_for::(), + Self::ScpQuorumSet => gen.into_root_schema_for::(), + Self::ConfigSettingContractExecutionLanesV0 => { + gen.into_root_schema_for::() + } + Self::ConfigSettingContractComputeV0 => { + gen.into_root_schema_for::() + } + Self::ConfigSettingContractLedgerCostV0 => { + gen.into_root_schema_for::() + } + Self::ConfigSettingContractHistoricalDataV0 => { + gen.into_root_schema_for::() + } + Self::ConfigSettingContractEventsV0 => { + gen.into_root_schema_for::() + } + Self::ConfigSettingContractBandwidthV0 => { + gen.into_root_schema_for::() + } + Self::ContractCostType => gen.into_root_schema_for::(), + Self::ContractCostParamEntry => gen.into_root_schema_for::(), + Self::StateArchivalSettings => gen.into_root_schema_for::(), + Self::EvictionIterator => gen.into_root_schema_for::(), + Self::ContractCostParams => gen.into_root_schema_for::(), + Self::ConfigSettingId => gen.into_root_schema_for::(), + Self::ConfigSettingEntry => gen.into_root_schema_for::(), + Self::ScEnvMetaKind => gen.into_root_schema_for::(), + Self::ScEnvMetaEntry => gen.into_root_schema_for::(), + Self::ScMetaV0 => gen.into_root_schema_for::(), + Self::ScMetaKind => gen.into_root_schema_for::(), + Self::ScMetaEntry => gen.into_root_schema_for::(), + Self::ScSpecType => gen.into_root_schema_for::(), + Self::ScSpecTypeOption => gen.into_root_schema_for::(), + Self::ScSpecTypeResult => gen.into_root_schema_for::(), + Self::ScSpecTypeVec => gen.into_root_schema_for::(), + Self::ScSpecTypeMap => gen.into_root_schema_for::(), + Self::ScSpecTypeTuple => gen.into_root_schema_for::(), + Self::ScSpecTypeBytesN => gen.into_root_schema_for::(), + Self::ScSpecTypeUdt => gen.into_root_schema_for::(), + Self::ScSpecTypeDef => gen.into_root_schema_for::(), + Self::ScSpecUdtStructFieldV0 => gen.into_root_schema_for::(), + Self::ScSpecUdtStructV0 => gen.into_root_schema_for::(), + Self::ScSpecUdtUnionCaseVoidV0 => { + gen.into_root_schema_for::() + } + Self::ScSpecUdtUnionCaseTupleV0 => { + gen.into_root_schema_for::() + } + Self::ScSpecUdtUnionCaseV0Kind => { + gen.into_root_schema_for::() + } + Self::ScSpecUdtUnionCaseV0 => gen.into_root_schema_for::(), + Self::ScSpecUdtUnionV0 => gen.into_root_schema_for::(), + Self::ScSpecUdtEnumCaseV0 => gen.into_root_schema_for::(), + Self::ScSpecUdtEnumV0 => gen.into_root_schema_for::(), + Self::ScSpecUdtErrorEnumCaseV0 => { + gen.into_root_schema_for::() + } + Self::ScSpecUdtErrorEnumV0 => gen.into_root_schema_for::(), + Self::ScSpecFunctionInputV0 => gen.into_root_schema_for::(), + Self::ScSpecFunctionV0 => gen.into_root_schema_for::(), + Self::ScSpecEntryKind => gen.into_root_schema_for::(), + Self::ScSpecEntry => gen.into_root_schema_for::(), + Self::ScValType => gen.into_root_schema_for::(), + Self::ScErrorType => gen.into_root_schema_for::(), + Self::ScErrorCode => gen.into_root_schema_for::(), + Self::ScError => gen.into_root_schema_for::(), + Self::UInt128Parts => gen.into_root_schema_for::(), + Self::Int128Parts => gen.into_root_schema_for::(), + Self::UInt256Parts => gen.into_root_schema_for::(), + Self::Int256Parts => gen.into_root_schema_for::(), + Self::ContractExecutableType => gen.into_root_schema_for::(), + Self::ContractExecutable => gen.into_root_schema_for::(), + Self::ScAddressType => gen.into_root_schema_for::(), + Self::ScAddress => gen.into_root_schema_for::(), + Self::ScVec => gen.into_root_schema_for::(), + Self::ScMap => gen.into_root_schema_for::(), + Self::ScBytes => gen.into_root_schema_for::(), + Self::ScString => gen.into_root_schema_for::(), + Self::ScSymbol => gen.into_root_schema_for::(), + Self::ScNonceKey => gen.into_root_schema_for::(), + Self::ScContractInstance => gen.into_root_schema_for::(), + Self::ScVal => gen.into_root_schema_for::(), + Self::ScMapEntry => gen.into_root_schema_for::(), + Self::StoredTransactionSet => gen.into_root_schema_for::(), + Self::StoredDebugTransactionSet => { + gen.into_root_schema_for::() + } + Self::PersistedScpStateV0 => gen.into_root_schema_for::(), + Self::PersistedScpStateV1 => gen.into_root_schema_for::(), + Self::PersistedScpState => gen.into_root_schema_for::(), + Self::Thresholds => gen.into_root_schema_for::(), + Self::String32 => gen.into_root_schema_for::(), + Self::String64 => gen.into_root_schema_for::(), + Self::SequenceNumber => gen.into_root_schema_for::(), + Self::DataValue => gen.into_root_schema_for::(), + Self::PoolId => gen.into_root_schema_for::(), + Self::AssetCode4 => gen.into_root_schema_for::(), + Self::AssetCode12 => gen.into_root_schema_for::(), + Self::AssetType => gen.into_root_schema_for::(), + Self::AssetCode => gen.into_root_schema_for::(), + Self::AlphaNum4 => gen.into_root_schema_for::(), + Self::AlphaNum12 => gen.into_root_schema_for::(), + Self::Asset => gen.into_root_schema_for::(), + Self::Price => gen.into_root_schema_for::(), + Self::Liabilities => gen.into_root_schema_for::(), + Self::ThresholdIndexes => gen.into_root_schema_for::(), + Self::LedgerEntryType => gen.into_root_schema_for::(), + Self::Signer => gen.into_root_schema_for::(), + Self::AccountFlags => gen.into_root_schema_for::(), + Self::SponsorshipDescriptor => gen.into_root_schema_for::(), + Self::AccountEntryExtensionV3 => gen.into_root_schema_for::(), + Self::AccountEntryExtensionV2 => gen.into_root_schema_for::(), + Self::AccountEntryExtensionV2Ext => { + gen.into_root_schema_for::() + } + Self::AccountEntryExtensionV1 => gen.into_root_schema_for::(), + Self::AccountEntryExtensionV1Ext => { + gen.into_root_schema_for::() + } + Self::AccountEntry => gen.into_root_schema_for::(), + Self::AccountEntryExt => gen.into_root_schema_for::(), + Self::TrustLineFlags => gen.into_root_schema_for::(), + Self::LiquidityPoolType => gen.into_root_schema_for::(), + Self::TrustLineAsset => gen.into_root_schema_for::(), + Self::TrustLineEntryExtensionV2 => { + gen.into_root_schema_for::() + } + Self::TrustLineEntryExtensionV2Ext => { + gen.into_root_schema_for::() + } + Self::TrustLineEntry => gen.into_root_schema_for::(), + Self::TrustLineEntryExt => gen.into_root_schema_for::(), + Self::TrustLineEntryV1 => gen.into_root_schema_for::(), + Self::TrustLineEntryV1Ext => gen.into_root_schema_for::(), + Self::OfferEntryFlags => gen.into_root_schema_for::(), + Self::OfferEntry => gen.into_root_schema_for::(), + Self::OfferEntryExt => gen.into_root_schema_for::(), + Self::DataEntry => gen.into_root_schema_for::(), + Self::DataEntryExt => gen.into_root_schema_for::(), + Self::ClaimPredicateType => gen.into_root_schema_for::(), + Self::ClaimPredicate => gen.into_root_schema_for::(), + Self::ClaimantType => gen.into_root_schema_for::(), + Self::Claimant => gen.into_root_schema_for::(), + Self::ClaimantV0 => gen.into_root_schema_for::(), + Self::ClaimableBalanceIdType => gen.into_root_schema_for::(), + Self::ClaimableBalanceId => gen.into_root_schema_for::(), + Self::ClaimableBalanceFlags => gen.into_root_schema_for::(), + Self::ClaimableBalanceEntryExtensionV1 => { + gen.into_root_schema_for::() + } + Self::ClaimableBalanceEntryExtensionV1Ext => { + gen.into_root_schema_for::() + } + Self::ClaimableBalanceEntry => gen.into_root_schema_for::(), + Self::ClaimableBalanceEntryExt => { + gen.into_root_schema_for::() + } + Self::LiquidityPoolConstantProductParameters => { + gen.into_root_schema_for::() + } + Self::LiquidityPoolEntry => gen.into_root_schema_for::(), + Self::LiquidityPoolEntryBody => gen.into_root_schema_for::(), + Self::LiquidityPoolEntryConstantProduct => { + gen.into_root_schema_for::() + } + Self::ContractDataDurability => gen.into_root_schema_for::(), + Self::ContractDataEntry => gen.into_root_schema_for::(), + Self::ContractCodeCostInputs => gen.into_root_schema_for::(), + Self::ContractCodeEntry => gen.into_root_schema_for::(), + Self::ContractCodeEntryExt => gen.into_root_schema_for::(), + Self::ContractCodeEntryV1 => gen.into_root_schema_for::(), + Self::TtlEntry => gen.into_root_schema_for::(), + Self::LedgerEntryExtensionV1 => gen.into_root_schema_for::(), + Self::LedgerEntryExtensionV1Ext => { + gen.into_root_schema_for::() + } + Self::LedgerEntry => gen.into_root_schema_for::(), + Self::LedgerEntryData => gen.into_root_schema_for::(), + Self::LedgerEntryExt => gen.into_root_schema_for::(), + Self::LedgerKey => gen.into_root_schema_for::(), + Self::LedgerKeyAccount => gen.into_root_schema_for::(), + Self::LedgerKeyTrustLine => gen.into_root_schema_for::(), + Self::LedgerKeyOffer => gen.into_root_schema_for::(), + Self::LedgerKeyData => gen.into_root_schema_for::(), + Self::LedgerKeyClaimableBalance => { + gen.into_root_schema_for::() + } + Self::LedgerKeyLiquidityPool => gen.into_root_schema_for::(), + Self::LedgerKeyContractData => gen.into_root_schema_for::(), + Self::LedgerKeyContractCode => gen.into_root_schema_for::(), + Self::LedgerKeyConfigSetting => gen.into_root_schema_for::(), + Self::LedgerKeyTtl => gen.into_root_schema_for::(), + Self::EnvelopeType => gen.into_root_schema_for::(), + Self::UpgradeType => gen.into_root_schema_for::(), + Self::StellarValueType => gen.into_root_schema_for::(), + Self::LedgerCloseValueSignature => { + gen.into_root_schema_for::() + } + Self::StellarValue => gen.into_root_schema_for::(), + Self::StellarValueExt => gen.into_root_schema_for::(), + Self::LedgerHeaderFlags => gen.into_root_schema_for::(), + Self::LedgerHeaderExtensionV1 => gen.into_root_schema_for::(), + Self::LedgerHeaderExtensionV1Ext => { + gen.into_root_schema_for::() + } + Self::LedgerHeader => gen.into_root_schema_for::(), + Self::LedgerHeaderExt => gen.into_root_schema_for::(), + Self::LedgerUpgradeType => gen.into_root_schema_for::(), + Self::ConfigUpgradeSetKey => gen.into_root_schema_for::(), + Self::LedgerUpgrade => gen.into_root_schema_for::(), + Self::ConfigUpgradeSet => gen.into_root_schema_for::(), + Self::BucketEntryType => gen.into_root_schema_for::(), + Self::BucketMetadata => gen.into_root_schema_for::(), + Self::BucketMetadataExt => gen.into_root_schema_for::(), + Self::BucketEntry => gen.into_root_schema_for::(), + Self::TxSetComponentType => gen.into_root_schema_for::(), + Self::TxSetComponent => gen.into_root_schema_for::(), + Self::TxSetComponentTxsMaybeDiscountedFee => { + gen.into_root_schema_for::() + } + Self::TransactionPhase => gen.into_root_schema_for::(), + Self::TransactionSet => gen.into_root_schema_for::(), + Self::TransactionSetV1 => gen.into_root_schema_for::(), + Self::GeneralizedTransactionSet => { + gen.into_root_schema_for::() + } + Self::TransactionResultPair => gen.into_root_schema_for::(), + Self::TransactionResultSet => gen.into_root_schema_for::(), + Self::TransactionHistoryEntry => gen.into_root_schema_for::(), + Self::TransactionHistoryEntryExt => { + gen.into_root_schema_for::() + } + Self::TransactionHistoryResultEntry => { + gen.into_root_schema_for::() + } + Self::TransactionHistoryResultEntryExt => { + gen.into_root_schema_for::() + } + Self::LedgerHeaderHistoryEntry => { + gen.into_root_schema_for::() + } + Self::LedgerHeaderHistoryEntryExt => { + gen.into_root_schema_for::() + } + Self::LedgerScpMessages => gen.into_root_schema_for::(), + Self::ScpHistoryEntryV0 => gen.into_root_schema_for::(), + Self::ScpHistoryEntry => gen.into_root_schema_for::(), + Self::LedgerEntryChangeType => gen.into_root_schema_for::(), + Self::LedgerEntryChange => gen.into_root_schema_for::(), + Self::LedgerEntryChanges => gen.into_root_schema_for::(), + Self::OperationMeta => gen.into_root_schema_for::(), + Self::TransactionMetaV1 => gen.into_root_schema_for::(), + Self::TransactionMetaV2 => gen.into_root_schema_for::(), + Self::ContractEventType => gen.into_root_schema_for::(), + Self::ContractEvent => gen.into_root_schema_for::(), + Self::ContractEventBody => gen.into_root_schema_for::(), + Self::ContractEventV0 => gen.into_root_schema_for::(), + Self::DiagnosticEvent => gen.into_root_schema_for::(), + Self::SorobanTransactionMetaExtV1 => { + gen.into_root_schema_for::() + } + Self::SorobanTransactionMetaExt => { + gen.into_root_schema_for::() + } + Self::SorobanTransactionMeta => gen.into_root_schema_for::(), + Self::TransactionMetaV3 => gen.into_root_schema_for::(), + Self::InvokeHostFunctionSuccessPreImage => { + gen.into_root_schema_for::() + } + Self::TransactionMeta => gen.into_root_schema_for::(), + Self::TransactionResultMeta => gen.into_root_schema_for::(), + Self::UpgradeEntryMeta => gen.into_root_schema_for::(), + Self::LedgerCloseMetaV0 => gen.into_root_schema_for::(), + Self::LedgerCloseMetaExtV1 => gen.into_root_schema_for::(), + Self::LedgerCloseMetaExt => gen.into_root_schema_for::(), + Self::LedgerCloseMetaV1 => gen.into_root_schema_for::(), + Self::LedgerCloseMeta => gen.into_root_schema_for::(), + Self::ErrorCode => gen.into_root_schema_for::(), + Self::SError => gen.into_root_schema_for::(), + Self::SendMore => gen.into_root_schema_for::(), + Self::SendMoreExtended => gen.into_root_schema_for::(), + Self::AuthCert => gen.into_root_schema_for::(), + Self::Hello => gen.into_root_schema_for::(), + Self::Auth => gen.into_root_schema_for::(), + Self::IpAddrType => gen.into_root_schema_for::(), + Self::PeerAddress => gen.into_root_schema_for::(), + Self::PeerAddressIp => gen.into_root_schema_for::(), + Self::MessageType => gen.into_root_schema_for::(), + Self::DontHave => gen.into_root_schema_for::(), + Self::SurveyMessageCommandType => { + gen.into_root_schema_for::() + } + Self::SurveyMessageResponseType => { + gen.into_root_schema_for::() + } + Self::SurveyRequestMessage => gen.into_root_schema_for::(), + Self::SignedSurveyRequestMessage => { + gen.into_root_schema_for::() + } + Self::EncryptedBody => gen.into_root_schema_for::(), + Self::SurveyResponseMessage => gen.into_root_schema_for::(), + Self::SignedSurveyResponseMessage => { + gen.into_root_schema_for::() + } + Self::PeerStats => gen.into_root_schema_for::(), + Self::PeerStatList => gen.into_root_schema_for::(), + Self::TopologyResponseBodyV0 => gen.into_root_schema_for::(), + Self::TopologyResponseBodyV1 => gen.into_root_schema_for::(), + Self::SurveyResponseBody => gen.into_root_schema_for::(), + Self::TxAdvertVector => gen.into_root_schema_for::(), + Self::FloodAdvert => gen.into_root_schema_for::(), + Self::TxDemandVector => gen.into_root_schema_for::(), + Self::FloodDemand => gen.into_root_schema_for::(), + Self::StellarMessage => gen.into_root_schema_for::(), + Self::AuthenticatedMessage => gen.into_root_schema_for::(), + Self::AuthenticatedMessageV0 => gen.into_root_schema_for::(), + Self::LiquidityPoolParameters => gen.into_root_schema_for::(), + Self::MuxedAccount => gen.into_root_schema_for::(), + Self::MuxedAccountMed25519 => gen.into_root_schema_for::(), + Self::DecoratedSignature => gen.into_root_schema_for::(), + Self::OperationType => gen.into_root_schema_for::(), + Self::CreateAccountOp => gen.into_root_schema_for::(), + Self::PaymentOp => gen.into_root_schema_for::(), + Self::PathPaymentStrictReceiveOp => { + gen.into_root_schema_for::() + } + Self::PathPaymentStrictSendOp => gen.into_root_schema_for::(), + Self::ManageSellOfferOp => gen.into_root_schema_for::(), + Self::ManageBuyOfferOp => gen.into_root_schema_for::(), + Self::CreatePassiveSellOfferOp => { + gen.into_root_schema_for::() + } + Self::SetOptionsOp => gen.into_root_schema_for::(), + Self::ChangeTrustAsset => gen.into_root_schema_for::(), + Self::ChangeTrustOp => gen.into_root_schema_for::(), + Self::AllowTrustOp => gen.into_root_schema_for::(), + Self::ManageDataOp => gen.into_root_schema_for::(), + Self::BumpSequenceOp => gen.into_root_schema_for::(), + Self::CreateClaimableBalanceOp => { + gen.into_root_schema_for::() + } + Self::ClaimClaimableBalanceOp => gen.into_root_schema_for::(), + Self::BeginSponsoringFutureReservesOp => { + gen.into_root_schema_for::() + } + Self::RevokeSponsorshipType => gen.into_root_schema_for::(), + Self::RevokeSponsorshipOp => gen.into_root_schema_for::(), + Self::RevokeSponsorshipOpSigner => { + gen.into_root_schema_for::() + } + Self::ClawbackOp => gen.into_root_schema_for::(), + Self::ClawbackClaimableBalanceOp => { + gen.into_root_schema_for::() + } + Self::SetTrustLineFlagsOp => gen.into_root_schema_for::(), + Self::LiquidityPoolDepositOp => gen.into_root_schema_for::(), + Self::LiquidityPoolWithdrawOp => gen.into_root_schema_for::(), + Self::HostFunctionType => gen.into_root_schema_for::(), + Self::ContractIdPreimageType => gen.into_root_schema_for::(), + Self::ContractIdPreimage => gen.into_root_schema_for::(), + Self::ContractIdPreimageFromAddress => { + gen.into_root_schema_for::() + } + Self::CreateContractArgs => gen.into_root_schema_for::(), + Self::InvokeContractArgs => gen.into_root_schema_for::(), + Self::HostFunction => gen.into_root_schema_for::(), + Self::SorobanAuthorizedFunctionType => { + gen.into_root_schema_for::() + } + Self::SorobanAuthorizedFunction => { + gen.into_root_schema_for::() + } + Self::SorobanAuthorizedInvocation => { + gen.into_root_schema_for::() + } + Self::SorobanAddressCredentials => { + gen.into_root_schema_for::() + } + Self::SorobanCredentialsType => gen.into_root_schema_for::(), + Self::SorobanCredentials => gen.into_root_schema_for::(), + Self::SorobanAuthorizationEntry => { + gen.into_root_schema_for::() + } + Self::InvokeHostFunctionOp => gen.into_root_schema_for::(), + Self::ExtendFootprintTtlOp => gen.into_root_schema_for::(), + Self::RestoreFootprintOp => gen.into_root_schema_for::(), + Self::Operation => gen.into_root_schema_for::(), + Self::OperationBody => gen.into_root_schema_for::(), + Self::HashIdPreimage => gen.into_root_schema_for::(), + Self::HashIdPreimageOperationId => { + gen.into_root_schema_for::() + } + Self::HashIdPreimageRevokeId => gen.into_root_schema_for::(), + Self::HashIdPreimageContractId => { + gen.into_root_schema_for::() + } + Self::HashIdPreimageSorobanAuthorization => { + gen.into_root_schema_for::() + } + Self::MemoType => gen.into_root_schema_for::(), + Self::Memo => gen.into_root_schema_for::(), + Self::TimeBounds => gen.into_root_schema_for::(), + Self::LedgerBounds => gen.into_root_schema_for::(), + Self::PreconditionsV2 => gen.into_root_schema_for::(), + Self::PreconditionType => gen.into_root_schema_for::(), + Self::Preconditions => gen.into_root_schema_for::(), + Self::LedgerFootprint => gen.into_root_schema_for::(), + Self::SorobanResources => gen.into_root_schema_for::(), + Self::SorobanTransactionData => gen.into_root_schema_for::(), + Self::TransactionV0 => gen.into_root_schema_for::(), + Self::TransactionV0Ext => gen.into_root_schema_for::(), + Self::TransactionV0Envelope => gen.into_root_schema_for::(), + Self::Transaction => gen.into_root_schema_for::(), + Self::TransactionExt => gen.into_root_schema_for::(), + Self::TransactionV1Envelope => gen.into_root_schema_for::(), + Self::FeeBumpTransaction => gen.into_root_schema_for::(), + Self::FeeBumpTransactionInnerTx => { + gen.into_root_schema_for::() + } + Self::FeeBumpTransactionExt => gen.into_root_schema_for::(), + Self::FeeBumpTransactionEnvelope => { + gen.into_root_schema_for::() + } + Self::TransactionEnvelope => gen.into_root_schema_for::(), + Self::TransactionSignaturePayload => { + gen.into_root_schema_for::() + } + Self::TransactionSignaturePayloadTaggedTransaction => { + gen.into_root_schema_for::() + } + Self::ClaimAtomType => gen.into_root_schema_for::(), + Self::ClaimOfferAtomV0 => gen.into_root_schema_for::(), + Self::ClaimOfferAtom => gen.into_root_schema_for::(), + Self::ClaimLiquidityAtom => gen.into_root_schema_for::(), + Self::ClaimAtom => gen.into_root_schema_for::(), + Self::CreateAccountResultCode => gen.into_root_schema_for::(), + Self::CreateAccountResult => gen.into_root_schema_for::(), + Self::PaymentResultCode => gen.into_root_schema_for::(), + Self::PaymentResult => gen.into_root_schema_for::(), + Self::PathPaymentStrictReceiveResultCode => { + gen.into_root_schema_for::() + } + Self::SimplePaymentResult => gen.into_root_schema_for::(), + Self::PathPaymentStrictReceiveResult => { + gen.into_root_schema_for::() + } + Self::PathPaymentStrictReceiveResultSuccess => { + gen.into_root_schema_for::() + } + Self::PathPaymentStrictSendResultCode => { + gen.into_root_schema_for::() + } + Self::PathPaymentStrictSendResult => { + gen.into_root_schema_for::() + } + Self::PathPaymentStrictSendResultSuccess => { + gen.into_root_schema_for::() + } + Self::ManageSellOfferResultCode => { + gen.into_root_schema_for::() + } + Self::ManageOfferEffect => gen.into_root_schema_for::(), + Self::ManageOfferSuccessResult => { + gen.into_root_schema_for::() + } + Self::ManageOfferSuccessResultOffer => { + gen.into_root_schema_for::() + } + Self::ManageSellOfferResult => gen.into_root_schema_for::(), + Self::ManageBuyOfferResultCode => { + gen.into_root_schema_for::() + } + Self::ManageBuyOfferResult => gen.into_root_schema_for::(), + Self::SetOptionsResultCode => gen.into_root_schema_for::(), + Self::SetOptionsResult => gen.into_root_schema_for::(), + Self::ChangeTrustResultCode => gen.into_root_schema_for::(), + Self::ChangeTrustResult => gen.into_root_schema_for::(), + Self::AllowTrustResultCode => gen.into_root_schema_for::(), + Self::AllowTrustResult => gen.into_root_schema_for::(), + Self::AccountMergeResultCode => gen.into_root_schema_for::(), + Self::AccountMergeResult => gen.into_root_schema_for::(), + Self::InflationResultCode => gen.into_root_schema_for::(), + Self::InflationPayout => gen.into_root_schema_for::(), + Self::InflationResult => gen.into_root_schema_for::(), + Self::ManageDataResultCode => gen.into_root_schema_for::(), + Self::ManageDataResult => gen.into_root_schema_for::(), + Self::BumpSequenceResultCode => gen.into_root_schema_for::(), + Self::BumpSequenceResult => gen.into_root_schema_for::(), + Self::CreateClaimableBalanceResultCode => { + gen.into_root_schema_for::() + } + Self::CreateClaimableBalanceResult => { + gen.into_root_schema_for::() + } + Self::ClaimClaimableBalanceResultCode => { + gen.into_root_schema_for::() + } + Self::ClaimClaimableBalanceResult => { + gen.into_root_schema_for::() + } + Self::BeginSponsoringFutureReservesResultCode => { + gen.into_root_schema_for::() + } + Self::BeginSponsoringFutureReservesResult => { + gen.into_root_schema_for::() + } + Self::EndSponsoringFutureReservesResultCode => { + gen.into_root_schema_for::() + } + Self::EndSponsoringFutureReservesResult => { + gen.into_root_schema_for::() + } + Self::RevokeSponsorshipResultCode => { + gen.into_root_schema_for::() + } + Self::RevokeSponsorshipResult => gen.into_root_schema_for::(), + Self::ClawbackResultCode => gen.into_root_schema_for::(), + Self::ClawbackResult => gen.into_root_schema_for::(), + Self::ClawbackClaimableBalanceResultCode => { + gen.into_root_schema_for::() + } + Self::ClawbackClaimableBalanceResult => { + gen.into_root_schema_for::() + } + Self::SetTrustLineFlagsResultCode => { + gen.into_root_schema_for::() + } + Self::SetTrustLineFlagsResult => gen.into_root_schema_for::(), + Self::LiquidityPoolDepositResultCode => { + gen.into_root_schema_for::() + } + Self::LiquidityPoolDepositResult => { + gen.into_root_schema_for::() + } + Self::LiquidityPoolWithdrawResultCode => { + gen.into_root_schema_for::() + } + Self::LiquidityPoolWithdrawResult => { + gen.into_root_schema_for::() + } + Self::InvokeHostFunctionResultCode => { + gen.into_root_schema_for::() + } + Self::InvokeHostFunctionResult => { + gen.into_root_schema_for::() + } + Self::ExtendFootprintTtlResultCode => { + gen.into_root_schema_for::() + } + Self::ExtendFootprintTtlResult => { + gen.into_root_schema_for::() + } + Self::RestoreFootprintResultCode => { + gen.into_root_schema_for::() + } + Self::RestoreFootprintResult => gen.into_root_schema_for::(), + Self::OperationResultCode => gen.into_root_schema_for::(), + Self::OperationResult => gen.into_root_schema_for::(), + Self::OperationResultTr => gen.into_root_schema_for::(), + Self::TransactionResultCode => gen.into_root_schema_for::(), + Self::InnerTransactionResult => gen.into_root_schema_for::(), + Self::InnerTransactionResultResult => { + gen.into_root_schema_for::() + } + Self::InnerTransactionResultExt => { + gen.into_root_schema_for::() + } + Self::InnerTransactionResultPair => { + gen.into_root_schema_for::() + } + Self::TransactionResult => gen.into_root_schema_for::(), + Self::TransactionResultResult => gen.into_root_schema_for::(), + Self::TransactionResultExt => gen.into_root_schema_for::(), + Self::Hash => gen.into_root_schema_for::(), + Self::Uint256 => gen.into_root_schema_for::(), + Self::Uint32 => gen.into_root_schema_for::(), + Self::Int32 => gen.into_root_schema_for::(), + Self::Uint64 => gen.into_root_schema_for::(), + Self::Int64 => gen.into_root_schema_for::(), + Self::TimePoint => gen.into_root_schema_for::(), + Self::Duration => gen.into_root_schema_for::(), + Self::ExtensionPoint => gen.into_root_schema_for::(), + Self::CryptoKeyType => gen.into_root_schema_for::(), + Self::PublicKeyType => gen.into_root_schema_for::(), + Self::SignerKeyType => gen.into_root_schema_for::(), + Self::PublicKey => gen.into_root_schema_for::(), + Self::SignerKey => gen.into_root_schema_for::(), + Self::SignerKeyEd25519SignedPayload => { + gen.into_root_schema_for::() + } + Self::Signature => gen.into_root_schema_for::(), + Self::SignatureHint => gen.into_root_schema_for::(), + Self::NodeId => gen.into_root_schema_for::(), + Self::AccountId => gen.into_root_schema_for::(), + Self::Curve25519Secret => gen.into_root_schema_for::(), + Self::Curve25519Public => gen.into_root_schema_for::(), + Self::HmacSha256Key => gen.into_root_schema_for::(), + Self::HmacSha256Mac => gen.into_root_schema_for::(), + } + } } impl Name for TypeVariant { @@ -45048,6 +47156,7 @@ impl core::str::FromStr for TypeVariant { serde(rename_all = "snake_case"), serde(untagged) )] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub enum Type { Value(Box), ScpBallot(Box), diff --git a/src/next/jsonschema.rs b/src/next/jsonschema.rs new file mode 100644 index 00000000..ce23b940 --- /dev/null +++ b/src/next/jsonschema.rs @@ -0,0 +1,28 @@ +#![cfg(feature = "schemars")] +use schemars::{gen::SchemaGenerator, schema::Schema, JsonSchema}; + +macro_rules! impl_json_schema_string { + ($type:ident) => { + impl JsonSchema for super::$type { + fn schema_name() -> String { + stringify!($type).to_string() + } + + fn json_schema(gen: &mut SchemaGenerator) -> Schema { + String::json_schema(gen) + } + } + }; +} + +impl_json_schema_string!(PublicKey); +impl_json_schema_string!(AccountId); +impl_json_schema_string!(MuxedAccount); +impl_json_schema_string!(MuxedAccountMed25519); +impl_json_schema_string!(SignerKey); +impl_json_schema_string!(SignerKeyEd25519SignedPayload); +impl_json_schema_string!(NodeId); +impl_json_schema_string!(ScAddress); +impl_json_schema_string!(AssetCode); +impl_json_schema_string!(AssetCode4); +impl_json_schema_string!(AssetCode12); diff --git a/src/next/mod.rs b/src/next/mod.rs index 288c1e2e..ec2f1e37 100644 --- a/src/next/mod.rs +++ b/src/next/mod.rs @@ -1,6 +1,7 @@ mod generated; pub use generated::*; +mod jsonschema; mod str; mod scval_conversions; diff --git a/tests/serde_tx_schema.rs b/tests/serde_tx_schema.rs new file mode 100644 index 00000000..6f7d9ea6 --- /dev/null +++ b/tests/serde_tx_schema.rs @@ -0,0 +1,12 @@ +#![cfg(feature = "wasm")] + +use stellar_xdr::{curr::TypeVariant, schema::Schema}; + +#[allow(clippy::too_many_lines)] +#[test] +fn test_serde_tx_schema() -> Result<(), Box> { + let schema: Schema = TypeVariant::ScVal.try_into()?; + let s = serde_json::to_string_pretty(&schema.0)?; + println!("{s}"); + Ok(()) +}