From f507f5119d244f3299e937339e0eda715a3a1b2c Mon Sep 17 00:00:00 2001 From: Willem Wyndham Date: Thu, 31 Jul 2025 12:05:01 -0400 Subject: [PATCH 1/3] fix: remove macro and put it in the soroban-sdk --- Cargo.lock | 1708 ++++++++++++++ Cargo.toml | 22 + FULL_HELP_DOCS.md | 2623 ---------------------- README.md | 102 +- admin/Cargo.toml | 18 +- admin/src/lib.rs | 41 +- admin/src/test.rs | 13 +- admin_sep/Cargo.toml | 18 +- admin_sep/src/administratable.rs | 29 +- admin_sep/src/constructor.rs | 138 +- admin_sep/src/lib.rs | 3 +- admin_sep/src/upgradable.rs | 24 +- admin_v2/Cargo.lock | 1879 ++++++++++++++++ admin_v2/Cargo.toml | 17 + admin_v2/Makefile | 17 + admin_v2/rust-toolchain.toml | 4 + admin_v2/src/lib.rs | 22 + {admin_sep => admin_v2}/src/test.rs | 9 +- contracttrait-macro/Cargo.lock | 748 ------ contracttrait-macro/Cargo.toml | 34 - contracttrait-macro/README.md | 13 - contracttrait-macro/src/args.rs | 34 - contracttrait-macro/src/contracttrait.rs | 424 ---- contracttrait-macro/src/error.rs | 18 - contracttrait-macro/src/lib.rs | 91 - contracttrait-macro/src/util.rs | 42 - 26 files changed, 3879 insertions(+), 4212 deletions(-) create mode 100644 Cargo.lock create mode 100644 Cargo.toml delete mode 100644 FULL_HELP_DOCS.md create mode 100644 admin_v2/Cargo.lock create mode 100644 admin_v2/Cargo.toml create mode 100644 admin_v2/Makefile create mode 100644 admin_v2/rust-toolchain.toml create mode 100644 admin_v2/src/lib.rs rename {admin_sep => admin_v2}/src/test.rs (54%) delete mode 100644 contracttrait-macro/Cargo.lock delete mode 100644 contracttrait-macro/Cargo.toml delete mode 100644 contracttrait-macro/README.md delete mode 100644 contracttrait-macro/src/args.rs delete mode 100644 contracttrait-macro/src/contracttrait.rs delete mode 100644 contracttrait-macro/src/error.rs delete mode 100644 contracttrait-macro/src/lib.rs delete mode 100644 contracttrait-macro/src/util.rs diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..8d5493f --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,1708 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "admin-sep" +version = "0.0.0" +dependencies = [ + "soroban-sdk", +] + +[[package]] +name = "ahash" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "arbitrary" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" +dependencies = [ + "derive_arbitrary", +] + +[[package]] +name = "ark-bls12-381" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c775f0d12169cba7aae4caeb547bb6a50781c7449a8aa53793827c9ec4abf488" +dependencies = [ + "ark-ec", + "ark-ff", + "ark-serialize", + "ark-std", +] + +[[package]] +name = "ark-ec" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "defd9a439d56ac24968cca0571f598a61bc8c55f71d50a89cda591cb750670ba" +dependencies = [ + "ark-ff", + "ark-poly", + "ark-serialize", + "ark-std", + "derivative", + "hashbrown 0.13.2", + "itertools", + "num-traits", + "zeroize", +] + +[[package]] +name = "ark-ff" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec847af850f44ad29048935519032c33da8aa03340876d351dfab5660d2966ba" +dependencies = [ + "ark-ff-asm", + "ark-ff-macros", + "ark-serialize", + "ark-std", + "derivative", + "digest", + "itertools", + "num-bigint", + "num-traits", + "paste", + "rustc_version", + "zeroize", +] + +[[package]] +name = "ark-ff-asm" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-macros" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" +dependencies = [ + "num-bigint", + "num-traits", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-poly" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d320bfc44ee185d899ccbadfa8bc31aab923ce1558716e1997a1e74057fe86bf" +dependencies = [ + "ark-ff", + "ark-serialize", + "ark-std", + "derivative", + "hashbrown 0.13.2", +] + +[[package]] +name = "ark-serialize" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" +dependencies = [ + "ark-serialize-derive", + "ark-std", + "digest", + "num-bigint", +] + +[[package]] +name = "ark-serialize-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae3281bc6d0fd7e549af32b52511e1302185bd688fd3359fa36423346ff682ea" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-std" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" +dependencies = [ + "num-traits", + "rand", +] + +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "base64ct" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bumpalo" +version = "3.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" + +[[package]] +name = "bytes-lit" +version = "0.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0adabf37211a5276e46335feabcbb1530c95eb3fdf85f324c7db942770aa025d" +dependencies = [ + "num-bigint", + "proc-macro2", + "quote", + "syn 2.0.104", +] + +[[package]] +name = "cc" +version = "1.2.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ad45f4f74e4e20eaa392913b7b33a7091c87e59628f4dd27888205ad888843c" +dependencies = [ + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" + +[[package]] +name = "cfg_eval" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45565fc9416b9896014f5732ac776f810ee53a66730c17e4020c3ec064a8f88f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.104", +] + +[[package]] +name = "chrono" +version = "0.4.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c469d952047f47f91b68d1cba3f10d63c11d73e4636f24f08daf0278abf01c4d" +dependencies = [ + "android-tzdata", + "iana-time-zone", + "num-traits", + "serde", + "windows-link", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "crate-git-revision" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c521bf1f43d31ed2f73441775ed31935d77901cb3451e44b38a1c1612fcbaf98" +dependencies = [ + "serde", + "serde_derive", + "serde_json", +] + +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "ctor" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a2785755761f3ddc1492979ce1e48d2c00d09311c39e4466429188f3dd6501" +dependencies = [ + "quote", + "syn 2.0.104", +] + +[[package]] +name = "curve25519-dalek" +version = "4.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest", + "fiat-crypto", + "rustc_version", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.104", +] + +[[package]] +name = "darling" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.104", +] + +[[package]] +name = "darling_macro" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" +dependencies = [ + "darling_core", + "quote", + "syn 2.0.104", +] + +[[package]] +name = "data-encoding" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a2330da5de22e8a3cb63252ce2abb30116bf5265e89c0e01bc17015ce30a476" + +[[package]] +name = "der" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" +dependencies = [ + "const-oid", + "zeroize", +] + +[[package]] +name = "deranged" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c9e6a11ca8224451684bc0d7d5a7adbf8f2fd6887261a1cfc3c0432f9d4068e" +dependencies = [ + "powerfmt", + "serde", +] + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "derive_arbitrary" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.104", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "const-oid", + "crypto-common", + "subtle", +] + +[[package]] +name = "downcast-rs" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" + +[[package]] +name = "dyn-clone" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c7a8fb8a9fbf66c1f703fe16184d10ca0ee9d23be5b4436400408ba54a95005" + +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest", + "elliptic-curve", + "rfc6979", + "signature", +] + +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8", + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a3daa8e81a3963a60642bcc1f90a670680bd4a77535faa384e9d1c79d620871" +dependencies = [ + "curve25519-dalek", + "ed25519", + "rand_core", + "serde", + "sha2", + "subtle", + "zeroize", +] + +[[package]] +name = "either" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" + +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "rand_core", + "sec1", + "subtle", + "zeroize", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "escape-bytes" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bfcf67fea2815c2fc3b90873fae90957be12ff417335dfadc7f52927feb03b2" + +[[package]] +name = "ethnum" +version = "1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca81e6b4777c89fd810c25a4be2b1bd93ea034fbe58e6a75216a34c6b82c539b" + +[[package]] +name = "example-admin-contract" +version = "0.0.0" +dependencies = [ + "admin-sep", + "soroban-sdk", +] + +[[package]] +name = "example-admin-contract-v2" +version = "0.0.0" +dependencies = [ + "admin-sep", + "soroban-sdk", +] + +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core", + "subtle", +] + +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", + "zeroize", +] + +[[package]] +name = "getrandom" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", +] + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash", +] + +[[package]] +name = "hashbrown" +version = "0.15.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5971ac85611da7067dbfcabef3c70ebb5606018acd9e2a3903a0da507521e0d5" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +dependencies = [ + "serde", +] + +[[package]] +name = "hex-literal" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0c919e5debc312ad217002b8048a17b7d83f80703865bbfcfebb0458b0b27d8" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", + "serde", +] + +[[package]] +name = "indexmap" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661" +dependencies = [ + "equivalent", + "hashbrown 0.15.4", + "serde", +] + +[[package]] +name = "indexmap-nostd" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e04e2fd2b8188ea827b32ef11de88377086d690286ab35747ef7f9bf3ccb590" + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" + +[[package]] +name = "js-sys" +version = "0.3.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" +dependencies = [ + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "k256" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "sha2", +] + +[[package]] +name = "keccak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "libc" +version = "0.2.174" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776" + +[[package]] +name = "libm" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" + +[[package]] +name = "log" +version = "0.4.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" + +[[package]] +name = "macro-string" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b27834086c65ec3f9387b096d66e99f221cf081c2b738042aa252bcd41204e3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.104", +] + +[[package]] +name = "memchr" +version = "2.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" + +[[package]] +name = "num-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + +[[package]] +name = "num-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.104", +] + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "ecdsa", + "elliptic-curve", + "primeorder", + "sha2", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "prettyplease" +version = "0.2.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "061c1221631e079b26479d25bbf2275bfe5917ae8419cd7e34f13bfc2aa7539a" +dependencies = [ + "proc-macro2", + "syn 2.0.104", +] + +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", +] + +[[package]] +name = "proc-macro2" +version = "1.0.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "ref-cast" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a0ae411dbe946a674d89546582cea4ba2bb8defac896622d6496f14c23ba5cf" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1165225c21bff1f3bbce98f5a1f889949bc902d3575308cc7b0de30b4f6d27c7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.104", +] + +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "rustversion" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d" + +[[package]] +name = "ryu" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" + +[[package]] +name = "schemars" +version = "0.8.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fbf2ae1b8bc8e02df939598064d22402220cd5bbcca1c76f7d6a310974d5615" +dependencies = [ + "dyn-clone", + "serde", + "serde_json", +] + +[[package]] +name = "schemars" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd191f9397d57d581cddd31014772520aa448f65ef991055d7f61582c65165f" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + +[[package]] +name = "schemars" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1375ba8ef45a6f15d83fa8748f1079428295d403d6ea991d09ab100155fbc06d" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "subtle", + "zeroize", +] + +[[package]] +name = "semver" +version = "1.0.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" + +[[package]] +name = "serde" +version = "1.0.219" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.219" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.104", +] + +[[package]] +name = "serde_json" +version = "1.0.140" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] + +[[package]] +name = "serde_with" +version = "3.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2c45cd61fefa9db6f254525d46e392b852e0e61d9a1fd36e5bd183450a556d5" +dependencies = [ + "base64", + "chrono", + "hex", + "indexmap 1.9.3", + "indexmap 2.10.0", + "schemars 0.8.22", + "schemars 0.9.0", + "schemars 1.0.3", + "serde", + "serde_derive", + "serde_json", + "serde_with_macros", + "time", +] + +[[package]] +name = "serde_with_macros" +version = "3.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de90945e6565ce0d9a25098082ed4ee4002e047cb59892c318d66821e14bb30f" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.104", +] + +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha3" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +dependencies = [ + "digest", + "keccak", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest", + "rand_core", +] + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" + +[[package]] +name = "soroban-builtin-sdk-macros" +version = "23.0.0-rc.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ae7f1f1908c9cdb7740eb9bb7a467770ff26fa4c82e49fdb4de88027b5fb93c" +dependencies = [ + "itertools", + "proc-macro2", + "quote", + "syn 2.0.104", +] + +[[package]] +name = "soroban-env-common" +version = "23.0.0-rc.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c20fd873e412036f93916c946d497216d8a997a5f8c13a342127fe0043cde49" +dependencies = [ + "arbitrary", + "crate-git-revision", + "ethnum", + "num-derive", + "num-traits", + "serde", + "soroban-env-macros", + "soroban-wasmi", + "static_assertions", + "stellar-xdr", + "wasmparser", +] + +[[package]] +name = "soroban-env-guest" +version = "23.0.0-rc.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f18662e41bcfc9914ec365c3743ac040513403f1ca2cc7bad0a7a846f179391c" +dependencies = [ + "soroban-env-common", + "static_assertions", +] + +[[package]] +name = "soroban-env-host" +version = "23.0.0-rc.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1a03f55efb228e2b687276a4171291c814b7ee38d2aed926d7cb5a786bf269a" +dependencies = [ + "ark-bls12-381", + "ark-ec", + "ark-ff", + "ark-serialize", + "curve25519-dalek", + "ecdsa", + "ed25519-dalek", + "elliptic-curve", + "generic-array", + "getrandom", + "hex-literal", + "hmac", + "k256", + "num-derive", + "num-integer", + "num-traits", + "p256", + "rand", + "rand_chacha", + "sec1", + "sha2", + "sha3", + "soroban-builtin-sdk-macros", + "soroban-env-common", + "soroban-wasmi", + "static_assertions", + "stellar-strkey", + "wasmparser", +] + +[[package]] +name = "soroban-env-macros" +version = "23.0.0-rc.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "273c716dcf8797dd70517cc79af7b788934a17ced73a156bd6511f51930d4cd7" +dependencies = [ + "itertools", + "proc-macro2", + "quote", + "serde", + "serde_json", + "stellar-xdr", + "syn 2.0.104", +] + +[[package]] +name = "soroban-ledger-snapshot" +version = "23.0.0-rc.2.3" +source = "git+https://github.com/ahalabs/rs-soroban-sdk?rev=4bdd847e386c8d8256ce7afef2b684899d3f189c#4bdd847e386c8d8256ce7afef2b684899d3f189c" +dependencies = [ + "serde", + "serde_json", + "serde_with", + "soroban-env-common", + "soroban-env-host", + "thiserror", +] + +[[package]] +name = "soroban-sdk" +version = "23.0.0-rc.2.3" +source = "git+https://github.com/ahalabs/rs-soroban-sdk?rev=4bdd847e386c8d8256ce7afef2b684899d3f189c#4bdd847e386c8d8256ce7afef2b684899d3f189c" +dependencies = [ + "arbitrary", + "bytes-lit", + "crate-git-revision", + "ctor", + "derive_arbitrary", + "ed25519-dalek", + "rand", + "rustc_version", + "serde", + "serde_json", + "soroban-env-guest", + "soroban-env-host", + "soroban-ledger-snapshot", + "soroban-sdk-macros", + "stellar-strkey", +] + +[[package]] +name = "soroban-sdk-macros" +version = "23.0.0-rc.2.3" +source = "git+https://github.com/ahalabs/rs-soroban-sdk?rev=4bdd847e386c8d8256ce7afef2b684899d3f189c#4bdd847e386c8d8256ce7afef2b684899d3f189c" +dependencies = [ + "darling", + "heck", + "itertools", + "macro-string", + "proc-macro2", + "quote", + "sha2", + "soroban-env-common", + "soroban-spec", + "soroban-spec-rust", + "stellar-xdr", + "syn 2.0.104", +] + +[[package]] +name = "soroban-spec" +version = "23.0.0-rc.2.3" +source = "git+https://github.com/ahalabs/rs-soroban-sdk?rev=4bdd847e386c8d8256ce7afef2b684899d3f189c#4bdd847e386c8d8256ce7afef2b684899d3f189c" +dependencies = [ + "base64", + "stellar-xdr", + "thiserror", + "wasmparser", +] + +[[package]] +name = "soroban-spec-rust" +version = "23.0.0-rc.2.3" +source = "git+https://github.com/ahalabs/rs-soroban-sdk?rev=4bdd847e386c8d8256ce7afef2b684899d3f189c#4bdd847e386c8d8256ce7afef2b684899d3f189c" +dependencies = [ + "prettyplease", + "proc-macro2", + "quote", + "sha2", + "soroban-spec", + "stellar-xdr", + "syn 2.0.104", + "thiserror", +] + +[[package]] +name = "soroban-wasmi" +version = "0.31.1-soroban.20.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "710403de32d0e0c35375518cb995d4fc056d0d48966f2e56ea471b8cb8fc9719" +dependencies = [ + "smallvec", + "spin", + "wasmi_arena", + "wasmi_core", + "wasmparser-nostd", +] + +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "stellar-strkey" +version = "0.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee1832fb50c651ad10f734aaf5d31ca5acdfb197a6ecda64d93fcdb8885af913" +dependencies = [ + "crate-git-revision", + "data-encoding", +] + +[[package]] +name = "stellar-xdr" +version = "23.0.0-rc.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "632bf15309c2992c059fb499275a706f6afdfd68c690508d5d9bfa96c771477f" +dependencies = [ + "arbitrary", + "base64", + "cfg_eval", + "crate-git-revision", + "escape-bytes", + "ethnum", + "hex", + "serde", + "serde_with", + "sha2", + "stellar-strkey", +] + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.104", +] + +[[package]] +name = "time" +version = "0.3.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7619e19bc266e0f9c5e6686659d394bc57973859340060a69221e57dbc0c40" +dependencies = [ + "deranged", + "itoa", + "num-conv", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9e9a38711f559d9e3ce1cdb06dd7c5b8ea546bc90052da6d06bb76da74bb07c" + +[[package]] +name = "time-macros" +version = "0.2.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3526739392ec93fd8b359c8e98514cb3e8e021beb4e5f597b00a0221f8ed8a49" +dependencies = [ + "num-conv", + "time-core", +] + +[[package]] +name = "typenum" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" + +[[package]] +name = "unicode-ident" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasm-bindgen" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" +dependencies = [ + "bumpalo", + "log", + "proc-macro2", + "quote", + "syn 2.0.104", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.104", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "wasmi_arena" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "104a7f73be44570cac297b3035d76b169d6599637631cf37a1703326a0727073" + +[[package]] +name = "wasmi_core" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcf1a7db34bff95b85c261002720c00c3a6168256dcb93041d3fa2054d19856a" +dependencies = [ + "downcast-rs", + "libm", + "num-traits", + "paste", +] + +[[package]] +name = "wasmparser" +version = "0.116.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a58e28b80dd8340cb07b8242ae654756161f6fc8d0038123d679b7b99964fa50" +dependencies = [ + "indexmap 2.10.0", + "semver", +] + +[[package]] +name = "wasmparser-nostd" +version = "0.100.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5a015fe95f3504a94bb1462c717aae75253e39b9dd6c3fb1062c934535c64aa" +dependencies = [ + "indexmap-nostd", +] + +[[package]] +name = "windows-core" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-implement" +version = "0.60.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.104", +] + +[[package]] +name = "windows-interface" +version = "0.59.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.104", +] + +[[package]] +name = "windows-link" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" + +[[package]] +name = "windows-result" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" +dependencies = [ + "windows-link", +] + +[[package]] +name = "zerocopy" +version = "0.8.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1039dd0d3c310cf05de012d8a39ff557cb0d23087fd44cad61df08fc31907a2f" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.104", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.104", +] diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..86c7948 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,22 @@ +[workspace] +resolver = "2" +members = ["admin_sep", "admin", "admin_v2"] + +[workspace.dependencies] +soroban-sdk = { git = "https://github.com/ahalabs/rs-soroban-sdk", rev = "4bdd847e386c8d8256ce7afef2b684899d3f189c" } + +[profile.contracts] +inherits = "release" +opt-level = "z" +overflow-checks = true +debug = 0 +strip = "symbols" +debug-assertions = true +panic = "abort" +codegen-units = 1 +lto = true + + +[profile.release-with-logs] +inherits = "release" +debug-assertions = true diff --git a/FULL_HELP_DOCS.md b/FULL_HELP_DOCS.md deleted file mode 100644 index ee140f8..0000000 --- a/FULL_HELP_DOCS.md +++ /dev/null @@ -1,2623 +0,0 @@ -# Stellar CLI Manual - -This document contains the help content for the `stellar` command-line program. - -## `stellar` - -Work seamlessly with Stellar accounts, contracts, and assets from the command line. - -- Generate and manage keys and accounts -- Build, deploy, and interact with contracts -- Deploy asset contracts -- Stream events -- Start local testnets -- Decode, encode XDR -- More! - -For additional information see: - -- Stellar Docs: https://developers.stellar.org -- Smart Contract Docs: https://developers.stellar.org/docs/build/smart-contracts/overview -- CLI Docs: https://developers.stellar.org/docs/tools/developer-tools/cli/stellar-cli - -To get started generate a new identity: - - stellar keys generate alice - -Use keys with the `--source` flag in other commands. - -Commands that work with contracts are organized under the `contract` subcommand. List them: - - stellar contract --help - -Use contracts like a CLI: - - stellar contract invoke --id CCR6QKTWZQYW6YUJ7UP7XXZRLWQPFRV6SWBLQS4ZQOSAF4BOUD77OTE2 --source alice --network testnet -- --help - -Anything after the `--` double dash (the "slop") is parsed as arguments to the contract-specific CLI, generated on-the-fly from the contract schema. For the hello world example, with a function called `hello` that takes one string argument `to`, here's how you invoke it: - - stellar contract invoke --id CCR6QKTWZQYW6YUJ7UP7XXZRLWQPFRV6SWBLQS4ZQOSAF4BOUD77OTE2 --source alice --network testnet -- hello --to world - - -**Usage:** `stellar [OPTIONS] ` - -###### **Subcommands:** - -* `contract` — Tools for smart contract developers -* `events` — Watch the network for contract events -* `env` — Prints the environment variables -* `keys` — Create and manage identities including keys and addresses -* `network` — Configure connection to networks -* `container` — Start local networks in containers -* `snapshot` — Download a snapshot of a ledger from an archive -* `tx` — Sign, Simulate, and Send transactions -* `xdr` — Decode and encode XDR -* `completion` — Print shell completion code for the specified shell -* `cache` — Cache for transactions and contract specs -* `version` — Print version information - -###### **Options:** - -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." -* `-f`, `--filter-logs ` — Filter logs output. To turn on `stellar_cli::log::footprint=debug` or off `=off`. Can also use env var `RUST_LOG` -* `-q`, `--quiet` — Do not write logs to stderr including `INFO` -* `-v`, `--verbose` — Log DEBUG events -* `--very-verbose` — Log DEBUG and TRACE events -* `--list` — List installed plugins. E.g. `stellar-hello` -* `--no-cache` — Do not cache your simulations and transactions - - - -## `stellar contract` - -Tools for smart contract developers - -**Usage:** `stellar contract ` - -###### **Subcommands:** - -* `asset` — Utilities to deploy a Stellar Asset Contract or get its id -* `alias` — Utilities to manage contract aliases -* `bindings` — Generate code client bindings for a contract -* `build` — Build a contract from source -* `extend` — Extend the time to live ledger of a contract-data ledger entry -* `deploy` — Deploy a wasm contract -* `fetch` — Fetch a contract's Wasm binary -* `id` — Generate the contract id for a given contract or asset -* `info` — Access info about contracts -* `init` — Initialize a Soroban contract project -* `inspect` — (Deprecated in favor of `contract info` subcommand) Inspect a WASM file listing contract functions, meta, etc -* `upload` — Install a WASM file to the ledger without creating a contract instance -* `install` — (Deprecated in favor of `contract upload` subcommand) Install a WASM file to the ledger without creating a contract instance -* `invoke` — Invoke a contract function -* `optimize` — Optimize a WASM file -* `read` — Print the current value of a contract-data ledger entry -* `restore` — Restore an evicted value for a contract-data legder entry - - - -## `stellar contract asset` - -Utilities to deploy a Stellar Asset Contract or get its id - -**Usage:** `stellar contract asset ` - -###### **Subcommands:** - -* `id` — Get Id of builtin Soroban Asset Contract. Deprecated, use `stellar contract id asset` instead -* `deploy` — Deploy builtin Soroban Asset Contract - - - -## `stellar contract asset id` - -Get Id of builtin Soroban Asset Contract. Deprecated, use `stellar contract id asset` instead - -**Usage:** `stellar contract asset id [OPTIONS] --asset ` - -###### **Options:** - -* `--asset ` — ID of the Stellar classic asset to wrap, e.g. "USDC:G...5" -* `--rpc-url ` — RPC server endpoint -* `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `-n`, `--network ` — Name of network to use from config -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." - - - -## `stellar contract asset deploy` - -Deploy builtin Soroban Asset Contract - -**Usage:** `stellar contract asset deploy [OPTIONS] --asset --source-account ` - -###### **Options:** - -* `--asset ` — ID of the Stellar classic asset to wrap, e.g. "USDC:G...5" -* `--rpc-url ` — RPC server endpoint -* `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `-n`, `--network ` — Name of network to use from config -* `-s`, `--source-account ` — Account that where transaction originates from. Alias `source`. Can be an identity (--source alice), a public key (--source GDKW...), a muxed account (--source MDA…), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). If `--build-only` or `--sim-only` flags were NOT provided, this key will also be used to sign the final transaction. In that case, trying to sign with public key will fail -* `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." -* `--fee ` — fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlm - - Default value: `100` -* `--cost` — Output the cost execution to stderr -* `--instructions ` — Number of instructions to simulate -* `--build-only` — Build the transaction and only write the base64 xdr to stdout -* `--sim-only` — (Deprecated) simulate the transaction and only write the base64 xdr to stdout -* `--alias ` — The alias that will be used to save the assets's id. Whenever used, `--alias` will always overwrite the existing contract id configuration without asking for confirmation - - - -## `stellar contract alias` - -Utilities to manage contract aliases - -**Usage:** `stellar contract alias ` - -###### **Subcommands:** - -* `remove` — Remove contract alias -* `add` — Add contract alias -* `show` — Show the contract id associated with a given alias -* `ls` — List all aliases - - - -## `stellar contract alias remove` - -Remove contract alias - -**Usage:** `stellar contract alias remove [OPTIONS] ` - -###### **Arguments:** - -* `` — The contract alias that will be removed - -###### **Options:** - -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." -* `--rpc-url ` — RPC server endpoint -* `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `-n`, `--network ` — Name of network to use from config - - - -## `stellar contract alias add` - -Add contract alias - -**Usage:** `stellar contract alias add [OPTIONS] --id ` - -###### **Arguments:** - -* `` — The contract alias that will be used - -###### **Options:** - -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." -* `--rpc-url ` — RPC server endpoint -* `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `-n`, `--network ` — Name of network to use from config -* `--overwrite` — Overwrite the contract alias if it already exists -* `--id ` — The contract id that will be associated with the alias - - - -## `stellar contract alias show` - -Show the contract id associated with a given alias - -**Usage:** `stellar contract alias show [OPTIONS] ` - -###### **Arguments:** - -* `` — The contract alias that will be displayed - -###### **Options:** - -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." -* `--rpc-url ` — RPC server endpoint -* `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `-n`, `--network ` — Name of network to use from config - - - -## `stellar contract alias ls` - -List all aliases - -**Usage:** `stellar contract alias ls [OPTIONS]` - -###### **Options:** - -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." - - - -## `stellar contract bindings` - -Generate code client bindings for a contract - -**Usage:** `stellar contract bindings ` - -###### **Subcommands:** - -* `json` — Generate Json Bindings -* `rust` — Generate Rust bindings -* `typescript` — Generate a TypeScript / JavaScript package -* `python` — Generate Python bindings -* `java` — Generate Java bindings - - - -## `stellar contract bindings json` - -Generate Json Bindings - -**Usage:** `stellar contract bindings json --wasm ` - -###### **Options:** - -* `--wasm ` — Path to wasm binary - - - -## `stellar contract bindings rust` - -Generate Rust bindings - -**Usage:** `stellar contract bindings rust --wasm ` - -###### **Options:** - -* `--wasm ` — Path to wasm binary - - - -## `stellar contract bindings typescript` - -Generate a TypeScript / JavaScript package - -**Usage:** `stellar contract bindings typescript [OPTIONS] --output-dir <--wasm |--wasm-hash |--contract-id >` - -###### **Options:** - -* `--wasm ` — Wasm file path on local filesystem. Provide this OR `--wasm-hash` OR `--contract-id` -* `--wasm-hash ` — Hash of Wasm blob on a network. Provide this OR `--wasm` OR `--contract-id` -* `--contract-id ` — Contract ID/alias on a network. Provide this OR `--wasm-hash` OR `--wasm` -* `--rpc-url ` — RPC server endpoint -* `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `-n`, `--network ` — Name of network to use from config -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." -* `--output-dir ` — Where to place generated project -* `--overwrite` — Whether to overwrite output directory if it already exists - - - -## `stellar contract bindings python` - -Generate Python bindings - -**Usage:** `stellar contract bindings python` - - - -## `stellar contract bindings java` - -Generate Java bindings - -**Usage:** `stellar contract bindings java` - - - -## `stellar contract build` - -Build a contract from source - -Builds all crates that are referenced by the cargo manifest (Cargo.toml) that have cdylib as their crate-type. Crates are built for the wasm32 target. Unless configured otherwise, crates are built with their default features and with their release profile. - -In workspaces builds all crates unless a package name is specified, or the command is executed from the sub-directory of a workspace crate. - -To view the commands that will be executed, without executing them, use the --print-commands-only option. - -**Usage:** `stellar contract build [OPTIONS]` - -###### **Options:** - -* `--manifest-path ` — Path to Cargo.toml -* `--package ` — Package to build - - If omitted, all packages that build for crate-type cdylib are built. -* `--profile ` — Build with the specified profile - - Default value: `release` -* `--features ` — Build with the list of features activated, space or comma separated -* `--all-features` — Build with the all features activated -* `--no-default-features` — Build with the default feature not activated -* `--out-dir ` — Directory to copy wasm files to - - If provided, wasm files can be found in the cargo target directory, and the specified directory. - - If ommitted, wasm files are written only to the cargo target directory. -* `--print-commands-only` — Print commands to build without executing them -* `--meta ` — Add key-value to contract meta (adds the meta to the `contractmetav0` custom section) - - - -## `stellar contract extend` - -Extend the time to live ledger of a contract-data ledger entry. - -If no keys are specified the contract itself is extended. - -**Usage:** `stellar contract extend [OPTIONS] --ledgers-to-extend --source-account ` - -###### **Options:** - -* `--ledgers-to-extend ` — Number of ledgers to extend the entries -* `--ttl-ledger-only` — Only print the new Time To Live ledger -* `--id ` — Contract ID to which owns the data entries. If no keys provided the Contract's instance will be extended -* `--key ` — Storage key (symbols only) -* `--key-xdr ` — Storage key (base64-encoded XDR) -* `--wasm ` — Path to Wasm file of contract code to extend -* `--wasm-hash ` — Path to Wasm file of contract code to extend -* `--durability ` — Storage entry durability - - Default value: `persistent` - - Possible values: - - `persistent`: - Persistent - - `temporary`: - Temporary - -* `--rpc-url ` — RPC server endpoint -* `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `-n`, `--network ` — Name of network to use from config -* `-s`, `--source-account ` — Account that where transaction originates from. Alias `source`. Can be an identity (--source alice), a public key (--source GDKW...), a muxed account (--source MDA…), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). If `--build-only` or `--sim-only` flags were NOT provided, this key will also be used to sign the final transaction. In that case, trying to sign with public key will fail -* `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." -* `--fee ` — fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlm - - Default value: `100` -* `--cost` — Output the cost execution to stderr -* `--instructions ` — Number of instructions to simulate -* `--build-only` — Build the transaction and only write the base64 xdr to stdout -* `--sim-only` — (Deprecated) simulate the transaction and only write the base64 xdr to stdout - - - -## `stellar contract deploy` - -Deploy a wasm contract - -**Usage:** `stellar contract deploy [OPTIONS] --source-account <--wasm |--wasm-hash > [-- ...]` - -###### **Arguments:** - -* `` — If provided, will be passed to the contract's `__constructor` function with provided arguments for that function as `--arg-name value` - -###### **Options:** - -* `--wasm ` — WASM file to deploy -* `--wasm-hash ` — Hash of the already installed/deployed WASM file -* `--salt ` — Custom salt 32-byte salt for the token id -* `--rpc-url ` — RPC server endpoint -* `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `-n`, `--network ` — Name of network to use from config -* `-s`, `--source-account ` — Account that where transaction originates from. Alias `source`. Can be an identity (--source alice), a public key (--source GDKW...), a muxed account (--source MDA…), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). If `--build-only` or `--sim-only` flags were NOT provided, this key will also be used to sign the final transaction. In that case, trying to sign with public key will fail -* `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." -* `--fee ` — fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlm - - Default value: `100` -* `--cost` — Output the cost execution to stderr -* `--instructions ` — Number of instructions to simulate -* `--build-only` — Build the transaction and only write the base64 xdr to stdout -* `--sim-only` — (Deprecated) simulate the transaction and only write the base64 xdr to stdout -* `-i`, `--ignore-checks` — Whether to ignore safety checks when deploying contracts - - Default value: `false` -* `--alias ` — The alias that will be used to save the contract's id. Whenever used, `--alias` will always overwrite the existing contract id configuration without asking for confirmation - - - -## `stellar contract fetch` - -Fetch a contract's Wasm binary - -**Usage:** `stellar contract fetch [OPTIONS] --id ` - -###### **Options:** - -* `--id ` — Contract ID to fetch -* `-o`, `--out-file ` — Where to write output otherwise stdout is used -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." -* `--rpc-url ` — RPC server endpoint -* `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `-n`, `--network ` — Name of network to use from config - - - -## `stellar contract id` - -Generate the contract id for a given contract or asset - -**Usage:** `stellar contract id ` - -###### **Subcommands:** - -* `asset` — Deploy builtin Soroban Asset Contract -* `wasm` — Deploy normal Wasm Contract - - - -## `stellar contract id asset` - -Deploy builtin Soroban Asset Contract - -**Usage:** `stellar contract id asset [OPTIONS] --asset ` - -###### **Options:** - -* `--asset ` — ID of the Stellar classic asset to wrap, e.g. "USDC:G...5" -* `--rpc-url ` — RPC server endpoint -* `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `-n`, `--network ` — Name of network to use from config -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." - - - -## `stellar contract id wasm` - -Deploy normal Wasm Contract - -**Usage:** `stellar contract id wasm [OPTIONS] --salt --source-account ` - -###### **Options:** - -* `--salt ` — ID of the Soroban contract -* `--rpc-url ` — RPC server endpoint -* `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `-n`, `--network ` — Name of network to use from config -* `-s`, `--source-account ` — Account that where transaction originates from. Alias `source`. Can be an identity (--source alice), a public key (--source GDKW...), a muxed account (--source MDA…), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). If `--build-only` or `--sim-only` flags were NOT provided, this key will also be used to sign the final transaction. In that case, trying to sign with public key will fail -* `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." - - - -## `stellar contract info` - -Access info about contracts - -**Usage:** `stellar contract info ` - -###### **Subcommands:** - -* `interface` — Output the interface of a contract -* `meta` — Output the metadata stored in a contract -* `env-meta` — Output the env required metadata stored in a contract -* `build` — Output the contract build information, if available - - - -## `stellar contract info interface` - -Output the interface of a contract. - -A contract's interface describes the functions, parameters, and types that the contract makes accessible to be called. - -The data outputted by this command is a stream of `SCSpecEntry` XDR values. See the type definitions in [stellar-xdr](https://github.com/stellar/stellar-xdr). [See also XDR data format](https://developers.stellar.org/docs/learn/encyclopedia/data-format/xdr). - -Outputs no data when no data is present in the contract. - -**Usage:** `stellar contract info interface [OPTIONS] <--wasm |--wasm-hash |--contract-id >` - -###### **Options:** - -* `--wasm ` — Wasm file path on local filesystem. Provide this OR `--wasm-hash` OR `--contract-id` -* `--wasm-hash ` — Hash of Wasm blob on a network. Provide this OR `--wasm` OR `--contract-id` -* `--contract-id ` — Contract ID/alias on a network. Provide this OR `--wasm-hash` OR `--wasm` -* `--rpc-url ` — RPC server endpoint -* `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `-n`, `--network ` — Name of network to use from config -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." -* `--output ` — Format of the output - - Default value: `rust` - - Possible values: - - `rust`: - Rust code output of the contract interface - - `xdr-base64`: - XDR output of the info entry - - `json`: - JSON output of the info entry (one line, not formatted) - - `json-formatted`: - Formatted (multiline) JSON output of the info entry - - - - -## `stellar contract info meta` - -Output the metadata stored in a contract. - -A contract's meta is a series of key-value pairs that the contract developer can set with any values to provided metadata about the contract. The meta also contains some information like the version of Rust SDK, and Rust compiler version. - -The data outputted by this command is a stream of `SCMetaEntry` XDR values. See the type definitions in [stellar-xdr](https://github.com/stellar/stellar-xdr). [See also XDR data format](https://developers.stellar.org/docs/learn/encyclopedia/data-format/xdr). - -Outputs no data when no data is present in the contract. - -**Usage:** `stellar contract info meta [OPTIONS] <--wasm |--wasm-hash |--contract-id >` - -###### **Options:** - -* `--wasm ` — Wasm file path on local filesystem. Provide this OR `--wasm-hash` OR `--contract-id` -* `--wasm-hash ` — Hash of Wasm blob on a network. Provide this OR `--wasm` OR `--contract-id` -* `--contract-id ` — Contract ID/alias on a network. Provide this OR `--wasm-hash` OR `--wasm` -* `--rpc-url ` — RPC server endpoint -* `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `-n`, `--network ` — Name of network to use from config -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." -* `--output ` — Format of the output - - Default value: `text` - - Possible values: - - `text`: - Text output of the meta info entry - - `xdr-base64`: - XDR output of the info entry - - `json`: - JSON output of the info entry (one line, not formatted) - - `json-formatted`: - Formatted (multiline) JSON output of the info entry - - - - -## `stellar contract info env-meta` - -Output the env required metadata stored in a contract. - -Env-meta is information stored in all contracts, in the `contractenvmetav0` WASM custom section, about the environment that the contract was built for. Env-meta allows the Soroban Env to know whether the contract is compatibility with the network in its current configuration. - -The data outputted by this command is a stream of `SCEnvMetaEntry` XDR values. See the type definitions in [stellar-xdr](https://github.com/stellar/stellar-xdr). [See also XDR data format](https://developers.stellar.org/docs/learn/encyclopedia/data-format/xdr). - -Outputs no data when no data is present in the contract. - -**Usage:** `stellar contract info env-meta [OPTIONS] <--wasm |--wasm-hash |--contract-id >` - -###### **Options:** - -* `--wasm ` — Wasm file path on local filesystem. Provide this OR `--wasm-hash` OR `--contract-id` -* `--wasm-hash ` — Hash of Wasm blob on a network. Provide this OR `--wasm` OR `--contract-id` -* `--contract-id ` — Contract ID/alias on a network. Provide this OR `--wasm-hash` OR `--wasm` -* `--rpc-url ` — RPC server endpoint -* `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `-n`, `--network ` — Name of network to use from config -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." -* `--output ` — Format of the output - - Default value: `text` - - Possible values: - - `text`: - Text output of the meta info entry - - `xdr-base64`: - XDR output of the info entry - - `json`: - JSON output of the info entry (one line, not formatted) - - `json-formatted`: - Formatted (multiline) JSON output of the info entry - - - - -## `stellar contract info build` - -Output the contract build information, if available. - -If the contract has a meta entry like `source_repo=github:user/repo`, this command will try to fetch the attestation information for the WASM file. - -**Usage:** `stellar contract info build [OPTIONS] <--wasm |--wasm-hash |--contract-id >` - -###### **Options:** - -* `--wasm ` — Wasm file path on local filesystem. Provide this OR `--wasm-hash` OR `--contract-id` -* `--wasm-hash ` — Hash of Wasm blob on a network. Provide this OR `--wasm` OR `--contract-id` -* `--contract-id ` — Contract ID/alias on a network. Provide this OR `--wasm-hash` OR `--wasm` -* `--rpc-url ` — RPC server endpoint -* `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `-n`, `--network ` — Name of network to use from config -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." - - - -## `stellar contract init` - -Initialize a Soroban contract project. - -This command will create a Cargo workspace project and add a sample Stellar contract. The name of the contract can be specified by `--name`. It can be run multiple times with different names in order to generate multiple contracts, and files won't be overwritten unless `--overwrite` is passed. - -**Usage:** `stellar contract init [OPTIONS] ` - -###### **Arguments:** - -* `` - -###### **Options:** - -* `--name ` — An optional flag to specify a new contract's name. - - Default value: `hello-world` -* `--overwrite` — Overwrite all existing files. - - - -## `stellar contract inspect` - -(Deprecated in favor of `contract info` subcommand) Inspect a WASM file listing contract functions, meta, etc - -**Usage:** `stellar contract inspect [OPTIONS] --wasm ` - -###### **Options:** - -* `--wasm ` — Path to wasm binary -* `--output ` — Output just XDR in base64 - - Default value: `docs` - - Possible values: - - `xdr-base64`: - XDR of array of contract spec entries - - `xdr-base64-array`: - Array of xdr of contract spec entries - - `docs`: - Pretty print of contract spec entries - -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." - - - -## `stellar contract upload` - -Install a WASM file to the ledger without creating a contract instance - -**Usage:** `stellar contract upload [OPTIONS] --source-account --wasm ` - -###### **Options:** - -* `--rpc-url ` — RPC server endpoint -* `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `-n`, `--network ` — Name of network to use from config -* `-s`, `--source-account ` — Account that where transaction originates from. Alias `source`. Can be an identity (--source alice), a public key (--source GDKW...), a muxed account (--source MDA…), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). If `--build-only` or `--sim-only` flags were NOT provided, this key will also be used to sign the final transaction. In that case, trying to sign with public key will fail -* `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." -* `--fee ` — fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlm - - Default value: `100` -* `--cost` — Output the cost execution to stderr -* `--instructions ` — Number of instructions to simulate -* `--build-only` — Build the transaction and only write the base64 xdr to stdout -* `--sim-only` — (Deprecated) simulate the transaction and only write the base64 xdr to stdout -* `--wasm ` — Path to wasm binary -* `-i`, `--ignore-checks` — Whether to ignore safety checks when deploying contracts - - Default value: `false` - - - -## `stellar contract install` - -(Deprecated in favor of `contract upload` subcommand) Install a WASM file to the ledger without creating a contract instance - -**Usage:** `stellar contract install [OPTIONS] --source-account --wasm ` - -###### **Options:** - -* `--rpc-url ` — RPC server endpoint -* `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `-n`, `--network ` — Name of network to use from config -* `-s`, `--source-account ` — Account that where transaction originates from. Alias `source`. Can be an identity (--source alice), a public key (--source GDKW...), a muxed account (--source MDA…), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). If `--build-only` or `--sim-only` flags were NOT provided, this key will also be used to sign the final transaction. In that case, trying to sign with public key will fail -* `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." -* `--fee ` — fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlm - - Default value: `100` -* `--cost` — Output the cost execution to stderr -* `--instructions ` — Number of instructions to simulate -* `--build-only` — Build the transaction and only write the base64 xdr to stdout -* `--sim-only` — (Deprecated) simulate the transaction and only write the base64 xdr to stdout -* `--wasm ` — Path to wasm binary -* `-i`, `--ignore-checks` — Whether to ignore safety checks when deploying contracts - - Default value: `false` - - - -## `stellar contract invoke` - -Invoke a contract function - -Generates an "implicit CLI" for the specified contract on-the-fly using the contract's schema, which gets embedded into every Soroban contract. The "slop" in this command, everything after the `--`, gets passed to this implicit CLI. Get in-depth help for a given contract: - -stellar contract invoke ... -- --help - -**Usage:** `stellar contract invoke [OPTIONS] --id --source-account [-- ...]` - -###### **Arguments:** - -* `` — Function name as subcommand, then arguments for that function as `--arg-name value` - -###### **Options:** - -* `--id ` — Contract ID to invoke -* `--is-view` — View the result simulating and do not sign and submit transaction. Deprecated use `--send=no` -* `--rpc-url ` — RPC server endpoint -* `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `-n`, `--network ` — Name of network to use from config -* `-s`, `--source-account ` — Account that where transaction originates from. Alias `source`. Can be an identity (--source alice), a public key (--source GDKW...), a muxed account (--source MDA…), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). If `--build-only` or `--sim-only` flags were NOT provided, this key will also be used to sign the final transaction. In that case, trying to sign with public key will fail -* `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." -* `--fee ` — fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlm - - Default value: `100` -* `--cost` — Output the cost execution to stderr -* `--instructions ` — Number of instructions to simulate -* `--build-only` — Build the transaction and only write the base64 xdr to stdout -* `--sim-only` — (Deprecated) simulate the transaction and only write the base64 xdr to stdout -* `--send ` — Whether or not to send a transaction - - Default value: `default` - - Possible values: - - `default`: - Send transaction if simulation indicates there are ledger writes, published events, or auth required, otherwise return simulation result - - `no`: - Do not send transaction, return simulation result - - `yes`: - Always send transaction - - - - -## `stellar contract optimize` - -Optimize a WASM file - -**Usage:** `stellar contract optimize [OPTIONS] --wasm ` - -###### **Options:** - -* `--wasm ` — Path to wasm binary -* `--wasm-out ` — Path to write the optimized WASM file to (defaults to same location as --wasm with .optimized.wasm suffix) - - - -## `stellar contract read` - -Print the current value of a contract-data ledger entry - -**Usage:** `stellar contract read [OPTIONS]` - -###### **Options:** - -* `--output ` — Type of output to generate - - Default value: `string` - - Possible values: - - `string`: - String - - `json`: - Json - - `xdr`: - XDR - -* `--id ` — Contract ID to which owns the data entries. If no keys provided the Contract's instance will be extended -* `--key ` — Storage key (symbols only) -* `--key-xdr ` — Storage key (base64-encoded XDR) -* `--wasm ` — Path to Wasm file of contract code to extend -* `--wasm-hash ` — Path to Wasm file of contract code to extend -* `--durability ` — Storage entry durability - - Default value: `persistent` - - Possible values: - - `persistent`: - Persistent - - `temporary`: - Temporary - -* `--rpc-url ` — RPC server endpoint -* `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `-n`, `--network ` — Name of network to use from config -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." - - - -## `stellar contract restore` - -Restore an evicted value for a contract-data legder entry. - -If no keys are specificed the contract itself is restored. - -**Usage:** `stellar contract restore [OPTIONS] --source-account ` - -###### **Options:** - -* `--id ` — Contract ID to which owns the data entries. If no keys provided the Contract's instance will be extended -* `--key ` — Storage key (symbols only) -* `--key-xdr ` — Storage key (base64-encoded XDR) -* `--wasm ` — Path to Wasm file of contract code to extend -* `--wasm-hash ` — Path to Wasm file of contract code to extend -* `--durability ` — Storage entry durability - - Default value: `persistent` - - Possible values: - - `persistent`: - Persistent - - `temporary`: - Temporary - -* `--ledgers-to-extend ` — Number of ledgers to extend the entry -* `--ttl-ledger-only` — Only print the new Time To Live ledger -* `--rpc-url ` — RPC server endpoint -* `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `-n`, `--network ` — Name of network to use from config -* `-s`, `--source-account ` — Account that where transaction originates from. Alias `source`. Can be an identity (--source alice), a public key (--source GDKW...), a muxed account (--source MDA…), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). If `--build-only` or `--sim-only` flags were NOT provided, this key will also be used to sign the final transaction. In that case, trying to sign with public key will fail -* `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." -* `--fee ` — fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlm - - Default value: `100` -* `--cost` — Output the cost execution to stderr -* `--instructions ` — Number of instructions to simulate -* `--build-only` — Build the transaction and only write the base64 xdr to stdout -* `--sim-only` — (Deprecated) simulate the transaction and only write the base64 xdr to stdout - - - -## `stellar events` - -Watch the network for contract events - -**Usage:** `stellar events [OPTIONS]` - -###### **Options:** - -* `--start-ledger ` — The first ledger sequence number in the range to pull events https://developers.stellar.org/docs/learn/encyclopedia/network-configuration/ledger-headers#ledger-sequence -* `--cursor ` — The cursor corresponding to the start of the event range -* `--output ` — Output formatting options for event stream - - Default value: `pretty` - - Possible values: - - `pretty`: - Colorful, human-oriented console output - - `plain`: - Human-oriented console output without colors - - `json`: - JSON formatted console output - -* `-c`, `--count ` — The maximum number of events to display (defer to the server-defined limit) - - Default value: `10` -* `--id ` — A set of (up to 5) contract IDs to filter events on. This parameter can be passed multiple times, e.g. `--id C123.. --id C456..`, or passed with multiple parameters, e.g. `--id C123 C456`. - - Though the specification supports multiple filter objects (i.e. combinations of type, IDs, and topics), only one set can be specified on the command-line today, though that set can have multiple IDs/topics. -* `--topic ` — A set of (up to 4) topic filters to filter event topics on. A single topic filter can contain 1-4 different segment filters, separated by commas, with an asterisk (`*` character) indicating a wildcard segment. - - **Example:** topic filter with two segments: `--topic "AAAABQAAAAdDT1VOVEVSAA==,*"` - - **Example:** two topic filters with one and two segments each: `--topic "AAAABQAAAAdDT1VOVEVSAA==" --topic '*,*'` - - Note that all of these topic filters are combined with the contract IDs into a single filter (i.e. combination of type, IDs, and topics). -* `--type ` — Specifies which type of contract events to display - - Default value: `all` - - Possible values: `all`, `contract`, `system` - -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." -* `--rpc-url ` — RPC server endpoint -* `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `-n`, `--network ` — Name of network to use from config - - - -## `stellar env` - -Prints the environment variables - -Prints to stdout in a format that can be used as .env file. Environment variables have precedence over defaults. - -Pass a name to get the value of a single environment variable. - -If there are no environment variables in use, prints the defaults. - -**Usage:** `stellar env [OPTIONS] [NAME]` - -###### **Arguments:** - -* `` — Env variable name to get the value of. - - E.g.: $ stellar env STELLAR_ACCOUNT - -###### **Options:** - -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." - - - -## `stellar keys` - -Create and manage identities including keys and addresses - -**Usage:** `stellar keys ` - -###### **Subcommands:** - -* `add` — Add a new identity (keypair, ledger, OS specific secure store) -* `public-key` — Given an identity return its address (public key) -* `fund` — Fund an identity on a test network -* `generate` — Generate a new identity using a 24-word seed phrase The seed phrase can be stored in a config file (default) or in an OS-specific secure store -* `ls` — List identities -* `rm` — Remove an identity -* `secret` — Output an identity's secret key -* `use` — Set the default identity that will be used on all commands. This allows you to skip `--source-account` or setting a environment variable, while reusing this value in all commands that require it - - - -## `stellar keys add` - -Add a new identity (keypair, ledger, OS specific secure store) - -**Usage:** `stellar keys add [OPTIONS] ` - -###### **Arguments:** - -* `` — Name of identity - -###### **Options:** - -* `--secret-key` — (deprecated) Enter secret (S) key when prompted -* `--seed-phrase` — (deprecated) Enter key using 12-24 word seed phrase -* `--secure-store` — Save the new key in secure store. This only supports seed phrases for now -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." -* `--public-key ` — Add a public key, ed25519, or muxed account, e.g. G1.., M2.. - - - -## `stellar keys public-key` - -Given an identity return its address (public key) - -**Usage:** `stellar keys public-key [OPTIONS] ` - -###### **Arguments:** - -* `` — Name of identity to lookup, default test identity used if not provided - -###### **Options:** - -* `--hd-path ` — If identity is a seed phrase use this hd path, default is 0 -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." - - - -## `stellar keys fund` - -Fund an identity on a test network - -**Usage:** `stellar keys fund [OPTIONS] ` - -###### **Arguments:** - -* `` — Name of identity to lookup, default test identity used if not provided - -###### **Options:** - -* `--rpc-url ` — RPC server endpoint -* `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `-n`, `--network ` — Name of network to use from config -* `--hd-path ` — If identity is a seed phrase use this hd path, default is 0 -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." - - - -## `stellar keys generate` - -Generate a new identity using a 24-word seed phrase The seed phrase can be stored in a config file (default) or in an OS-specific secure store - -**Usage:** `stellar keys generate [OPTIONS] ` - -###### **Arguments:** - -* `` — Name of identity - -###### **Options:** - -* `--no-fund` — Do not fund address -* `--seed ` — Optional seed to use when generating seed phrase. Random otherwise -* `-s`, `--as-secret` — Output the generated identity as a secret key -* `--secure-store` — Save in OS-specific secure store -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." -* `--hd-path ` — When generating a secret key, which `hd_path` should be used from the original `seed_phrase` -* `--rpc-url ` — RPC server endpoint -* `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `-n`, `--network ` — Name of network to use from config -* `--fund` — Fund generated key pair - - Default value: `false` -* `--overwrite` — Overwrite existing identity if it already exists - - - -## `stellar keys ls` - -List identities - -**Usage:** `stellar keys ls [OPTIONS]` - -###### **Options:** - -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." -* `-l`, `--long` - - - -## `stellar keys rm` - -Remove an identity - -**Usage:** `stellar keys rm [OPTIONS] ` - -###### **Arguments:** - -* `` — Identity to remove - -###### **Options:** - -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." - - - -## `stellar keys secret` - -Output an identity's secret key - -**Usage:** `stellar keys secret [OPTIONS] ` - -###### **Arguments:** - -* `` — Name of identity to lookup, default is test identity - -###### **Options:** - -* `--phrase` — Output seed phrase instead of private key -* `--hd-path ` — If identity is a seed phrase use this hd path, default is 0 -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." - - - -## `stellar keys use` - -Set the default identity that will be used on all commands. This allows you to skip `--source-account` or setting a environment variable, while reusing this value in all commands that require it - -**Usage:** `stellar keys use [OPTIONS] ` - -###### **Arguments:** - -* `` — Set the default network name - -###### **Options:** - -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." - - - -## `stellar network` - -Configure connection to networks - -**Usage:** `stellar network ` - -###### **Subcommands:** - -* `add` — Add a new network -* `rm` — Remove a network -* `ls` — List networks -* `start` — ⚠️ Deprecated: use `stellar container start` instead -* `stop` — ⚠️ Deprecated: use `stellar container stop` instead -* `use` — Set the default network that will be used on all commands. This allows you to skip `--network` or setting a environment variable, while reusing this value in all commands that require it -* `container` — ⚠️ Deprecated: use `stellar container` instead -* `health` — Checks the health of the configured RPC - - - -## `stellar network add` - -Add a new network - -**Usage:** `stellar network add [OPTIONS] --rpc-url --network-passphrase ` - -###### **Arguments:** - -* `` — Name of network - -###### **Options:** - -* `--rpc-url ` — RPC server endpoint -* `--rpc-header ` — Optional header (e.g. API Key) to include in requests to the RPC -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." - - - -## `stellar network rm` - -Remove a network - -**Usage:** `stellar network rm [OPTIONS] ` - -###### **Arguments:** - -* `` — Network to remove - -###### **Options:** - -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." - - - -## `stellar network ls` - -List networks - -**Usage:** `stellar network ls [OPTIONS]` - -###### **Options:** - -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." -* `-l`, `--long` — Get more info about the networks - - - -## `stellar network start` - -⚠️ Deprecated: use `stellar container start` instead - -Start network - -Start a container running a Stellar node, RPC, API, and friendbot (faucet). - -`stellar network start NETWORK [OPTIONS]` - -By default, when starting a testnet container, without any optional arguments, it will run the equivalent of the following docker command: - -`docker run --rm -p 8000:8000 --name stellar stellar/quickstart:testing --testnet --enable rpc,horizon` - -**Usage:** `stellar network start [OPTIONS] [NETWORK]` - -###### **Arguments:** - -* `` — Network to start. Default is `local` - - Possible values: `local`, `testnet`, `futurenet`, `pubnet` - - -###### **Options:** - -* `-d`, `--docker-host ` — Optional argument to override the default docker host. This is useful when you are using a non-standard docker host path for your Docker-compatible container runtime, e.g. Docker Desktop defaults to $HOME/.docker/run/docker.sock instead of /var/run/docker.sock -* `--name ` — Optional argument to specify the container name -* `-l`, `--limits ` — Optional argument to specify the limits for the local network only -* `-p`, `--ports-mapping ` — Argument to specify the `HOST_PORT:CONTAINER_PORT` mapping - - Default value: `8000:8000` -* `-t`, `--image-tag-override ` — Optional argument to override the default docker image tag for the given network -* `--protocol-version ` — Optional argument to specify the protocol version for the local network only - - - -## `stellar network stop` - -⚠️ Deprecated: use `stellar container stop` instead - -Stop a network started with `network start`. For example, if you ran `stellar network start local`, you can use `stellar network stop local` to stop it. - -**Usage:** `stellar network stop [OPTIONS] [NAME]` - -###### **Arguments:** - -* `` — Container to stop - - Default value: `local` - -###### **Options:** - -* `-d`, `--docker-host ` — Optional argument to override the default docker host. This is useful when you are using a non-standard docker host path for your Docker-compatible container runtime, e.g. Docker Desktop defaults to $HOME/.docker/run/docker.sock instead of /var/run/docker.sock - - - -## `stellar network use` - -Set the default network that will be used on all commands. This allows you to skip `--network` or setting a environment variable, while reusing this value in all commands that require it - -**Usage:** `stellar network use [OPTIONS] ` - -###### **Arguments:** - -* `` — Set the default network name - -###### **Options:** - -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." - - - -## `stellar network container` - -⚠️ Deprecated: use `stellar container` instead - -Commands to start, stop and get logs for a quickstart container - -**Usage:** `stellar network container ` - -###### **Subcommands:** - -* `logs` — Get logs from a running network container -* `start` — Start a container running a Stellar node, RPC, API, and friendbot (faucet) -* `stop` — Stop a network container started with `stellar container start` - - - -## `stellar network container logs` - -Get logs from a running network container - -**Usage:** `stellar network container logs [OPTIONS] [NAME]` - -###### **Arguments:** - -* `` — Container to get logs from - - Default value: `local` - -###### **Options:** - -* `-d`, `--docker-host ` — Optional argument to override the default docker host. This is useful when you are using a non-standard docker host path for your Docker-compatible container runtime, e.g. Docker Desktop defaults to $HOME/.docker/run/docker.sock instead of /var/run/docker.sock - - - -## `stellar network container start` - -Start a container running a Stellar node, RPC, API, and friendbot (faucet). - -`stellar container start NETWORK [OPTIONS]` - -By default, when starting a testnet container, without any optional arguments, it will run the equivalent of the following docker command: - -`docker run --rm -p 8000:8000 --name stellar stellar/quickstart:testing --testnet --enable rpc,horizon` - -**Usage:** `stellar network container start [OPTIONS] [NETWORK]` - -###### **Arguments:** - -* `` — Network to start. Default is `local` - - Possible values: `local`, `testnet`, `futurenet`, `pubnet` - - -###### **Options:** - -* `-d`, `--docker-host ` — Optional argument to override the default docker host. This is useful when you are using a non-standard docker host path for your Docker-compatible container runtime, e.g. Docker Desktop defaults to $HOME/.docker/run/docker.sock instead of /var/run/docker.sock -* `--name ` — Optional argument to specify the container name -* `-l`, `--limits ` — Optional argument to specify the limits for the local network only -* `-p`, `--ports-mapping ` — Argument to specify the `HOST_PORT:CONTAINER_PORT` mapping - - Default value: `8000:8000` -* `-t`, `--image-tag-override ` — Optional argument to override the default docker image tag for the given network -* `--protocol-version ` — Optional argument to specify the protocol version for the local network only - - - -## `stellar network container stop` - -Stop a network container started with `stellar container start` - -**Usage:** `stellar network container stop [OPTIONS] [NAME]` - -###### **Arguments:** - -* `` — Container to stop - - Default value: `local` - -###### **Options:** - -* `-d`, `--docker-host ` — Optional argument to override the default docker host. This is useful when you are using a non-standard docker host path for your Docker-compatible container runtime, e.g. Docker Desktop defaults to $HOME/.docker/run/docker.sock instead of /var/run/docker.sock - - - -## `stellar network health` - -Checks the health of the configured RPC - -**Usage:** `stellar network health [OPTIONS]` - -###### **Options:** - -* `--rpc-url ` — RPC server endpoint -* `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `-n`, `--network ` — Name of network to use from config -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." -* `--output ` — Format of the output - - Default value: `text` - - Possible values: - - `text`: - Text output of network health status - - `json`: - JSON result of the RPC request - - `json-formatted`: - Formatted (multiline) JSON output of the RPC request - - - - -## `stellar container` - -Start local networks in containers - -**Usage:** `stellar container ` - -###### **Subcommands:** - -* `logs` — Get logs from a running network container -* `start` — Start a container running a Stellar node, RPC, API, and friendbot (faucet) -* `stop` — Stop a network container started with `stellar container start` - - - -## `stellar container logs` - -Get logs from a running network container - -**Usage:** `stellar container logs [OPTIONS] [NAME]` - -###### **Arguments:** - -* `` — Container to get logs from - - Default value: `local` - -###### **Options:** - -* `-d`, `--docker-host ` — Optional argument to override the default docker host. This is useful when you are using a non-standard docker host path for your Docker-compatible container runtime, e.g. Docker Desktop defaults to $HOME/.docker/run/docker.sock instead of /var/run/docker.sock - - - -## `stellar container start` - -Start a container running a Stellar node, RPC, API, and friendbot (faucet). - -`stellar container start NETWORK [OPTIONS]` - -By default, when starting a testnet container, without any optional arguments, it will run the equivalent of the following docker command: - -`docker run --rm -p 8000:8000 --name stellar stellar/quickstart:testing --testnet --enable rpc,horizon` - -**Usage:** `stellar container start [OPTIONS] [NETWORK]` - -###### **Arguments:** - -* `` — Network to start. Default is `local` - - Possible values: `local`, `testnet`, `futurenet`, `pubnet` - - -###### **Options:** - -* `-d`, `--docker-host ` — Optional argument to override the default docker host. This is useful when you are using a non-standard docker host path for your Docker-compatible container runtime, e.g. Docker Desktop defaults to $HOME/.docker/run/docker.sock instead of /var/run/docker.sock -* `--name ` — Optional argument to specify the container name -* `-l`, `--limits ` — Optional argument to specify the limits for the local network only -* `-p`, `--ports-mapping ` — Argument to specify the `HOST_PORT:CONTAINER_PORT` mapping - - Default value: `8000:8000` -* `-t`, `--image-tag-override ` — Optional argument to override the default docker image tag for the given network -* `--protocol-version ` — Optional argument to specify the protocol version for the local network only - - - -## `stellar container stop` - -Stop a network container started with `stellar container start` - -**Usage:** `stellar container stop [OPTIONS] [NAME]` - -###### **Arguments:** - -* `` — Container to stop - - Default value: `local` - -###### **Options:** - -* `-d`, `--docker-host ` — Optional argument to override the default docker host. This is useful when you are using a non-standard docker host path for your Docker-compatible container runtime, e.g. Docker Desktop defaults to $HOME/.docker/run/docker.sock instead of /var/run/docker.sock - - - -## `stellar snapshot` - -Download a snapshot of a ledger from an archive - -**Usage:** `stellar snapshot ` - -###### **Subcommands:** - -* `create` — Create a ledger snapshot using a history archive - - - -## `stellar snapshot create` - -Create a ledger snapshot using a history archive. - -Filters (address, wasm-hash) specify what ledger entries to include. - -Account addresses include the account, and trustlines. - -Contract addresses include the related wasm, contract data. - -If a contract is a Stellar asset contract, it includes the asset issuer's account and trust lines, but does not include all the trust lines of other accounts holding the asset. To include them specify the addresses of relevant accounts. - -Any invalid contract id passed as `--address` will be ignored. - -**Usage:** `stellar snapshot create [OPTIONS] --output ` - -###### **Options:** - -* `--ledger ` — The ledger sequence number to snapshot. Defaults to latest history archived ledger -* `--address
` — Account or contract address/alias to include in the snapshot -* `--wasm-hash ` — WASM hashes to include in the snapshot -* `--output ` — Format of the out file - - Possible values: `json` - -* `--out ` — Out path that the snapshot is written to - - Default value: `snapshot.json` -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." -* `--rpc-url ` — RPC server endpoint -* `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `-n`, `--network ` — Name of network to use from config -* `--archive-url ` — Archive URL - - - -## `stellar tx` - -Sign, Simulate, and Send transactions - -**Usage:** `stellar tx ` - -###### **Subcommands:** - -* `edit` — Edit a transaction envelope from stdin. This command respects the environment variables `STELLAR_EDITOR`, `EDITOR` and `VISUAL`, in that order -* `hash` — Calculate the hash of a transaction envelope -* `new` — Create a new transaction -* `operation` — Manipulate the operations in a transaction, including adding new operations -* `send` — Send a transaction envelope to the network -* `sign` — Sign a transaction envelope appending the signature to the envelope -* `simulate` — Simulate a transaction envelope from stdin - - - -## `stellar tx edit` - -Edit a transaction envelope from stdin. This command respects the environment variables `STELLAR_EDITOR`, `EDITOR` and `VISUAL`, in that order. - -Example: Start a new edit session - -$ stellar tx edit - -Example: Pipe an XDR transaction envelope - -$ stellar tx new manage-data --data-name hello --build-only | stellar tx edit - -**Usage:** `stellar tx edit` - - - -## `stellar tx hash` - -Calculate the hash of a transaction envelope - -**Usage:** `stellar tx hash [OPTIONS] [TX_XDR]` - -###### **Arguments:** - -* `` — Base-64 transaction envelope XDR or file containing XDR to decode, or stdin if empty - -###### **Options:** - -* `--rpc-url ` — RPC server endpoint -* `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `-n`, `--network ` — Name of network to use from config - - - -## `stellar tx new` - -Create a new transaction - -**Usage:** `stellar tx new ` - -###### **Subcommands:** - -* `account-merge` — Transfers the XLM balance of an account to another account and removes the source account from the ledger -* `bump-sequence` — Bumps forward the sequence number of the source account to the given sequence number, invalidating any transaction with a smaller sequence number -* `change-trust` — Creates, updates, or deletes a trustline -Learn more about trustlines -https://developers.stellar.org/docs/learn/fundamentals/stellar-data-structures/accounts#trustlines -* `create-account` — Creates and funds a new account with the specified starting balance -* `manage-data` — Sets, modifies, or deletes a data entry (name/value pair) that is attached to an account -Learn more about entries and subentries: -https://developers.stellar.org/docs/learn/fundamentals/stellar-data-structures/accounts#subentries -* `payment` — Sends an amount in a specific asset to a destination account -* `set-options` — Set option for an account such as flags, inflation destination, signers, home domain, and master key weight -Learn more about flags: -https://developers.stellar.org/docs/learn/glossary#flags -Learn more about the home domain: -https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0001.md -Learn more about signers operations and key weight: -https://developers.stellar.org/docs/learn/encyclopedia/security/signatures-multisig#multisig -* `set-trustline-flags` — Allows issuing account to configure authorization and trustline flags to an asset -The Asset parameter is of the `TrustLineAsset` type. If you are modifying a trustline to a regular asset (i.e. one in a Code:Issuer format), this is equivalent to the Asset type. -If you are modifying a trustline to a pool share, however, this is composed of the liquidity pool's unique ID. -Learn more about flags: -https://developers.stellar.org/docs/learn/glossary#flags - - - -## `stellar tx new account-merge` - -Transfers the XLM balance of an account to another account and removes the source account from the ledger - -**Usage:** `stellar tx new account-merge [OPTIONS] --source-account --account ` - -###### **Options:** - -* `--fee ` — fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlm - - Default value: `100` -* `--cost` — Output the cost execution to stderr -* `--instructions ` — Number of instructions to simulate -* `--build-only` — Build the transaction and only write the base64 xdr to stdout -* `--sim-only` — (Deprecated) simulate the transaction and only write the base64 xdr to stdout -* `--rpc-url ` — RPC server endpoint -* `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `-n`, `--network ` — Name of network to use from config -* `-s`, `--source-account ` — Account that where transaction originates from. Alias `source`. Can be an identity (--source alice), a public key (--source GDKW...), a muxed account (--source MDA…), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). If `--build-only` or `--sim-only` flags were NOT provided, this key will also be used to sign the final transaction. In that case, trying to sign with public key will fail -* `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." -* `--account ` — Muxed Account to merge with, e.g. `GBX...`, 'MBX...' - - - -## `stellar tx new bump-sequence` - -Bumps forward the sequence number of the source account to the given sequence number, invalidating any transaction with a smaller sequence number - -**Usage:** `stellar tx new bump-sequence [OPTIONS] --source-account --bump-to ` - -###### **Options:** - -* `--fee ` — fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlm - - Default value: `100` -* `--cost` — Output the cost execution to stderr -* `--instructions ` — Number of instructions to simulate -* `--build-only` — Build the transaction and only write the base64 xdr to stdout -* `--sim-only` — (Deprecated) simulate the transaction and only write the base64 xdr to stdout -* `--rpc-url ` — RPC server endpoint -* `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `-n`, `--network ` — Name of network to use from config -* `-s`, `--source-account ` — Account that where transaction originates from. Alias `source`. Can be an identity (--source alice), a public key (--source GDKW...), a muxed account (--source MDA…), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). If `--build-only` or `--sim-only` flags were NOT provided, this key will also be used to sign the final transaction. In that case, trying to sign with public key will fail -* `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." -* `--bump-to ` — Sequence number to bump to - - - -## `stellar tx new change-trust` - -Creates, updates, or deletes a trustline -Learn more about trustlines -https://developers.stellar.org/docs/learn/fundamentals/stellar-data-structures/accounts#trustlines - -**Usage:** `stellar tx new change-trust [OPTIONS] --source-account --line ` - -###### **Options:** - -* `--fee ` — fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlm - - Default value: `100` -* `--cost` — Output the cost execution to stderr -* `--instructions ` — Number of instructions to simulate -* `--build-only` — Build the transaction and only write the base64 xdr to stdout -* `--sim-only` — (Deprecated) simulate the transaction and only write the base64 xdr to stdout -* `--rpc-url ` — RPC server endpoint -* `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `-n`, `--network ` — Name of network to use from config -* `-s`, `--source-account ` — Account that where transaction originates from. Alias `source`. Can be an identity (--source alice), a public key (--source GDKW...), a muxed account (--source MDA…), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). If `--build-only` or `--sim-only` flags were NOT provided, this key will also be used to sign the final transaction. In that case, trying to sign with public key will fail -* `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." -* `--line ` -* `--limit ` — Limit for the trust line, 0 to remove the trust line - - Default value: `9223372036854775807` - - - -## `stellar tx new create-account` - -Creates and funds a new account with the specified starting balance - -**Usage:** `stellar tx new create-account [OPTIONS] --source-account --destination ` - -###### **Options:** - -* `--fee ` — fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlm - - Default value: `100` -* `--cost` — Output the cost execution to stderr -* `--instructions ` — Number of instructions to simulate -* `--build-only` — Build the transaction and only write the base64 xdr to stdout -* `--sim-only` — (Deprecated) simulate the transaction and only write the base64 xdr to stdout -* `--rpc-url ` — RPC server endpoint -* `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `-n`, `--network ` — Name of network to use from config -* `-s`, `--source-account ` — Account that where transaction originates from. Alias `source`. Can be an identity (--source alice), a public key (--source GDKW...), a muxed account (--source MDA…), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). If `--build-only` or `--sim-only` flags were NOT provided, this key will also be used to sign the final transaction. In that case, trying to sign with public key will fail -* `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." -* `--destination ` — Account Id to create, e.g. `GBX...` -* `--starting-balance ` — Initial balance in stroops of the account, default 1 XLM - - Default value: `10_000_000` - - - -## `stellar tx new manage-data` - -Sets, modifies, or deletes a data entry (name/value pair) that is attached to an account -Learn more about entries and subentries: -https://developers.stellar.org/docs/learn/fundamentals/stellar-data-structures/accounts#subentries - -**Usage:** `stellar tx new manage-data [OPTIONS] --source-account --data-name ` - -###### **Options:** - -* `--fee ` — fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlm - - Default value: `100` -* `--cost` — Output the cost execution to stderr -* `--instructions ` — Number of instructions to simulate -* `--build-only` — Build the transaction and only write the base64 xdr to stdout -* `--sim-only` — (Deprecated) simulate the transaction and only write the base64 xdr to stdout -* `--rpc-url ` — RPC server endpoint -* `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `-n`, `--network ` — Name of network to use from config -* `-s`, `--source-account ` — Account that where transaction originates from. Alias `source`. Can be an identity (--source alice), a public key (--source GDKW...), a muxed account (--source MDA…), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). If `--build-only` or `--sim-only` flags were NOT provided, this key will also be used to sign the final transaction. In that case, trying to sign with public key will fail -* `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." -* `--data-name ` — String up to 64 bytes long. If this is a new Name it will add the given name/value pair to the account. If this Name is already present then the associated value will be modified -* `--data-value ` — Up to 64 bytes long hex string If not present then the existing Name will be deleted. If present then this value will be set in the `DataEntry` - - - -## `stellar tx new payment` - -Sends an amount in a specific asset to a destination account - -**Usage:** `stellar tx new payment [OPTIONS] --source-account --destination --amount ` - -###### **Options:** - -* `--fee ` — fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlm - - Default value: `100` -* `--cost` — Output the cost execution to stderr -* `--instructions ` — Number of instructions to simulate -* `--build-only` — Build the transaction and only write the base64 xdr to stdout -* `--sim-only` — (Deprecated) simulate the transaction and only write the base64 xdr to stdout -* `--rpc-url ` — RPC server endpoint -* `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `-n`, `--network ` — Name of network to use from config -* `-s`, `--source-account ` — Account that where transaction originates from. Alias `source`. Can be an identity (--source alice), a public key (--source GDKW...), a muxed account (--source MDA…), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). If `--build-only` or `--sim-only` flags were NOT provided, this key will also be used to sign the final transaction. In that case, trying to sign with public key will fail -* `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." -* `--destination ` — Account to send to, e.g. `GBX...` -* `--asset ` — Asset to send, default native, e.i. XLM - - Default value: `native` -* `--amount ` — Amount of the aforementioned asset to send. e.g. `10_000_000` (1 XLM) - - - -## `stellar tx new set-options` - -Set option for an account such as flags, inflation destination, signers, home domain, and master key weight -Learn more about flags: -https://developers.stellar.org/docs/learn/glossary#flags -Learn more about the home domain: -https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0001.md -Learn more about signers operations and key weight: -https://developers.stellar.org/docs/learn/encyclopedia/security/signatures-multisig#multisig - -**Usage:** `stellar tx new set-options [OPTIONS] --source-account ` - -###### **Options:** - -* `--fee ` — fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlm - - Default value: `100` -* `--cost` — Output the cost execution to stderr -* `--instructions ` — Number of instructions to simulate -* `--build-only` — Build the transaction and only write the base64 xdr to stdout -* `--sim-only` — (Deprecated) simulate the transaction and only write the base64 xdr to stdout -* `--rpc-url ` — RPC server endpoint -* `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `-n`, `--network ` — Name of network to use from config -* `-s`, `--source-account ` — Account that where transaction originates from. Alias `source`. Can be an identity (--source alice), a public key (--source GDKW...), a muxed account (--source MDA…), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). If `--build-only` or `--sim-only` flags were NOT provided, this key will also be used to sign the final transaction. In that case, trying to sign with public key will fail -* `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." -* `--inflation-dest ` — Account of the inflation destination -* `--master-weight ` — A number from 0-255 (inclusive) representing the weight of the master key. If the weight of the master key is updated to 0, it is effectively disabled -* `--low-threshold ` — A number from 0-255 (inclusive) representing the threshold this account sets on all operations it performs that have a low threshold. https://developers.stellar.org/docs/learn/encyclopedia/security/signatures-multisig#multisig -* `--med-threshold ` — A number from 0-255 (inclusive) representing the threshold this account sets on all operations it performs that have a medium threshold. https://developers.stellar.org/docs/learn/encyclopedia/security/signatures-multisig#multisig -* `--high-threshold ` — A number from 0-255 (inclusive) representing the threshold this account sets on all operations it performs that have a high threshold. https://developers.stellar.org/docs/learn/encyclopedia/security/signatures-multisig#multisig -* `--home-domain ` — Sets the home domain of an account. See https://developers.stellar.org/docs/learn/encyclopedia/network-configuration/federation -* `--signer ` — Add, update, or remove a signer from an account -* `--signer-weight ` — Signer weight is a number from 0-255 (inclusive). The signer is deleted if the weight is 0 -* `--set-required` — When enabled, an issuer must approve an account before that account can hold its asset. https://developers.stellar.org/docs/tokens/control-asset-access#authorization-required-0x1 -* `--set-revocable` — When enabled, an issuer can revoke an existing trustline's authorization, thereby freezing the asset held by an account. https://developers.stellar.org/docs/tokens/control-asset-access#authorization-revocable-0x2 -* `--set-clawback-enabled` — Enables the issuing account to take back (burning) all of the asset. https://developers.stellar.org/docs/tokens/control-asset-access#clawback-enabled-0x8 -* `--set-immutable` — With this setting, none of the other authorization flags (`AUTH_REQUIRED_FLAG`, `AUTH_REVOCABLE_FLAG`) can be set, and the issuing account can't be merged. https://developers.stellar.org/docs/tokens/control-asset-access#authorization-immutable-0x4 -* `--clear-required` -* `--clear-revocable` -* `--clear-immutable` -* `--clear-clawback-enabled` - - - -## `stellar tx new set-trustline-flags` - -Allows issuing account to configure authorization and trustline flags to an asset -The Asset parameter is of the `TrustLineAsset` type. If you are modifying a trustline to a regular asset (i.e. one in a Code:Issuer format), this is equivalent to the Asset type. -If you are modifying a trustline to a pool share, however, this is composed of the liquidity pool's unique ID. -Learn more about flags: -https://developers.stellar.org/docs/learn/glossary#flags - -**Usage:** `stellar tx new set-trustline-flags [OPTIONS] --source-account --trustor --asset ` - -###### **Options:** - -* `--fee ` — fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlm - - Default value: `100` -* `--cost` — Output the cost execution to stderr -* `--instructions ` — Number of instructions to simulate -* `--build-only` — Build the transaction and only write the base64 xdr to stdout -* `--sim-only` — (Deprecated) simulate the transaction and only write the base64 xdr to stdout -* `--rpc-url ` — RPC server endpoint -* `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `-n`, `--network ` — Name of network to use from config -* `-s`, `--source-account ` — Account that where transaction originates from. Alias `source`. Can be an identity (--source alice), a public key (--source GDKW...), a muxed account (--source MDA…), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). If `--build-only` or `--sim-only` flags were NOT provided, this key will also be used to sign the final transaction. In that case, trying to sign with public key will fail -* `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." -* `--trustor ` — Account to set trustline flags for, e.g. `GBX...`, or alias, or muxed account, `M123...`` -* `--asset ` — Asset to set trustline flags for -* `--set-authorize` — Signifies complete authorization allowing an account to transact freely with the asset to make and receive payments and place orders -* `--set-authorize-to-maintain-liabilities` — Denotes limited authorization that allows an account to maintain current orders but not to otherwise transact with the asset -* `--set-trustline-clawback-enabled` — Enables the issuing account to take back (burning) all of the asset. See our section on Clawbacks: https://developers.stellar.org/docs/learn/encyclopedia/transactions-specialized/clawbacks -* `--clear-authorize` -* `--clear-authorize-to-maintain-liabilities` -* `--clear-trustline-clawback-enabled` - - - -## `stellar tx operation` - -Manipulate the operations in a transaction, including adding new operations - -**Usage:** `stellar tx operation ` - -###### **Subcommands:** - -* `add` — Add Operation to a transaction - - - -## `stellar tx operation add` - -Add Operation to a transaction - -**Usage:** `stellar tx operation add ` - -###### **Subcommands:** - -* `account-merge` — Transfers the XLM balance of an account to another account and removes the source account from the ledger -* `bump-sequence` — Bumps forward the sequence number of the source account to the given sequence number, invalidating any transaction with a smaller sequence number -* `change-trust` — Creates, updates, or deletes a trustline -Learn more about trustlines -https://developers.stellar.org/docs/learn/fundamentals/stellar-data-structures/accounts#trustlines -* `create-account` — Creates and funds a new account with the specified starting balance -* `manage-data` — Sets, modifies, or deletes a data entry (name/value pair) that is attached to an account -Learn more about entries and subentries: -https://developers.stellar.org/docs/learn/fundamentals/stellar-data-structures/accounts#subentries -* `payment` — Sends an amount in a specific asset to a destination account -* `set-options` — Set option for an account such as flags, inflation destination, signers, home domain, and master key weight -Learn more about flags: -https://developers.stellar.org/docs/learn/glossary#flags -Learn more about the home domain: -https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0001.md -Learn more about signers operations and key weight: -https://developers.stellar.org/docs/learn/encyclopedia/security/signatures-multisig#multisig -* `set-trustline-flags` — Allows issuing account to configure authorization and trustline flags to an asset -The Asset parameter is of the `TrustLineAsset` type. If you are modifying a trustline to a regular asset (i.e. one in a Code:Issuer format), this is equivalent to the Asset type. -If you are modifying a trustline to a pool share, however, this is composed of the liquidity pool's unique ID. -Learn more about flags: -https://developers.stellar.org/docs/learn/glossary#flags - - - -## `stellar tx operation add account-merge` - -Transfers the XLM balance of an account to another account and removes the source account from the ledger - -**Usage:** `stellar tx operation add account-merge [OPTIONS] --source-account --account [TX_XDR]` - -###### **Arguments:** - -* `` — Base-64 transaction envelope XDR or file containing XDR to decode, or stdin if empty - -###### **Options:** - -* `--operation-source-account ` — Source account used for the operation -* `--fee ` — fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlm - - Default value: `100` -* `--cost` — Output the cost execution to stderr -* `--instructions ` — Number of instructions to simulate -* `--build-only` — Build the transaction and only write the base64 xdr to stdout -* `--sim-only` — (Deprecated) simulate the transaction and only write the base64 xdr to stdout -* `--rpc-url ` — RPC server endpoint -* `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `-n`, `--network ` — Name of network to use from config -* `-s`, `--source-account ` — Account that where transaction originates from. Alias `source`. Can be an identity (--source alice), a public key (--source GDKW...), a muxed account (--source MDA…), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). If `--build-only` or `--sim-only` flags were NOT provided, this key will also be used to sign the final transaction. In that case, trying to sign with public key will fail -* `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." -* `--account ` — Muxed Account to merge with, e.g. `GBX...`, 'MBX...' - - - -## `stellar tx operation add bump-sequence` - -Bumps forward the sequence number of the source account to the given sequence number, invalidating any transaction with a smaller sequence number - -**Usage:** `stellar tx operation add bump-sequence [OPTIONS] --source-account --bump-to [TX_XDR]` - -###### **Arguments:** - -* `` — Base-64 transaction envelope XDR or file containing XDR to decode, or stdin if empty - -###### **Options:** - -* `--operation-source-account ` — Source account used for the operation -* `--fee ` — fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlm - - Default value: `100` -* `--cost` — Output the cost execution to stderr -* `--instructions ` — Number of instructions to simulate -* `--build-only` — Build the transaction and only write the base64 xdr to stdout -* `--sim-only` — (Deprecated) simulate the transaction and only write the base64 xdr to stdout -* `--rpc-url ` — RPC server endpoint -* `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `-n`, `--network ` — Name of network to use from config -* `-s`, `--source-account ` — Account that where transaction originates from. Alias `source`. Can be an identity (--source alice), a public key (--source GDKW...), a muxed account (--source MDA…), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). If `--build-only` or `--sim-only` flags were NOT provided, this key will also be used to sign the final transaction. In that case, trying to sign with public key will fail -* `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." -* `--bump-to ` — Sequence number to bump to - - - -## `stellar tx operation add change-trust` - -Creates, updates, or deletes a trustline -Learn more about trustlines -https://developers.stellar.org/docs/learn/fundamentals/stellar-data-structures/accounts#trustlines - -**Usage:** `stellar tx operation add change-trust [OPTIONS] --source-account --line [TX_XDR]` - -###### **Arguments:** - -* `` — Base-64 transaction envelope XDR or file containing XDR to decode, or stdin if empty - -###### **Options:** - -* `--operation-source-account ` — Source account used for the operation -* `--fee ` — fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlm - - Default value: `100` -* `--cost` — Output the cost execution to stderr -* `--instructions ` — Number of instructions to simulate -* `--build-only` — Build the transaction and only write the base64 xdr to stdout -* `--sim-only` — (Deprecated) simulate the transaction and only write the base64 xdr to stdout -* `--rpc-url ` — RPC server endpoint -* `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `-n`, `--network ` — Name of network to use from config -* `-s`, `--source-account ` — Account that where transaction originates from. Alias `source`. Can be an identity (--source alice), a public key (--source GDKW...), a muxed account (--source MDA…), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). If `--build-only` or `--sim-only` flags were NOT provided, this key will also be used to sign the final transaction. In that case, trying to sign with public key will fail -* `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." -* `--line ` -* `--limit ` — Limit for the trust line, 0 to remove the trust line - - Default value: `9223372036854775807` - - - -## `stellar tx operation add create-account` - -Creates and funds a new account with the specified starting balance - -**Usage:** `stellar tx operation add create-account [OPTIONS] --source-account --destination [TX_XDR]` - -###### **Arguments:** - -* `` — Base-64 transaction envelope XDR or file containing XDR to decode, or stdin if empty - -###### **Options:** - -* `--operation-source-account ` — Source account used for the operation -* `--fee ` — fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlm - - Default value: `100` -* `--cost` — Output the cost execution to stderr -* `--instructions ` — Number of instructions to simulate -* `--build-only` — Build the transaction and only write the base64 xdr to stdout -* `--sim-only` — (Deprecated) simulate the transaction and only write the base64 xdr to stdout -* `--rpc-url ` — RPC server endpoint -* `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `-n`, `--network ` — Name of network to use from config -* `-s`, `--source-account ` — Account that where transaction originates from. Alias `source`. Can be an identity (--source alice), a public key (--source GDKW...), a muxed account (--source MDA…), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). If `--build-only` or `--sim-only` flags were NOT provided, this key will also be used to sign the final transaction. In that case, trying to sign with public key will fail -* `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." -* `--destination ` — Account Id to create, e.g. `GBX...` -* `--starting-balance ` — Initial balance in stroops of the account, default 1 XLM - - Default value: `10_000_000` - - - -## `stellar tx operation add manage-data` - -Sets, modifies, or deletes a data entry (name/value pair) that is attached to an account -Learn more about entries and subentries: -https://developers.stellar.org/docs/learn/fundamentals/stellar-data-structures/accounts#subentries - -**Usage:** `stellar tx operation add manage-data [OPTIONS] --source-account --data-name [TX_XDR]` - -###### **Arguments:** - -* `` — Base-64 transaction envelope XDR or file containing XDR to decode, or stdin if empty - -###### **Options:** - -* `--operation-source-account ` — Source account used for the operation -* `--fee ` — fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlm - - Default value: `100` -* `--cost` — Output the cost execution to stderr -* `--instructions ` — Number of instructions to simulate -* `--build-only` — Build the transaction and only write the base64 xdr to stdout -* `--sim-only` — (Deprecated) simulate the transaction and only write the base64 xdr to stdout -* `--rpc-url ` — RPC server endpoint -* `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `-n`, `--network ` — Name of network to use from config -* `-s`, `--source-account ` — Account that where transaction originates from. Alias `source`. Can be an identity (--source alice), a public key (--source GDKW...), a muxed account (--source MDA…), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). If `--build-only` or `--sim-only` flags were NOT provided, this key will also be used to sign the final transaction. In that case, trying to sign with public key will fail -* `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." -* `--data-name ` — String up to 64 bytes long. If this is a new Name it will add the given name/value pair to the account. If this Name is already present then the associated value will be modified -* `--data-value ` — Up to 64 bytes long hex string If not present then the existing Name will be deleted. If present then this value will be set in the `DataEntry` - - - -## `stellar tx operation add payment` - -Sends an amount in a specific asset to a destination account - -**Usage:** `stellar tx operation add payment [OPTIONS] --source-account --destination --amount [TX_XDR]` - -###### **Arguments:** - -* `` — Base-64 transaction envelope XDR or file containing XDR to decode, or stdin if empty - -###### **Options:** - -* `--operation-source-account ` — Source account used for the operation -* `--fee ` — fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlm - - Default value: `100` -* `--cost` — Output the cost execution to stderr -* `--instructions ` — Number of instructions to simulate -* `--build-only` — Build the transaction and only write the base64 xdr to stdout -* `--sim-only` — (Deprecated) simulate the transaction and only write the base64 xdr to stdout -* `--rpc-url ` — RPC server endpoint -* `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `-n`, `--network ` — Name of network to use from config -* `-s`, `--source-account ` — Account that where transaction originates from. Alias `source`. Can be an identity (--source alice), a public key (--source GDKW...), a muxed account (--source MDA…), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). If `--build-only` or `--sim-only` flags were NOT provided, this key will also be used to sign the final transaction. In that case, trying to sign with public key will fail -* `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." -* `--destination ` — Account to send to, e.g. `GBX...` -* `--asset ` — Asset to send, default native, e.i. XLM - - Default value: `native` -* `--amount ` — Amount of the aforementioned asset to send. e.g. `10_000_000` (1 XLM) - - - -## `stellar tx operation add set-options` - -Set option for an account such as flags, inflation destination, signers, home domain, and master key weight -Learn more about flags: -https://developers.stellar.org/docs/learn/glossary#flags -Learn more about the home domain: -https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0001.md -Learn more about signers operations and key weight: -https://developers.stellar.org/docs/learn/encyclopedia/security/signatures-multisig#multisig - -**Usage:** `stellar tx operation add set-options [OPTIONS] --source-account [TX_XDR]` - -###### **Arguments:** - -* `` — Base-64 transaction envelope XDR or file containing XDR to decode, or stdin if empty - -###### **Options:** - -* `--operation-source-account ` — Source account used for the operation -* `--fee ` — fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlm - - Default value: `100` -* `--cost` — Output the cost execution to stderr -* `--instructions ` — Number of instructions to simulate -* `--build-only` — Build the transaction and only write the base64 xdr to stdout -* `--sim-only` — (Deprecated) simulate the transaction and only write the base64 xdr to stdout -* `--rpc-url ` — RPC server endpoint -* `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `-n`, `--network ` — Name of network to use from config -* `-s`, `--source-account ` — Account that where transaction originates from. Alias `source`. Can be an identity (--source alice), a public key (--source GDKW...), a muxed account (--source MDA…), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). If `--build-only` or `--sim-only` flags were NOT provided, this key will also be used to sign the final transaction. In that case, trying to sign with public key will fail -* `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." -* `--inflation-dest ` — Account of the inflation destination -* `--master-weight ` — A number from 0-255 (inclusive) representing the weight of the master key. If the weight of the master key is updated to 0, it is effectively disabled -* `--low-threshold ` — A number from 0-255 (inclusive) representing the threshold this account sets on all operations it performs that have a low threshold. https://developers.stellar.org/docs/learn/encyclopedia/security/signatures-multisig#multisig -* `--med-threshold ` — A number from 0-255 (inclusive) representing the threshold this account sets on all operations it performs that have a medium threshold. https://developers.stellar.org/docs/learn/encyclopedia/security/signatures-multisig#multisig -* `--high-threshold ` — A number from 0-255 (inclusive) representing the threshold this account sets on all operations it performs that have a high threshold. https://developers.stellar.org/docs/learn/encyclopedia/security/signatures-multisig#multisig -* `--home-domain ` — Sets the home domain of an account. See https://developers.stellar.org/docs/learn/encyclopedia/network-configuration/federation -* `--signer ` — Add, update, or remove a signer from an account -* `--signer-weight ` — Signer weight is a number from 0-255 (inclusive). The signer is deleted if the weight is 0 -* `--set-required` — When enabled, an issuer must approve an account before that account can hold its asset. https://developers.stellar.org/docs/tokens/control-asset-access#authorization-required-0x1 -* `--set-revocable` — When enabled, an issuer can revoke an existing trustline's authorization, thereby freezing the asset held by an account. https://developers.stellar.org/docs/tokens/control-asset-access#authorization-revocable-0x2 -* `--set-clawback-enabled` — Enables the issuing account to take back (burning) all of the asset. https://developers.stellar.org/docs/tokens/control-asset-access#clawback-enabled-0x8 -* `--set-immutable` — With this setting, none of the other authorization flags (`AUTH_REQUIRED_FLAG`, `AUTH_REVOCABLE_FLAG`) can be set, and the issuing account can't be merged. https://developers.stellar.org/docs/tokens/control-asset-access#authorization-immutable-0x4 -* `--clear-required` -* `--clear-revocable` -* `--clear-immutable` -* `--clear-clawback-enabled` - - - -## `stellar tx operation add set-trustline-flags` - -Allows issuing account to configure authorization and trustline flags to an asset -The Asset parameter is of the `TrustLineAsset` type. If you are modifying a trustline to a regular asset (i.e. one in a Code:Issuer format), this is equivalent to the Asset type. -If you are modifying a trustline to a pool share, however, this is composed of the liquidity pool's unique ID. -Learn more about flags: -https://developers.stellar.org/docs/learn/glossary#flags - -**Usage:** `stellar tx operation add set-trustline-flags [OPTIONS] --source-account --trustor --asset [TX_XDR]` - -###### **Arguments:** - -* `` — Base-64 transaction envelope XDR or file containing XDR to decode, or stdin if empty - -###### **Options:** - -* `--operation-source-account ` — Source account used for the operation -* `--fee ` — fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlm - - Default value: `100` -* `--cost` — Output the cost execution to stderr -* `--instructions ` — Number of instructions to simulate -* `--build-only` — Build the transaction and only write the base64 xdr to stdout -* `--sim-only` — (Deprecated) simulate the transaction and only write the base64 xdr to stdout -* `--rpc-url ` — RPC server endpoint -* `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `-n`, `--network ` — Name of network to use from config -* `-s`, `--source-account ` — Account that where transaction originates from. Alias `source`. Can be an identity (--source alice), a public key (--source GDKW...), a muxed account (--source MDA…), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). If `--build-only` or `--sim-only` flags were NOT provided, this key will also be used to sign the final transaction. In that case, trying to sign with public key will fail -* `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." -* `--trustor ` — Account to set trustline flags for, e.g. `GBX...`, or alias, or muxed account, `M123...`` -* `--asset ` — Asset to set trustline flags for -* `--set-authorize` — Signifies complete authorization allowing an account to transact freely with the asset to make and receive payments and place orders -* `--set-authorize-to-maintain-liabilities` — Denotes limited authorization that allows an account to maintain current orders but not to otherwise transact with the asset -* `--set-trustline-clawback-enabled` — Enables the issuing account to take back (burning) all of the asset. See our section on Clawbacks: https://developers.stellar.org/docs/learn/encyclopedia/transactions-specialized/clawbacks -* `--clear-authorize` -* `--clear-authorize-to-maintain-liabilities` -* `--clear-trustline-clawback-enabled` - - - -## `stellar tx send` - -Send a transaction envelope to the network - -**Usage:** `stellar tx send [OPTIONS] [TX_XDR]` - -###### **Arguments:** - -* `` — Base-64 transaction envelope XDR or file containing XDR to decode, or stdin if empty - -###### **Options:** - -* `--rpc-url ` — RPC server endpoint -* `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `-n`, `--network ` — Name of network to use from config -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." - - - -## `stellar tx sign` - -Sign a transaction envelope appending the signature to the envelope - -**Usage:** `stellar tx sign [OPTIONS] [TX_XDR]` - -###### **Arguments:** - -* `` — Base-64 transaction envelope XDR, or file containing XDR to decode, or stdin if empty - -###### **Options:** - -* `--sign-with-key ` — Sign with a local key or key saved in OS secure storage. Can be an identity (--sign-with-key alice), a secret key (--sign-with-key SC36…), or a seed phrase (--sign-with-key "kite urban…"). If using seed phrase, `--hd-path` defaults to the `0` path -* `--hd-path ` — If using a seed phrase to sign, sets which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` -* `--sign-with-lab` — Sign with https://lab.stellar.org -* `--sign-with-ledger` — Sign with a ledger wallet -* `--rpc-url ` — RPC server endpoint -* `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `-n`, `--network ` — Name of network to use from config -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." - - - -## `stellar tx simulate` - -Simulate a transaction envelope from stdin - -**Usage:** `stellar tx simulate [OPTIONS] --source-account [TX_XDR]` - -###### **Arguments:** - -* `` — Base-64 transaction envelope XDR or file containing XDR to decode, or stdin if empty - -###### **Options:** - -* `--rpc-url ` — RPC server endpoint -* `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `-n`, `--network ` — Name of network to use from config -* `-s`, `--source-account ` — Account that where transaction originates from. Alias `source`. Can be an identity (--source alice), a public key (--source GDKW...), a muxed account (--source MDA…), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). If `--build-only` or `--sim-only` flags were NOT provided, this key will also be used to sign the final transaction. In that case, trying to sign with public key will fail -* `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." - - - -## `stellar xdr` - -Decode and encode XDR - -**Usage:** `stellar xdr [CHANNEL] ` - -###### **Subcommands:** - -* `types` — View information about types -* `guess` — Guess the XDR type -* `decode` — Decode XDR -* `encode` — Encode XDR -* `compare` — Compare two XDR values with each other -* `version` — Print version information - -###### **Arguments:** - -* `` — Channel of XDR to operate on - - Default value: `+curr` - - Possible values: `+curr`, `+next` - - - - -## `stellar xdr types` - -View information about types - -**Usage:** `stellar xdr types ` - -###### **Subcommands:** - -* `list` — -* `schema` — - - - -## `stellar xdr types list` - -**Usage:** `stellar xdr types list [OPTIONS]` - -###### **Options:** - -* `--output ` - - Default value: `plain` - - Possible values: `plain`, `json`, `json-formatted` - - - - -## `stellar xdr types schema` - -**Usage:** `stellar xdr types schema [OPTIONS] --type ` - -###### **Options:** - -* `--type ` — XDR type to decode -* `--output ` - - Default value: `json-schema-draft201909` - - Possible values: `json-schema-draft7`, `json-schema-draft201909` - - - - -## `stellar xdr guess` - -Guess the XDR type - -**Usage:** `stellar xdr guess [OPTIONS] [FILE]` - -###### **Arguments:** - -* `` — File to decode, or stdin if omitted - -###### **Options:** - -* `--input ` - - Default value: `single-base64` - - Possible values: `single`, `single-base64`, `stream`, `stream-base64`, `stream-framed` - -* `--output ` - - Default value: `list` - - Possible values: `list` - -* `--certainty ` — Certainty as an arbitrary value - - Default value: `2` - - - -## `stellar xdr decode` - -Decode XDR - -**Usage:** `stellar xdr decode [OPTIONS] --type [FILES]...` - -###### **Arguments:** - -* `` — Files to decode, or stdin if omitted - -###### **Options:** - -* `--type ` — XDR type to decode -* `--input ` - - Default value: `stream-base64` - - Possible values: `single`, `single-base64`, `stream`, `stream-base64`, `stream-framed` - -* `--output ` - - Default value: `json` - - Possible values: `json`, `json-formatted`, `rust-debug`, `rust-debug-formatted` - - - - -## `stellar xdr encode` - -Encode XDR - -**Usage:** `stellar xdr encode [OPTIONS] --type [FILES]...` - -###### **Arguments:** - -* `` — Files to encode, or stdin if omitted - -###### **Options:** - -* `--type ` — XDR type to encode -* `--input ` - - Default value: `json` - - Possible values: `json` - -* `--output ` - - Default value: `single-base64` - - Possible values: `single`, `single-base64`, `stream` - - - - -## `stellar xdr compare` - -Compare two XDR values with each other - -Outputs: `-1` when the left XDR value is less than the right XDR value, `0` when the left XDR value is equal to the right XDR value, `1` when the left XDR value is greater than the right XDR value - -**Usage:** `stellar xdr compare [OPTIONS] --type ` - -###### **Arguments:** - -* `` — XDR file to decode and compare with the right value -* `` — XDR file to decode and compare with the left value - -###### **Options:** - -* `--type ` — XDR type of both inputs -* `--input ` - - Default value: `single-base64` - - Possible values: `single`, `single-base64` - - - - -## `stellar xdr version` - -Print version information - -**Usage:** `stellar xdr version` - - - -## `stellar completion` - -Print shell completion code for the specified shell - -Ensure the completion package for your shell is installed, e.g. bash-completion for bash. - -To enable autocomplete in the current bash shell, run: `source <(stellar completion --shell bash)` - -To enable autocomplete permanently, run: `echo "source <(stellar completion --shell bash)" >> ~/.bashrc` - - -**Usage:** `stellar completion --shell ` - -###### **Options:** - -* `--shell ` — The shell type - - Possible values: `bash`, `elvish`, `fish`, `powershell`, `zsh` - - - - -## `stellar cache` - -Cache for transactions and contract specs - -**Usage:** `stellar cache ` - -###### **Subcommands:** - -* `clean` — Delete the cache -* `path` — Show the location of the cache -* `actionlog` — Access details about cached actions like transactions, and simulations. (Experimental. May see breaking changes at any time.) - - - -## `stellar cache clean` - -Delete the cache - -**Usage:** `stellar cache clean` - - - -## `stellar cache path` - -Show the location of the cache - -**Usage:** `stellar cache path` - - - -## `stellar cache actionlog` - -Access details about cached actions like transactions, and simulations. (Experimental. May see breaking changes at any time.) - -**Usage:** `stellar cache actionlog ` - -###### **Subcommands:** - -* `ls` — List cached actions (transactions, simulations) -* `read` — Read cached action - - - -## `stellar cache actionlog ls` - -List cached actions (transactions, simulations) - -**Usage:** `stellar cache actionlog ls [OPTIONS]` - -###### **Options:** - -* `--global` — Use global config -* `--config-dir ` — Location of config directory, default is "." -* `-l`, `--long` - - - -## `stellar cache actionlog read` - -Read cached action - -**Usage:** `stellar cache actionlog read --id ` - -###### **Options:** - -* `--id ` — ID of the cache entry - - - -## `stellar version` - -Print version information - -**Usage:** `stellar version` - - - diff --git a/README.md b/README.md index a1c9eab..c167b5e 100644 --- a/README.md +++ b/README.md @@ -1 +1,101 @@ -# Admin SEP \ No newline at end of file +# Admin SEP + +Upgradeable Contracts SEP +``` +Preamble +SEP: TBD +Title: Contract Admin SEP +Author: Aha Team, Willem Wyndham, @willemneal, Gleb Zernov, @ifropc +Track: Standard +Status: Draft +Created: 2025-07-28 +Updated: 2025-07-28 +Version: 0.0.1 +Discussion: https://github.com/stellar/stellar-protocol/discussions/1670 +``` +# Summary + +A standard for generalizing the admin interface provided by the Stellar Asset Contract. + +# Motivation + +Currently important contract methods for a contract's lifetime and core functionality requires that the contract store a special admin account (See the Stellar Asset Contract and the various methods in its admin interface, e.g. `mint`, `set_authorized`, `set_admin`). When authorizing admin methods this account is retrieved from instance storage and `require_auth` is called. + +The most important method to guard is `upgrade` since it allows the contract to be upgraded with arbitrary code. + +## Comparison to other methods of access control + +Currently there is no host function to access the source account, signers of the transaction, nor authorization entries in a top level call. So many contracts in the ecosystem, add an extra argument to the contract method to pass which account is the signer. This is then used for more complex access control such as checking if the account has a role. + +However, with the authorization framework if a contract implements `__check_auth` the context of the call is passed and if the admin is the contract (could be itself) then when `admin.require_auth()` is called `__check_auth` can implement fine-grained access control. + +Separating the access control from the contract's interface prevents the abstraction of access control from leaking into a contract's interface and more importantly from the implementation of the interface. + +For example, consider a pausable interface has an extra `operator` argument to the `pause` method which must be a manager role. If the contract authors want to change the access control to require two signers it would mean changing the interface and be a breaking change. + +Furthermore, if the `admin` is another contract, then the access control can be upgraded separately from the main contract. + + + +# Admin Interface + +```rust +pub trait Administratable { + /// Read-only method that retrieves the current admin + fn admin(env: &Env) -> Address; + + /// updates the current admin if approved by current admin + fn set_admin(env: &Env, new_admin: &Address); +} +``` + +Note that it is required to call `set_admin` in the `__constructor`. + + +## Other Considerations + +OpenZeppelin provide an alternative `Ownable` trait. It uses `owner` instead of `admin` and provides the addiontional option of accepting or rejecting being the new admin. However, this same functionality could be acheived by the new admin setting the original admin. +Furthermore, given the prior art of the SAC's admin interface it makes sense to continue with this naming convention and given the foundational nature of the admin interface it should aim to be as minial as possible. + +## Implementations + +Given the foundational aspect of this proposal, included is an implementation which uses with the proposed `contracttrait` macro to make it easy to add the trait to your contract. + + +- [admin-sep](https://github.com/ahalabs/admin-sep) + +```rust +use soroban_sdk::{Address, Env, contract, contractimpl, contracttrait}; +use admin_sep::{Administratable, Upgradable}; + +#[contract] +pub struct Contract; + +#[contractimpl] +impl Contract { + pub fn __construct(env: &Env, admin: Address) { + Self::set_admin(env, admin); + } +} + +#[contracttrait] +impl Administratable for Contract {} + +#[contracttrait] +impl Upgradable for Contract {} +``` + +Here `Upgradable` is defined as + +```rust +pub trait Upgradable: Administratable { + fn upgrade(env: &Env, wasm_hash: BytesN<32>) { + Self::admin(env).require_auth(); + env.deployer().update_current_contract_wasm(wasm_hash); + } +} +``` + +## Future Considerations + +A simple macro could then be used to indicate where or not the method requires elevated permissions; it could also put a comment indicating the access control allowing downstream tooling to filter just normal user methods. diff --git a/admin/Cargo.toml b/admin/Cargo.toml index eebfcc4..ae1ae5f 100644 --- a/admin/Cargo.toml +++ b/admin/Cargo.toml @@ -10,22 +10,8 @@ crate-type = ["cdylib"] doctest = false [dependencies] -soroban-sdk = { version = "22.0.7" } +soroban-sdk = { workspace = true} admin-sep = { path = "../admin_sep" } [dev-dependencies] -soroban-sdk = { version = "22.0.7", features = ["testutils"] } - -[profile.release] -opt-level = "z" -overflow-checks = true -debug = 0 -strip = "symbols" -debug-assertions = false -panic = "abort" -codegen-units = 1 -lto = true - -[profile.release-with-logs] -inherits = "release" -debug-assertions = true +soroban-sdk = { workspace = true, features = ["testutils"] } diff --git a/admin/src/lib.rs b/admin/src/lib.rs index 5b90e7b..654c0bf 100644 --- a/admin/src/lib.rs +++ b/admin/src/lib.rs @@ -1,43 +1,22 @@ #![no_std] -use soroban_sdk::{Address, Env, contract, contracttype}; - -use admin_sep::{ - Admin, Administratable, AdministratableExt, Constructable, HasAdmin, Upgradable, Upgrader, - derive_contract, -}; +use admin_sep::{Administratable, Upgradable}; +use soroban_sdk::{Address, Env, contract, contractimpl, contracttrait}; #[contract] -#[derive_contract(Administratable, Upgradable(ext = AdministratableExt))] pub struct Contract; -Constructable!(Contract, Contract, CustomArgs); - -#[contracttype] -pub struct CustomArgs(pub Address, pub u32); - -impl HasAdmin for CustomArgs { - fn admin(&self) -> &soroban_sdk::Address { - &self.0 +#[contractimpl] +impl Contract { + pub fn __construct(env: &Env, admin: Address) { + Self::set_admin(env, admin); } } -const COUNT: soroban_sdk::Symbol = soroban_sdk::symbol_short!("COUNT"); - -impl Constructable for Contract { - fn construct(env: &Env, args: CustomArgs) { - env.storage().persistent().set(&COUNT, &args.1); - } -} +#[contracttrait] +impl Administratable for Contract {} -#[soroban_sdk::contractimpl] -impl Contract { - pub fn increment(env: Env) -> u32 { - let mut count: u32 = env.storage().persistent().get(&COUNT).unwrap_or(0); - count += 1; - env.storage().persistent().set(&COUNT, &count); - count - } -} +#[contracttrait] +impl Upgradable for Contract {} mod test; diff --git a/admin/src/test.rs b/admin/src/test.rs index 73a27eb..59d3304 100644 --- a/admin/src/test.rs +++ b/admin/src/test.rs @@ -1,17 +1,16 @@ #![cfg(test)] extern crate std; -use crate::{Contract, ContractClient, CustomArgs}; +use crate::{Contract, ContractClient}; use soroban_sdk::{Address, Env, testutils::Address as _}; #[test] fn test() { let env = Env::default(); let admin = Address::generate(&env); - let args = CustomArgs(admin.clone(), 1); - let contract_id = env.register(Contract, (args,)); - let client = ContractClient::new(&env, &contract_id); + let contract_id = env.register(Contract, (admin.clone(),)); + let _client = ContractClient::new(&env, &contract_id); - assert_eq!(client.increment(), 2); - assert_eq!(client.increment(), 3); - assert_eq!(client.increment(), 4); + // assert_eq!(client.increment(), 2); + // assert_eq!(client.increment(), 3); + // assert_eq!(client.increment(), 4); } diff --git a/admin_sep/Cargo.toml b/admin_sep/Cargo.toml index 8a1854f..678064d 100644 --- a/admin_sep/Cargo.toml +++ b/admin_sep/Cargo.toml @@ -10,22 +10,8 @@ crate-type = ["rlib"] doctest = false [dependencies] -soroban-sdk = { version = "22.0.7" } -contracttrait-macro = { path = "../contracttrait-macro" } +soroban-sdk = { workspace = true } [dev-dependencies] -soroban-sdk = { version = "22.0.7", features = ["testutils"] } +soroban-sdk = { workspace = true, features = ["testutils"] } -[profile.release] -opt-level = "z" -overflow-checks = true -debug = 0 -strip = "symbols" -debug-assertions = false -panic = "abort" -codegen-units = 1 -lto = true - -[profile.release-with-logs] -inherits = "release" -debug-assertions = true diff --git a/admin_sep/src/administratable.rs b/admin_sep/src/administratable.rs index 8d13dc3..9c88873 100644 --- a/admin_sep/src/administratable.rs +++ b/admin_sep/src/administratable.rs @@ -1,43 +1,34 @@ -use crate::contracttrait; -use soroban_sdk::{Address, Env, Symbol, symbol_short}; +use soroban_sdk::{Address, Env, Symbol, contracttrait, symbol_short}; /// Trait for using an admin address to control access. -#[contracttrait(default = Admin, is_extension = true)] +#[contracttrait(default = Admin)] pub trait Administratable { fn admin(env: &Env) -> soroban_sdk::Address; - fn set_admin(env: &Env, new_admin: &soroban_sdk::Address); + fn set_admin(env: &Env, new_admin: soroban_sdk::Address); #[internal] fn require_admin(env: &Env) { Self::admin(env).require_auth(); } - - #[internal] - fn init(env: &Env, admin: &soroban_sdk::Address); } -pub const STORAGE_KEY: Symbol = symbol_short!("A"); +pub const STORAGE_KEY: Symbol = symbol_short!("ADMIN"); -fn get(env: &Env) -> Option
{ +pub fn get(env: &Env) -> Option
{ env.storage().instance().get(&STORAGE_KEY) } pub struct Admin; impl Administratable for Admin { - type Impl = Admin; + type Impl = Self; fn admin(env: &Env) -> soroban_sdk::Address { unsafe { get(env).unwrap_unchecked() } } - fn set_admin(env: &Env, new_admin: &soroban_sdk::Address) { - Self::require_admin(env); - env.storage().instance().set(&STORAGE_KEY, &new_admin); - } - - fn init(env: &Env, admin: &soroban_sdk::Address) { - if get(env).is_some() { - panic!("Admin already initialized"); + fn set_admin(env: &Env, new_admin: soroban_sdk::Address) { + if let Some(owner) = get(env) { + owner.require_auth(); } - env.storage().instance().set(&STORAGE_KEY, &admin); + env.storage().instance().set(&STORAGE_KEY, &new_admin); } } diff --git a/admin_sep/src/constructor.rs b/admin_sep/src/constructor.rs index f893907..7ded1eb 100644 --- a/admin_sep/src/constructor.rs +++ b/admin_sep/src/constructor.rs @@ -1,78 +1,78 @@ -use soroban_sdk::{Address, Env}; +// use soroban_sdk::{Address, Env}; -pub trait HasAdmin { - fn admin(&self) -> &Address; -} - -// #[contracttrait(DefaultAdmin)] -pub trait Constructable: crate::Administratable { - #[allow(unused_variables)] - fn construct(env: &Env, args: T) {} - fn constructor(env: &Env, args: T) { - Self::init(env, args.admin()); - Self::construct(env, args); - } -} +// pub trait HasAdmin { +// fn admin(&self) -> &Address; +// } -// // Generates -#[macro_export] -macro_rules! Constructable { - ($contract_name:ident) => { - impl Constructable for $contract_name {} - Constructable!($contract_name, $contract_name, soroban_sdk::Address); - }; - ($contract_name:ident, $impl_name:path, $type_name:ty) => { - pub trait ConstructableExt { - type Args: HasAdmin; - fn __constructor(env: Env, args: Self::Args); - } - #[soroban_sdk::contractimpl] - impl ConstructableExt for $contract_name { - type Args = $type_name; - fn __constructor(env: Env, args: Self::Args) { - <$impl_name as Constructable<$type_name>>::constructor(&env, args); - } - } - }; - () => {}; -} +// // #[contracttrait(DefaultAdmin)] +// pub trait Constructable: crate::Administratable { +// #[allow(unused_variables)] +// fn construct(env: &Env, args: T) {} +// fn constructor(env: &Env, args: T) { +// Self::set_admin(env, args.admin()); +// Self::construct(env, args); +// } +// } -// impl Constructable
for DefaultAdmin {} +// // // Generates +// #[macro_export] +// macro_rules! Constructable { +// ($contract_name:ident) => { +// impl Constructable for $contract_name {} +// Constructable!($contract_name, $contract_name, soroban_sdk::Address); +// }; +// ($contract_name:ident, $impl_name:path, $type_name:ty) => { +// pub trait ConstructableExt { +// type Args: HasAdmin; +// fn __constructor(env: Env, args: Self::Args); +// } +// #[soroban_sdk::contractimpl] +// impl ConstructableExt for $contract_name { +// type Args = $type_name; +// fn __constructor(env: Env, args: Self::Args) { +// <$impl_name as Constructable<$type_name>>::constructor(&env, args); +// } +// } +// }; +// () => {}; +// } -impl HasAdmin for Address { - fn admin(&self) -> &Address { - self - } -} +// // impl Constructable
for DefaultAdmin {} -// impl HasAdmin for (Address, T) { +// impl HasAdmin for Address { // fn admin(&self) -> &Address { -// &self.0 +// self // } // } -macro_rules! impl_has_admin_for_tuples { - ($($name:ident),*) => { - impl<$($name),*> HasAdmin for (Address, $($name),*) { - fn admin(&self) -> &Address { &self.0 } - } - }; -} -impl_has_admin_for_tuples!(); -impl_has_admin_for_tuples!(T1); -impl_has_admin_for_tuples!(T1, T2); -impl_has_admin_for_tuples!(T1, T2, T3); -impl_has_admin_for_tuples!(T1, T2, T3, T4); -impl_has_admin_for_tuples!(T1, T2, T3, T4, T5); -impl_has_admin_for_tuples!(T1, T2, T3, T4, T5, T6); -impl_has_admin_for_tuples!(T1, T2, T3, T4, T5, T6, T7); -impl_has_admin_for_tuples!(T1, T2, T3, T4, T5, T6, T7, T8); -impl_has_admin_for_tuples!(T1, T2, T3, T4, T5, T6, T7, T8, T9); -impl_has_admin_for_tuples!(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10); -impl_has_admin_for_tuples!(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11); -impl_has_admin_for_tuples!(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12); -impl_has_admin_for_tuples!(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13); -impl_has_admin_for_tuples!(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14); -impl_has_admin_for_tuples!( - T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15 -); +// // impl HasAdmin for (Address, T) { +// // fn admin(&self) -> &Address { +// // &self.0 +// // } +// // } + +// macro_rules! impl_has_admin_for_tuples { +// ($($name:ident),*) => { +// impl<$($name),*> HasAdmin for (Address, $($name),*) { +// fn admin(&self) -> &Address { &self.0 } +// } +// }; +// } +// impl_has_admin_for_tuples!(); +// impl_has_admin_for_tuples!(T1); +// impl_has_admin_for_tuples!(T1, T2); +// impl_has_admin_for_tuples!(T1, T2, T3); +// impl_has_admin_for_tuples!(T1, T2, T3, T4); +// impl_has_admin_for_tuples!(T1, T2, T3, T4, T5); +// impl_has_admin_for_tuples!(T1, T2, T3, T4, T5, T6); +// impl_has_admin_for_tuples!(T1, T2, T3, T4, T5, T6, T7); +// impl_has_admin_for_tuples!(T1, T2, T3, T4, T5, T6, T7, T8); +// impl_has_admin_for_tuples!(T1, T2, T3, T4, T5, T6, T7, T8, T9); +// impl_has_admin_for_tuples!(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10); +// impl_has_admin_for_tuples!(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11); +// impl_has_admin_for_tuples!(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12); +// impl_has_admin_for_tuples!(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13); +// impl_has_admin_for_tuples!(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14); +// impl_has_admin_for_tuples!( +// T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15 +// ); diff --git a/admin_sep/src/lib.rs b/admin_sep/src/lib.rs index b2c3f05..91a7fc4 100644 --- a/admin_sep/src/lib.rs +++ b/admin_sep/src/lib.rs @@ -1,10 +1,9 @@ #![no_std] -pub use contracttrait_macro::*; mod administratable; mod constructor; mod upgradable; pub use administratable::*; -pub use constructor::*; +// pub use constructor::*; pub use upgradable::*; diff --git a/admin_sep/src/upgradable.rs b/admin_sep/src/upgradable.rs index c5e11d7..da4c90c 100644 --- a/admin_sep/src/upgradable.rs +++ b/admin_sep/src/upgradable.rs @@ -1,25 +1,11 @@ -use crate::contracttrait; +use soroban_sdk::contracttrait; -use crate::administratable::{Administratable, AdministratableExt}; +use crate::administratable::Administratable; -#[contracttrait(default = Upgrader, extension_required = true)] -pub trait Upgradable { - fn upgrade(env: &soroban_sdk::Env, wasm_hash: soroban_sdk::BytesN<32>); -} - -pub struct Upgrader; - -impl Upgradable for Upgrader { - type Impl = Upgrader; +#[contracttrait(no_impl = true)] +pub trait Upgradable: Administratable { fn upgrade(env: &soroban_sdk::Env, wasm_hash: soroban_sdk::BytesN<32>) { + Self::require_admin(env); env.deployer().update_current_contract_wasm(wasm_hash); } } - -impl Upgradable for AdministratableExt { - type Impl = N; - fn upgrade(env: &soroban_sdk::Env, wasm_hash: soroban_sdk::BytesN<32>) { - T::require_admin(env); - N::upgrade(env, wasm_hash); - } -} diff --git a/admin_v2/Cargo.lock b/admin_v2/Cargo.lock new file mode 100644 index 0000000..a67a356 --- /dev/null +++ b/admin_v2/Cargo.lock @@ -0,0 +1,1879 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "Inflector" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" + +[[package]] +name = "admin-sep" +version = "0.0.0" +dependencies = [ + "contracttrait-macro", + "soroban-sdk", +] + +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "arbitrary" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" +dependencies = [ + "derive_arbitrary", +] + +[[package]] +name = "ark-bls12-381" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c775f0d12169cba7aae4caeb547bb6a50781c7449a8aa53793827c9ec4abf488" +dependencies = [ + "ark-ec", + "ark-ff", + "ark-serialize", + "ark-std", +] + +[[package]] +name = "ark-ec" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "defd9a439d56ac24968cca0571f598a61bc8c55f71d50a89cda591cb750670ba" +dependencies = [ + "ark-ff", + "ark-poly", + "ark-serialize", + "ark-std", + "derivative", + "hashbrown 0.13.2", + "itertools 0.10.5", + "num-traits", + "zeroize", +] + +[[package]] +name = "ark-ff" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec847af850f44ad29048935519032c33da8aa03340876d351dfab5660d2966ba" +dependencies = [ + "ark-ff-asm", + "ark-ff-macros", + "ark-serialize", + "ark-std", + "derivative", + "digest", + "itertools 0.10.5", + "num-bigint", + "num-traits", + "paste", + "rustc_version", + "zeroize", +] + +[[package]] +name = "ark-ff-asm" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-macros" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" +dependencies = [ + "num-bigint", + "num-traits", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-poly" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d320bfc44ee185d899ccbadfa8bc31aab923ce1558716e1997a1e74057fe86bf" +dependencies = [ + "ark-ff", + "ark-serialize", + "ark-std", + "derivative", + "hashbrown 0.13.2", +] + +[[package]] +name = "ark-serialize" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" +dependencies = [ + "ark-serialize-derive", + "ark-std", + "digest", + "num-bigint", +] + +[[package]] +name = "ark-serialize-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae3281bc6d0fd7e549af32b52511e1302185bd688fd3359fa36423346ff682ea" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-std" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" +dependencies = [ + "num-traits", + "rand", +] + +[[package]] +name = "arrayvec" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" + +[[package]] +name = "autocfg" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" + +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + +[[package]] +name = "bitmaps" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "031043d04099746d8db04daf1fa424b2bc8bd69d92b25962dcde24da39ab64a2" +dependencies = [ + "typenum", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bumpalo" +version = "3.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes-lit" +version = "0.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0adabf37211a5276e46335feabcbb1530c95eb3fdf85f324c7db942770aa025d" +dependencies = [ + "num-bigint", + "proc-macro2", + "quote", + "syn 2.0.87", +] + +[[package]] +name = "cc" +version = "1.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e80e3b6a3ab07840e1cae9b0666a63970dc28e8ed5ffbcdacbfc760c281bfc1" +dependencies = [ + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "chrono" +version = "0.4.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" +dependencies = [ + "android-tzdata", + "iana-time-zone", + "num-traits", + "serde", + "windows-targets", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + +[[package]] +name = "contracttrait-macro" +version = "0.8.6" +dependencies = [ + "Inflector", + "deluxe", + "heck 0.5.0", + "itertools 0.14.0", + "proc-macro2", + "quote", + "regex", + "syn 2.0.87", + "syn-file-expand", + "thiserror 2.0.12", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "cpufeatures" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" +dependencies = [ + "libc", +] + +[[package]] +name = "crate-git-revision" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c521bf1f43d31ed2f73441775ed31935d77901cb3451e44b38a1c1612fcbaf98" +dependencies = [ + "serde", + "serde_derive", + "serde_json", +] + +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "ctor" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a2785755761f3ddc1492979ce1e48d2c00d09311c39e4466429188f3dd6501" +dependencies = [ + "quote", + "syn 2.0.87", +] + +[[package]] +name = "curve25519-dalek" +version = "4.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest", + "fiat-crypto", + "rustc_version", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] + +[[package]] +name = "darling" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim 0.11.1", + "syn 2.0.87", +] + +[[package]] +name = "darling_macro" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +dependencies = [ + "darling_core", + "quote", + "syn 2.0.87", +] + +[[package]] +name = "data-encoding" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" + +[[package]] +name = "deluxe" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ed332aaf752b459088acf3dd4eca323e3ef4b83c70a84ca48fb0ec5305f1488" +dependencies = [ + "deluxe-core", + "deluxe-macros", + "once_cell", + "proc-macro2", + "syn 2.0.87", +] + +[[package]] +name = "deluxe-core" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eddada51c8576df9d6a8450c351ff63042b092c9458b8ac7d20f89cbd0ffd313" +dependencies = [ + "arrayvec", + "proc-macro2", + "quote", + "strsim 0.10.0", + "syn 2.0.87", +] + +[[package]] +name = "deluxe-macros" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f87546d9c837f0b7557e47b8bd6eae52c3c223141b76aa233c345c9ab41d9117" +dependencies = [ + "deluxe-core", + "heck 0.4.1", + "if_chain", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.87", +] + +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "zeroize", +] + +[[package]] +name = "deranged" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", + "serde", +] + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "derive_arbitrary" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "const-oid", + "crypto-common", + "subtle", +] + +[[package]] +name = "downcast-rs" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" + +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest", + "elliptic-curve", + "rfc6979", + "signature", +] + +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8", + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a3daa8e81a3963a60642bcc1f90a670680bd4a77535faa384e9d1c79d620871" +dependencies = [ + "curve25519-dalek", + "ed25519", + "rand_core", + "serde", + "sha2", + "subtle", + "zeroize", +] + +[[package]] +name = "either" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" + +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "rand_core", + "sec1", + "subtle", + "zeroize", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "escape-bytes" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bfcf67fea2815c2fc3b90873fae90957be12ff417335dfadc7f52927feb03b2" + +[[package]] +name = "ethnum" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b90ca2580b73ab6a1f724b76ca11ab632df820fd6040c336200d2c1df7b3c82c" + +[[package]] +name = "example-admin-contract" +version = "0.0.0" +dependencies = [ + "admin-sep", + "soroban-sdk", +] + +[[package]] +name = "ff" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" +dependencies = [ + "rand_core", + "subtle", +] + +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", + "zeroize", +] + +[[package]] +name = "getrandom" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", +] + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash", +] + +[[package]] +name = "hashbrown" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +dependencies = [ + "serde", +] + +[[package]] +name = "hex-literal" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "if_chain" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb56e1aa765b4b4f3aadfab769793b7087bb03a4ea4920644a6d238e2df5b9ed" + +[[package]] +name = "im-rc" +version = "15.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af1955a75fa080c677d3972822ec4bad316169ab1cfc6c257a942c2265dbe5fe" +dependencies = [ + "bitmaps", + "rand_core", + "rand_xoshiro", + "sized-chunks", + "typenum", + "version_check", +] + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", + "serde", +] + +[[package]] +name = "indexmap" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" +dependencies = [ + "equivalent", + "hashbrown 0.15.2", + "serde", +] + +[[package]] +name = "indexmap-nostd" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e04e2fd2b8188ea827b32ef11de88377086d690286ab35747ef7f9bf3ccb590" + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "js-sys" +version = "0.3.70" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "k256" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "sha2", +] + +[[package]] +name = "keccak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "libc" +version = "0.2.159" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" + +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + +[[package]] +name = "log" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "num-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + +[[package]] +name = "num-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" + +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "ecdsa", + "elliptic-curve", + "primeorder", + "sha2", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "ppv-lite86" +version = "0.2.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "prettyplease" +version = "0.2.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479cf940fbbb3426c32c5d5176f62ad57549a0bb84773423ba8be9d089f5faba" +dependencies = [ + "proc-macro2", + "syn 2.0.87", +] + +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", +] + +[[package]] +name = "proc-macro-crate" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" +dependencies = [ + "once_cell", + "toml_edit", +] + +[[package]] +name = "proc-macro2" +version = "1.0.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3e4daa0dcf6feba26f985457cdf104d4b4256fc5a09547140f3631bb076b19a" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "rand_xoshiro" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa" +dependencies = [ + "rand_core", +] + +[[package]] +name = "regex" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" + +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "subtle", + "zeroize", +] + +[[package]] +name = "semver" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" + +[[package]] +name = "serde" +version = "1.0.210" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.210" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] + +[[package]] +name = "serde_json" +version = "1.0.128" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] + +[[package]] +name = "serde_with" +version = "3.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e28bdad6db2b8340e449f7108f020b3b092e8583a9e3fb82713e1d4e71fe817" +dependencies = [ + "base64 0.22.1", + "chrono", + "hex", + "indexmap 1.9.3", + "indexmap 2.6.0", + "serde", + "serde_derive", + "serde_json", + "serde_with_macros", + "time", +] + +[[package]] +name = "serde_with_macros" +version = "3.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d846214a9854ef724f3da161b426242d8de7c1fc7de2f89bb1efcb154dca79d" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.87", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha3" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +dependencies = [ + "digest", + "keccak", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest", + "rand_core", +] + +[[package]] +name = "sized-chunks" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16d69225bde7a69b235da73377861095455d298f2b970996eec25ddbb42b3d1e" +dependencies = [ + "bitmaps", + "typenum", +] + +[[package]] +name = "smallvec" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" + +[[package]] +name = "soroban-builtin-sdk-macros" +version = "22.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf2e42bf80fcdefb3aae6ff3c7101a62cf942e95320ed5b518a1705bc11c6b2f" +dependencies = [ + "itertools 0.10.5", + "proc-macro2", + "quote", + "syn 2.0.87", +] + +[[package]] +name = "soroban-env-common" +version = "22.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "027cd856171bfd6ad2c0ffb3b7dfe55ad7080fb3050c36ad20970f80da634472" +dependencies = [ + "arbitrary", + "crate-git-revision", + "ethnum", + "num-derive", + "num-traits", + "serde", + "soroban-env-macros", + "soroban-wasmi", + "static_assertions", + "stellar-xdr", + "wasmparser", +] + +[[package]] +name = "soroban-env-guest" +version = "22.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a07dda1ae5220d975979b19ad4fd56bc86ec7ec1b4b25bc1c5d403f934e592e" +dependencies = [ + "soroban-env-common", + "static_assertions", +] + +[[package]] +name = "soroban-env-host" +version = "22.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66e8b03a4191d485eab03f066336112b2a50541a7553179553dc838b986b94dd" +dependencies = [ + "ark-bls12-381", + "ark-ec", + "ark-ff", + "ark-serialize", + "curve25519-dalek", + "ecdsa", + "ed25519-dalek", + "elliptic-curve", + "generic-array", + "getrandom", + "hex-literal", + "hmac", + "k256", + "num-derive", + "num-integer", + "num-traits", + "p256", + "rand", + "rand_chacha", + "sec1", + "sha2", + "sha3", + "soroban-builtin-sdk-macros", + "soroban-env-common", + "soroban-wasmi", + "static_assertions", + "stellar-strkey", + "wasmparser", +] + +[[package]] +name = "soroban-env-macros" +version = "22.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00eff744764ade3bc480e4909e3a581a240091f3d262acdce80b41f7069b2bd9" +dependencies = [ + "itertools 0.10.5", + "proc-macro2", + "quote", + "serde", + "serde_json", + "stellar-xdr", + "syn 2.0.87", +] + +[[package]] +name = "soroban-ledger-snapshot" +version = "22.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80bbe59497cb50e81861187e6bd2a2c805df253573d44ed56e7d373f79530758" +dependencies = [ + "serde", + "serde_json", + "serde_with", + "soroban-env-common", + "soroban-env-host", + "thiserror 1.0.64", +] + +[[package]] +name = "soroban-sdk" +version = "22.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c85edd55eb09aa5dd7ba5ab595d2be7ac3f453e90e2f26d704ff26c130f2926f" +dependencies = [ + "arbitrary", + "bytes-lit", + "ctor", + "derive_arbitrary", + "ed25519-dalek", + "rand", + "rustc_version", + "serde", + "serde_json", + "soroban-env-guest", + "soroban-env-host", + "soroban-ledger-snapshot", + "soroban-sdk-macros", + "stellar-strkey", +] + +[[package]] +name = "soroban-sdk-macros" +version = "22.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a141230aa65006d4b3eeee9d0589172d734a2abfbe15b84670e38e76e200b370" +dependencies = [ + "crate-git-revision", + "darling", + "itertools 0.10.5", + "proc-macro2", + "quote", + "rustc_version", + "sha2", + "soroban-env-common", + "soroban-spec", + "soroban-spec-rust", + "stellar-xdr", + "syn 2.0.87", +] + +[[package]] +name = "soroban-spec" +version = "22.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b54326e9516b33be99c701b37242b27efb8e66cc1f1eff994b9d9a013a4be136" +dependencies = [ + "base64 0.13.1", + "stellar-xdr", + "thiserror 1.0.64", + "wasmparser", +] + +[[package]] +name = "soroban-spec-rust" +version = "22.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f009cab4dfd653bc94a06c5022f1ca9d30e198b0e451f84cf307231563d11de2" +dependencies = [ + "prettyplease", + "proc-macro2", + "quote", + "sha2", + "soroban-spec", + "stellar-xdr", + "syn 2.0.87", + "thiserror 1.0.64", +] + +[[package]] +name = "soroban-wasmi" +version = "0.31.1-soroban.20.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "710403de32d0e0c35375518cb995d4fc056d0d48966f2e56ea471b8cb8fc9719" +dependencies = [ + "smallvec", + "spin", + "wasmi_arena", + "wasmi_core", + "wasmparser-nostd", +] + +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "stellar-strkey" +version = "0.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e3aa3ed00e70082cb43febc1c2afa5056b9bb3e348bbb43d0cd0aa88a611144" +dependencies = [ + "crate-git-revision", + "data-encoding", + "thiserror 1.0.64", +] + +[[package]] +name = "stellar-xdr" +version = "22.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ce69db907e64d1e70a3dce8d4824655d154749426a6132b25395c49136013e4" +dependencies = [ + "arbitrary", + "base64 0.13.1", + "crate-git-revision", + "escape-bytes", + "hex", + "serde", + "serde_with", + "stellar-strkey", +] + +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn-file-expand" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7af40d2da901c8c24077520fbf09848d38ddb4856a83d661892007836489fdb0" +dependencies = [ + "im-rc", + "itertools 0.10.5", + "proc-macro2", + "quote", + "syn 2.0.87", + "thiserror 1.0.64", +] + +[[package]] +name = "thiserror" +version = "1.0.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" +dependencies = [ + "thiserror-impl 1.0.64", +] + +[[package]] +name = "thiserror" +version = "2.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" +dependencies = [ + "thiserror-impl 2.0.12", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] + +[[package]] +name = "time" +version = "0.3.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" +dependencies = [ + "deranged", + "itoa", + "num-conv", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" + +[[package]] +name = "time-macros" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" +dependencies = [ + "num-conv", + "time-core", +] + +[[package]] +name = "toml_datetime" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" + +[[package]] +name = "toml_edit" +version = "0.19.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" +dependencies = [ + "indexmap 2.6.0", + "toml_datetime", + "winnow", +] + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "unicode-ident" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" +dependencies = [ + "cfg-if", + "once_cell", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn 2.0.87", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" + +[[package]] +name = "wasmi_arena" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "104a7f73be44570cac297b3035d76b169d6599637631cf37a1703326a0727073" + +[[package]] +name = "wasmi_core" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcf1a7db34bff95b85c261002720c00c3a6168256dcb93041d3fa2054d19856a" +dependencies = [ + "downcast-rs", + "libm", + "num-traits", + "paste", +] + +[[package]] +name = "wasmparser" +version = "0.116.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a58e28b80dd8340cb07b8242ae654756161f6fc8d0038123d679b7b99964fa50" +dependencies = [ + "indexmap 2.6.0", + "semver", +] + +[[package]] +name = "wasmparser-nostd" +version = "0.100.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5a015fe95f3504a94bb1462c717aae75253e39b9dd6c3fb1062c934535c64aa" +dependencies = [ + "indexmap-nostd", +] + +[[package]] +name = "windows-core" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winnow" +version = "0.5.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" +dependencies = [ + "memchr", +] + +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "byteorder", + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] diff --git a/admin_v2/Cargo.toml b/admin_v2/Cargo.toml new file mode 100644 index 0000000..682501d --- /dev/null +++ b/admin_v2/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "example-admin-contract-v2" +version = "0.0.0" +edition = "2024" +publish = false +rust-version = "1.87.0" + +[lib] +crate-type = ["cdylib"] +doctest = false + +[dependencies] +soroban-sdk = { workspace = true } +admin-sep = { path = "../admin_sep" } + +[dev-dependencies] +soroban-sdk = { workspace = true, features = ["testutils"] } diff --git a/admin_v2/Makefile b/admin_v2/Makefile new file mode 100644 index 0000000..c266f2e --- /dev/null +++ b/admin_v2/Makefile @@ -0,0 +1,17 @@ +default: build + +all: test + +test: build + cargo test + +build: + stellar contract build --out-dir target/stellar + stellar contract optimize --wasm target/stellar/soroban_admin_contract.wasm --wasm-out target/stellar/soroban_admin_contract.wasm + @ls -l target/stellar/*.wasm + +fmt: + cargo fmt --all + +clean: + cargo clean diff --git a/admin_v2/rust-toolchain.toml b/admin_v2/rust-toolchain.toml new file mode 100644 index 0000000..d1be731 --- /dev/null +++ b/admin_v2/rust-toolchain.toml @@ -0,0 +1,4 @@ +[toolchain] +channel = "1.87.0" +targets = ["wasm32v1-none"] +components = ["rustc", "cargo", "rustfmt", "clippy", "rust-src"] diff --git a/admin_v2/src/lib.rs b/admin_v2/src/lib.rs new file mode 100644 index 0000000..654c0bf --- /dev/null +++ b/admin_v2/src/lib.rs @@ -0,0 +1,22 @@ +#![no_std] + +use admin_sep::{Administratable, Upgradable}; +use soroban_sdk::{Address, Env, contract, contractimpl, contracttrait}; + +#[contract] +pub struct Contract; + +#[contractimpl] +impl Contract { + pub fn __construct(env: &Env, admin: Address) { + Self::set_admin(env, admin); + } +} + +#[contracttrait] +impl Administratable for Contract {} + +#[contracttrait] +impl Upgradable for Contract {} + +mod test; diff --git a/admin_sep/src/test.rs b/admin_v2/src/test.rs similarity index 54% rename from admin_sep/src/test.rs rename to admin_v2/src/test.rs index a10b551..59d3304 100644 --- a/admin_sep/src/test.rs +++ b/admin_v2/src/test.rs @@ -5,11 +5,10 @@ use soroban_sdk::{Address, Env, testutils::Address as _}; #[test] fn test() { - // let env = Env::default(); - // let admin = Address::generate(&env); - // let args = (admin.clone(), 1); - // let contract_id = env.register(Contract, (args,)); - // let client = ContractClient::new(&env, &contract_id); + let env = Env::default(); + let admin = Address::generate(&env); + let contract_id = env.register(Contract, (admin.clone(),)); + let _client = ContractClient::new(&env, &contract_id); // assert_eq!(client.increment(), 2); // assert_eq!(client.increment(), 3); diff --git a/contracttrait-macro/Cargo.lock b/contracttrait-macro/Cargo.lock deleted file mode 100644 index 052a89d..0000000 --- a/contracttrait-macro/Cargo.lock +++ /dev/null @@ -1,748 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 4 - -[[package]] -name = "Inflector" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" - -[[package]] -name = "aho-corasick" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" -dependencies = [ - "memchr", -] - -[[package]] -name = "anstyle" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd" - -[[package]] -name = "arrayvec" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" - -[[package]] -name = "assert_fs" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a652f6cb1f516886fcfee5e7a5c078b9ade62cfcb889524efe5a64d682dd27a9" -dependencies = [ - "anstyle", - "doc-comment", - "globwalk", - "predicates", - "predicates-core", - "predicates-tree", - "tempfile", -] - -[[package]] -name = "bitflags" -version = "2.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" - -[[package]] -name = "bitmaps" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "031043d04099746d8db04daf1fa424b2bc8bd69d92b25962dcde24da39ab64a2" -dependencies = [ - "typenum", -] - -[[package]] -name = "bstr" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "234113d19d0d7d613b40e86fb654acf958910802bcceab913a4f9e7cda03b1a4" -dependencies = [ - "memchr", - "serde", -] - -[[package]] -name = "cfg-if" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" - -[[package]] -name = "contracttrait-macro" -version = "0.8.6" -dependencies = [ - "Inflector", - "assert_fs", - "deluxe", - "heck 0.5.0", - "itertools 0.14.0", - "proc-macro2", - "quote", - "regex", - "syn", - "syn-file-expand", - "thiserror 2.0.12", -] - -[[package]] -name = "crossbeam-deque" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" -dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" - -[[package]] -name = "deluxe" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ed332aaf752b459088acf3dd4eca323e3ef4b83c70a84ca48fb0ec5305f1488" -dependencies = [ - "deluxe-core", - "deluxe-macros", - "once_cell", - "proc-macro2", - "syn", -] - -[[package]] -name = "deluxe-core" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eddada51c8576df9d6a8450c351ff63042b092c9458b8ac7d20f89cbd0ffd313" -dependencies = [ - "arrayvec", - "proc-macro2", - "quote", - "strsim", - "syn", -] - -[[package]] -name = "deluxe-macros" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f87546d9c837f0b7557e47b8bd6eae52c3c223141b76aa233c345c9ab41d9117" -dependencies = [ - "deluxe-core", - "heck 0.4.1", - "if_chain", - "proc-macro-crate", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "difflib" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8" - -[[package]] -name = "doc-comment" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" - -[[package]] -name = "either" -version = "1.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" - -[[package]] -name = "equivalent" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" - -[[package]] -name = "errno" -version = "0.3.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cea14ef9355e3beab063703aa9dab15afd25f0667c341310c1e5274bb1d0da18" -dependencies = [ - "libc", - "windows-sys", -] - -[[package]] -name = "fastrand" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" - -[[package]] -name = "getrandom" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" -dependencies = [ - "cfg-if", - "libc", - "r-efi", - "wasi", -] - -[[package]] -name = "globset" -version = "0.4.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54a1028dfc5f5df5da8a56a73e6c153c9a9708ec57232470703592a3f18e49f5" -dependencies = [ - "aho-corasick", - "bstr", - "log", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "globwalk" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf760ebf69878d9fd8f110c89703d90ce35095324d1f1edcb595c63945ee757" -dependencies = [ - "bitflags", - "ignore", - "walkdir", -] - -[[package]] -name = "hashbrown" -version = "0.15.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5971ac85611da7067dbfcabef3c70ebb5606018acd9e2a3903a0da507521e0d5" - -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - -[[package]] -name = "heck" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" - -[[package]] -name = "if_chain" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb56e1aa765b4b4f3aadfab769793b7087bb03a4ea4920644a6d238e2df5b9ed" - -[[package]] -name = "ignore" -version = "0.4.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d89fd380afde86567dfba715db065673989d6253f42b88179abd3eae47bda4b" -dependencies = [ - "crossbeam-deque", - "globset", - "log", - "memchr", - "regex-automata", - "same-file", - "walkdir", - "winapi-util", -] - -[[package]] -name = "im-rc" -version = "15.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af1955a75fa080c677d3972822ec4bad316169ab1cfc6c257a942c2265dbe5fe" -dependencies = [ - "bitmaps", - "rand_core", - "rand_xoshiro", - "sized-chunks", - "typenum", - "version_check", -] - -[[package]] -name = "indexmap" -version = "2.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" -dependencies = [ - "equivalent", - "hashbrown", -] - -[[package]] -name = "itertools" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" -dependencies = [ - "either", -] - -[[package]] -name = "itertools" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" -dependencies = [ - "either", -] - -[[package]] -name = "libc" -version = "0.2.173" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8cfeafaffdbc32176b64fb251369d52ea9f0a8fbc6f8759edffef7b525d64bb" - -[[package]] -name = "linux-raw-sys" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" - -[[package]] -name = "log" -version = "0.4.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" - -[[package]] -name = "memchr" -version = "2.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" - -[[package]] -name = "once_cell" -version = "1.21.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" - -[[package]] -name = "predicates" -version = "3.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d19ee57562043d37e82899fade9a22ebab7be9cef5026b07fda9cdd4293573" -dependencies = [ - "anstyle", - "difflib", - "predicates-core", -] - -[[package]] -name = "predicates-core" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "727e462b119fe9c93fd0eb1429a5f7647394014cf3c04ab2c0350eeb09095ffa" - -[[package]] -name = "predicates-tree" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72dd2d6d381dfb73a193c7fca536518d7caee39fc8503f74e7dc0be0531b425c" -dependencies = [ - "predicates-core", - "termtree", -] - -[[package]] -name = "proc-macro-crate" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" -dependencies = [ - "once_cell", - "toml_edit", -] - -[[package]] -name = "proc-macro2" -version = "1.0.95" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "r-efi" -version = "5.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5" - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" - -[[package]] -name = "rand_xoshiro" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa" -dependencies = [ - "rand_core", -] - -[[package]] -name = "regex" -version = "1.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" - -[[package]] -name = "rustix" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266" -dependencies = [ - "bitflags", - "errno", - "libc", - "linux-raw-sys", - "windows-sys", -] - -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "serde" -version = "1.0.219" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.219" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "sized-chunks" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16d69225bde7a69b235da73377861095455d298f2b970996eec25ddbb42b3d1e" -dependencies = [ - "bitmaps", - "typenum", -] - -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - -[[package]] -name = "syn" -version = "2.0.103" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4307e30089d6fd6aff212f2da3a1f9e32f3223b1f010fb09b7c95f90f3ca1e8" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn-file-expand" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7af40d2da901c8c24077520fbf09848d38ddb4856a83d661892007836489fdb0" -dependencies = [ - "im-rc", - "itertools 0.10.5", - "proc-macro2", - "quote", - "syn", - "thiserror 1.0.69", -] - -[[package]] -name = "tempfile" -version = "3.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8a64e3985349f2441a1a9ef0b853f869006c3855f2cda6862a94d26ebb9d6a1" -dependencies = [ - "fastrand", - "getrandom", - "once_cell", - "rustix", - "windows-sys", -] - -[[package]] -name = "termtree" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f50febec83f5ee1df3015341d8bd429f2d1cc62bcba7ea2076759d315084683" - -[[package]] -name = "thiserror" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" -dependencies = [ - "thiserror-impl 1.0.69", -] - -[[package]] -name = "thiserror" -version = "2.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" -dependencies = [ - "thiserror-impl 2.0.12", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "thiserror-impl" -version = "2.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "toml_datetime" -version = "0.6.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" - -[[package]] -name = "toml_edit" -version = "0.19.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" -dependencies = [ - "indexmap", - "toml_datetime", - "winnow", -] - -[[package]] -name = "typenum" -version = "1.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" - -[[package]] -name = "unicode-ident" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" - -[[package]] -name = "version_check" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" - -[[package]] -name = "walkdir" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" -dependencies = [ - "same-file", - "winapi-util", -] - -[[package]] -name = "wasi" -version = "0.14.2+wasi-0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" -dependencies = [ - "wit-bindgen-rt", -] - -[[package]] -name = "winapi-util" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" -dependencies = [ - "windows-sys", -] - -[[package]] -name = "windows-sys" -version = "0.59.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-targets" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" -dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" - -[[package]] -name = "winnow" -version = "0.5.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" -dependencies = [ - "memchr", -] - -[[package]] -name = "wit-bindgen-rt" -version = "0.39.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" -dependencies = [ - "bitflags", -] diff --git a/contracttrait-macro/Cargo.toml b/contracttrait-macro/Cargo.toml deleted file mode 100644 index 79d3c93..0000000 --- a/contracttrait-macro/Cargo.toml +++ /dev/null @@ -1,34 +0,0 @@ -[package] -name = "contracttrait-macro" -version = "0.8.6" -edition = "2021" -description = "Macros needed by loam-sdk" -license = "Apache-2.0" -repository = "https://github.com/loambuild/loam/tree/main/crates/loam-sdk-macro" - - -[lib] -proc-macro = true - -[dependencies] - -# stellar-xdr = { workspace = true, features = ["curr"] } -# stellar-strkey = { workspace = true } - -# sha2 = { workspace = true } -proc-macro2 = "1.0" -syn = { version = "2", features = ["full", "fold", "extra-traits", "visit"] } -quote = "1.0" -Inflector = { version = "0.11.4", default-features = false, features = [] } -thiserror = "2.0.12" -syn-file-expand = "0.3.0" -# cargo_metadata = { workspace = true } -itertools = "0.14.0" -regex = "1.10.5" -heck = "0.5.0" -deluxe = "0.5.0" - -[dev-dependencies] -assert_fs = "1.0.13" - -# rustfmt = { package = "rustfmt-nightly", git = "https://github.com/rust-lang/rustfmt.git", version = "1.5.1" } diff --git a/contracttrait-macro/README.md b/contracttrait-macro/README.md deleted file mode 100644 index 0220d8c..0000000 --- a/contracttrait-macro/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# loam-sdk-macro - -This crate contains the source for the macros that all subcontracts depend on, such as the `#[subcontract]` macro itself. Rust macros generate code, allowing users to write less. These macros generate the code necessary for all Subcontracts, and do so in a way that makes it easy to author your own Subcontracts. - -`#[subcontract]` is an [attribute procedural macro](https://doc.rust-lang.org/reference/procedural-macros.html#:~:text=Attribute%20macros%20are%20defined%20by,not%20including%20the%20outer%20delimiters.) (proc macro) that you need when you create your own subcontracts. - -Aside from `#[subcontract]`, this crate also contains the implementation for `#[loamstorage]`, an attribute procedural macro that generates the interface for different `Soroban` storage types such as `Persistent`, `Instance`, and `Temporary`. It provides both `Map` and `Store` types for key-value pair storage or singletons. These are accessed via the loam `PersistentMap`, `InstanceMap`, `TemporaryMap`, `PersistentItem`, `InstanceItem`, and `TemporaryItem` types. - -*Deprecated* The crate also contains the implementation for some [derive macros](https://veykril.github.io/tlborm/proc-macros/methodical/derive.html) such as `IntoKey`, which structs in the subcontract need to derive in order to lazily load and store their state on the blockchain. Deprecated in favor of `#[loamstorage]`. - -For more information about how to use and author Subcontracts, see the [loam-sdk README](../loam-sdk/README.md). - -See [lib.rs](src/lib.rs) for the implementations of `subcontract`, `IntoKey`, and other macros. \ No newline at end of file diff --git a/contracttrait-macro/src/args.rs b/contracttrait-macro/src/args.rs deleted file mode 100644 index c92f264..0000000 --- a/contracttrait-macro/src/args.rs +++ /dev/null @@ -1,34 +0,0 @@ -use deluxe::ParseMetaItem; - -use crate::error::Error; - -pub fn parse( - args: proc_macro::TokenStream, - item: proc_macro::TokenStream, -) -> Result<(T, I), Error> { - Ok((deluxe::parse2(args.into())?, syn::parse(item)?)) -} - -#[derive(deluxe::ParseMetaItem, Default)] -pub struct MyTraitMacroArgs { - #[deluxe(default)] - pub default: Option, - #[deluxe(default, rename = extension_required)] - pub ext_required: bool, - #[deluxe(default, rename = is_extension)] - pub is_ext: bool, -} - -#[derive(deluxe::ParseMetaItem)] -pub struct MyMacroArgs { - #[deluxe(rest)] - pub args: std::collections::HashMap, -} - -#[derive(ParseMetaItem)] -pub struct InnerArgs { - #[deluxe(append, rename = ext)] - pub exts: Vec, - #[deluxe(default)] - pub default: Option, -} diff --git a/contracttrait-macro/src/contracttrait.rs b/contracttrait-macro/src/contracttrait.rs deleted file mode 100644 index 5cc9272..0000000 --- a/contracttrait-macro/src/contracttrait.rs +++ /dev/null @@ -1,424 +0,0 @@ -use deluxe::HasAttributes; -use proc_macro2::{Ident, TokenStream}; -use quote::{format_ident, quote, ToTokens}; -use syn::{ - punctuated::Punctuated, Attribute, FnArg, Item, ItemTrait, PatType, Signature, Token, - TraitItem, Type, -}; - -use crate::{ - args::{InnerArgs, MyMacroArgs, MyTraitMacroArgs}, - error::Error, - util::has_attr, -}; - -pub fn generate(args: &MyTraitMacroArgs, item: &Item) -> TokenStream { - inner_generate(args, item).unwrap_or_else(Into::into) -} - -pub fn derive_contract(args: &MyMacroArgs, trait_impls: &Item) -> TokenStream { - derive_contract_inner(args, trait_impls).unwrap_or_else(Into::into) -} - -fn generate_method( - (trait_item, item_trait): (&syn::TraitItem, &syn::ItemTrait), -) -> Option<(Option, TokenStream)> { - let syn::TraitItem::Fn(mut method) = trait_item.clone() else { - return None; - }; - let sig = &method.sig; - let name = &sig.ident; - if sig.receiver().is_some() { - return None; - }; - let args = args_to_idents(&sig.inputs); - let attrs = &method.attrs; - if has_attr(attrs, "internal") { - method.attrs = method - .attrs - .into_iter() - .filter(|attr| !attr.path().is_ident("internal")) - .collect::>(); - let method_stream = if method.default.is_none() { - generate_trait_method(&method, name, &args) - } else { - method.to_token_stream() - }; - return Some((None, method_stream)); - } - Some(( - Some(generate_static_method(item_trait, sig, attrs, name, &args)), - generate_trait_method(&method, name, &args), - )) -} - -pub fn args_to_idents(inputs: &Punctuated) -> Vec<&Ident> { - inputs - .iter() - .filter_map(|arg| { - if let syn::FnArg::Typed(syn::PatType { pat, .. }) = arg { - match &**pat { - syn::Pat::Ident(pat_ident) => Some(&pat_ident.ident), - _ => None, - } - } else { - None - } - }) - .collect::>() -} - -fn generate_static_method( - trait_name: &ItemTrait, - sig: &Signature, - attrs: &[Attribute], - name: &Ident, - args: &[&Ident], -) -> TokenStream { - let trait_name = &trait_name.ident; - let output = &sig.output; - - // Transform inputs and generate call arguments - let (transformed_inputs, call_args): (Vec<_>, Vec<_>) = sig - .inputs - .iter() - .zip(args.iter()) - .filter_map(|(input, arg_name)| { - if let FnArg::Typed(PatType { pat, ty, .. }) = input { - let (new_ty, call_expr) = transform_type_and_call(ty, arg_name); - Some((quote! { #pat: #new_ty }, call_expr)) - } else { - // Skip 'self' parameters - None - } - }) - .unzip(); - - quote! { - #(#attrs)* - pub fn #name(#(#transformed_inputs),*) #output { - <$contract_name as #trait_name>::#name(#(#call_args),*) - } - } -} - -fn transform_type_and_call(ty: &Type, arg_name: &Ident) -> (TokenStream, TokenStream) { - match ty { - // &T -> T, call with &arg - Type::Reference(type_ref) if type_ref.mutability.is_none() => { - let inner_type = &type_ref.elem; - (quote! { #inner_type }, quote! { &#arg_name }) - } - // &mut T -> T, call with &mut arg - Type::Reference(type_ref) if type_ref.mutability.is_some() => { - let inner_type = &type_ref.elem; - (quote! { #inner_type }, quote! { &mut #arg_name }) - } - // Any other type -> keep as is, call with arg - _ => (quote! { #ty }, quote! { #arg_name }), - } -} - -fn generate_trait_method(method: &syn::TraitItemFn, name: &Ident, args: &[&Ident]) -> TokenStream { - let mut method = method.clone(); - method.default = Some(syn::parse_quote! { - { - Self::Impl::#name(#(#args),*) - } - }); - method.to_token_stream() -} - -fn inner_generate( - MyTraitMacroArgs { - default, - ext_required, - is_ext, - }: &MyTraitMacroArgs, - item: &Item, -) -> Result { - let Item::Trait(input_trait) = &item else { - return Err(Error::Stream( - quote! { compile_error!("Input must be a trait"); }, - )); - }; - let (generated_methods, trait_methods): (Vec<_>, Vec<_>) = input_trait - .items - .iter() - .zip(std::iter::repeat(input_trait)) - .filter_map(generate_method) - .unzip(); - - let trait_ident = &input_trait.ident; - let macro_rules_name = trait_ident; - let attrs = input_trait.attrs.as_slice(); - - let mut trait_ = input_trait.clone(); - let mut items = trait_methods - .into_iter() - .map(syn::parse2) - .collect::, _>>()?; - items.insert( - 0, - syn::parse_quote! { - type Impl: #trait_ident; - }, - ); - trait_.items = items; - - let default_impl = default - .clone() - .map_or_else(|| quote! {$contract_name}, |default| quote! {#default}); - - let ensure_default = if default.is_none() { - let message = format!( - "The contract trait `{trait_ident}` does not provide default implementation. \ -One should be passed, e.g. default = MyDefaultImpl" - ); - quote! { - compile_error!(#message); - } - } else { - quote! {} - }; - - let first_case = if *ext_required { - let message = format!( - "The contract trait `{trait_ident}` requires an extension for authentication but none were provided." - ); - quote! { compile_error!(#message); } - } else { - quote! {} - }; - - let extension_type = if *is_ext { - let extension_strukt = format_ident!("{}Ext", trait_ident); - - quote! { - pub struct #extension_strukt( - core::marker::PhantomData, - core::marker::PhantomData, - ); - } - } else { - quote! {} - }; - let docs = input_trait - .attrs() - .iter() - .filter(|attr| attr.path().is_ident("doc")) - .collect::>(); - - let output = quote! { - - #(#attrs)* - #trait_ - #extension_type - #(#docs)* - #[macro_export] - macro_rules! #macro_rules_name { - ($contract_name:ident) => { - #ensure_default - #macro_rules_name!($contract_name, #default_impl); - }; - // Use a single tt to avoid ambiguity, then dispatch - ($contract_name:ident, $($impl_type:tt)+) => { - #macro_rules_name!(@dispatch $contract_name, $($impl_type)+); - }; - // Match normal identifier - (@dispatch $contract_name:ident, $impl_name:ident) => { - #first_case - impl #trait_ident for $contract_name { - type Impl = $impl_name; - } - #[soroban_sdk::contractimpl] - impl $contract_name { - #(#generated_methods)* - } - }; - // Match identifier with generics - (@dispatch $contract_name:ident, $($impl_type:tt)+) => { - impl #trait_ident for $contract_name { - type Impl = $($impl_type)+; - } - #[soroban_sdk::contractimpl] - impl $contract_name { - #(#generated_methods)* - } - }; - () => { - #default_impl - }; - - } - }; - Ok(output) -} - -pub fn derive_contract_inner(args: &MyMacroArgs, trait_impls: &Item) -> Result { - let Item::Struct(strukt) = trait_impls else { - return Err(Error::Stream( - quote! { compile_error!("Input must be a struct"); }, - )); - }; - let strukt_name = &strukt.ident; - let macro_calls = args - .args - .iter() - .map(|(trait_ident, InnerArgs { exts, default })| { - let init = default.as_ref().map_or_else( - || quote! {#trait_ident!()}, - |default| { - quote! {#default } - }, - ); - let default_impl = exts.iter().fold( - init, - |acc, extension| quote! { #extension<#strukt_name, #acc> }, - ); - quote! { - #trait_ident!(#strukt_name, #default_impl); - } - }); - Ok(quote! { - #strukt - #(#macro_calls)* - }) -} - -#[cfg(test)] -mod tests { - - use super::*; - use crate::util::*; - - #[test] - fn first() { - let input: Item = syn::parse_quote! { - pub trait Administratable { - /// Get current admin - fn admin_get(env: Env) -> soroban_sdk::Address; - fn admin_set(env: Env, new_admin: &soroban_sdk::Address); - #[internal] - fn require_auth(env: Env) { - Self::admin_get(env).require_auth(); - } - } - }; - let default = Some(format_ident!("Admin")); - let result: TokenStream = generate( - &MyTraitMacroArgs { - default, - ..Default::default() - }, - &input, - ); - println!("{}", format_snippet(&result.to_string())); - - let output = quote! { - pub trait Administratable { - type Impl: Administratable; - #[doc = r" Get current admin"] - fn admin_get(env: Env) -> soroban_sdk::Address { - Self::Impl::admin_get(env) - } - fn admin_set(env: Env, new_admin: &soroban_sdk::Address) { - Self::Impl::admin_set(env, new_admin) - } - fn require_auth(env: Env) { - Self::admin_get(env).require_auth(); - } - } - #[macro_export] - macro_rules! Administratable { - ($contract_name: ident) => { - Administratable!($contract_name, Admin); - }; - - ($contract_name: ident, $($impl_type: tt)+) => { - Administratable!(@dispatch $contract_name, $($impl_type)+); - }; - - (@dispatch $contract_name: ident, $impl_name: ident) => { - impl Administratable for $contract_name { - type Impl = $impl_name; - } - - #[soroban_sdk::contractimpl] - impl $contract_name { - #[doc = r" Get current admin"] - pub fn admin_get(env: Env) -> soroban_sdk::Address { - < $contract_name as Administratable >::admin_get(env) - } - - pub fn admin_set(env: Env, new_admin: soroban_sdk::Address) { - < $contract_name as Administratable >::admin_set(env, &new_admin) - } - } - }; - - (@dispatch $contract_name: ident, $($impl_type: tt)+) => { - impl Administratable for $contract_name { - type Impl = $($impl_type)+; - } - - #[soroban_sdk::contractimpl] - impl $contract_name { - #[doc = r" Get current admin"] - pub fn admin_get(env: Env) -> soroban_sdk::Address { - < $contract_name as Administratable >::admin_get(env) - } - - pub fn admin_set(env: Env, new_admin: soroban_sdk::Address) { - < $contract_name as Administratable >::admin_set(env, &new_admin) - } - } - }; - - () => { - Admin - }; - } - - - }; - equal_tokens(&output, &result); - } - - #[test] - fn derive() { - let input: Item = syn::parse_quote! { - pub struct Contract; - }; - let args = vec![ - ( - format_ident!("Administratable"), - InnerArgs { - exts: vec![], - default: None, - }, - ), - ( - format_ident!("Upgradable"), - InnerArgs { - exts: vec![format_ident!("AdministratableExt")], - default: None, - }, - ), - ]; - - let result = derive_contract( - &MyMacroArgs { - args: args.into_iter().collect(), - }, - &input, - ); - println!("{}", format_snippet(&result.to_string())); - let output = quote! { - pub struct Contract; - Upgradable ! (Contract , AdministratableExt < Contract , Upgradable ! () >); - Administratable!(Contract, Administratable!()); - }; - equal_tokens(&output, &result); - } -} diff --git a/contracttrait-macro/src/error.rs b/contracttrait-macro/src/error.rs deleted file mode 100644 index 31cc5a5..0000000 --- a/contracttrait-macro/src/error.rs +++ /dev/null @@ -1,18 +0,0 @@ -use proc_macro2::TokenStream; - -#[derive(thiserror::Error, Debug)] -pub enum Error { - #[error("{0}")] - Stream(TokenStream), - #[error(transparent)] - Syn(#[from] syn::Error), -} - -impl From for TokenStream { - fn from(value: Error) -> Self { - match value { - Error::Stream(ts) => ts, - Error::Syn(error) => error.to_compile_error(), - } - } -} diff --git a/contracttrait-macro/src/lib.rs b/contracttrait-macro/src/lib.rs deleted file mode 100644 index 93abb15..0000000 --- a/contracttrait-macro/src/lib.rs +++ /dev/null @@ -1,91 +0,0 @@ -#![recursion_limit = "128"] -extern crate proc_macro; - -use proc_macro::TokenStream; - -mod args; -mod contracttrait; -mod error; -mod util; - -/// # Creates a Contract Trait -/// -/// A contract trait is defines an interface of a contract and declaritive macro with the same name. -/// -/// When writing a soroban contract, you must expose a methods in an implementation with `#[contractimpl]`. -/// This works for implementations of traits, but the implementation must define all methods of the trait. -/// -/// For example, consider the following trait and a default implementation: -/// -/// ```ignore -/// trait Administratable { -/// fn admin(env: &Env) -> Address; -/// fn set_admin(env: &Env, new_admin: &Address); -/// } -/// -/// struct Admin; -/// impl Administratable for Admin { -/// fn admin(env: &Env) -> Address { -/// //... -/// -/// } -/// -/// #[contract] -/// pub struct Contract; -/// #[contractimpl] -/// impl Administratable Contract { -/// fn admin(env: &Env) -> Address { -/// Admin::admin(env) -/// } -/// fn set_admin(env: &Env, new_admin: &Address) { -/// Admin::set_admin(env, new_admin); -/// } -/// } -/// ``` -/// -/// Now this works, but it is not very convenient and is very verbose. -/// One way to make this more convenient is to use an associated type in the trait: -/// -/// ```ignore -/// trait Administratable { -/// type Impl: Administratable; -/// fn admin(env: &Env) -> Address { -/// Self::Impl::admin(env)} -/// } -/// fn set_admin(env: &Env, new_admin: &Address) { -/// Self::Impl::set_admin(env, new_admin); -/// } -/// } -/// ``` -/// -/// -/// # Panics -/// -/// This macro will panic if: -/// - The input `TokenStream` cannot be parsed into a valid Rust item. -/// - The `contracttrait::generate` function fails to generate the companion trait. -/// -#[proc_macro_attribute] -pub fn contracttrait(attr: TokenStream, item: TokenStream) -> TokenStream { - let (parsed_args, parsed) = match args::parse(attr, item) { - Ok((args, item)) => (args, item), - Err(e) => return Into::::into(e).into(), - }; - contracttrait::generate(&parsed_args, &parsed).into() -} - -/// Derives a contract trait for the given Contract struct. -/// -/// ```ignore -/// #[contract] -/// #[derive_contract(Administratable, Upgradable(ext = AdministratableExt))] -/// pub struct Contract; -/// ``` -#[proc_macro_attribute] -pub fn derive_contract(attr: TokenStream, item: TokenStream) -> TokenStream { - let (parsed_args, parsed) = match args::parse(attr, item) { - Ok((args, item)) => (args, item), - Err(e) => return Into::::into(e).into(), - }; - contracttrait::derive_contract(&parsed_args, &parsed).into() -} diff --git a/contracttrait-macro/src/util.rs b/contracttrait-macro/src/util.rs deleted file mode 100644 index 4df9ce7..0000000 --- a/contracttrait-macro/src/util.rs +++ /dev/null @@ -1,42 +0,0 @@ -use proc_macro2::TokenStream; -use std::io::{Read, Write}; - -#[allow(unused)] -pub(crate) fn equal_tokens(expected: &TokenStream, actual: &TokenStream) { - assert_eq!( - format_snippet(&expected.to_string()), - format_snippet(&actual.to_string()) - ); -} - -pub(crate) fn p_e(e: std::io::Error) -> std::io::Error { - eprintln!("{e:#?}"); - e -} - -pub(crate) fn has_attr(attrs: &[syn::Attribute], ident_str: &str) -> bool { - attrs.iter().any(|attr| attr.path().is_ident(ident_str)) -} - - -/// Format the given snippet. The snippet is expected to be *complete* code. -/// When we cannot parse the given snippet, this function returns `None`. -#[allow(unused)] -pub(crate) fn format_snippet(snippet: &str) -> String { - let mut child = std::process::Command::new("rustfmt") - .stdin(std::process::Stdio::piped()) - .stdout(std::process::Stdio::piped()) - .spawn() - .unwrap(); - child - .stdin - .as_mut() - .unwrap() - .write_all(snippet.as_bytes()) - .map_err(p_e) - .unwrap(); - child.wait().unwrap(); - let mut buf = String::new(); - child.stdout.unwrap().read_to_string(&mut buf).unwrap(); - buf -} From 6a0640ad17f214e6292685f4c79fc1b129564f4c Mon Sep 17 00:00:00 2001 From: Willem Wyndham Date: Thu, 31 Jul 2025 13:27:42 -0400 Subject: [PATCH 2/3] chore: clean up --- README.md | 10 ++++------ admin_sep/src/administratable.rs | 6 +++--- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index c167b5e..92f3b70 100644 --- a/README.md +++ b/README.md @@ -54,16 +54,14 @@ Note that it is required to call `set_admin` in the `__constructor`. ## Other Considerations -OpenZeppelin provide an alternative `Ownable` trait. It uses `owner` instead of `admin` and provides the addiontional option of accepting or rejecting being the new admin. However, this same functionality could be acheived by the new admin setting the original admin. -Furthermore, given the prior art of the SAC's admin interface it makes sense to continue with this naming convention and given the foundational nature of the admin interface it should aim to be as minial as possible. +OpenZeppelin provides an alternative: the `Ownable` trait. It uses `owner` instead of `admin` and provides the addiontional option of accepting or rejecting being the new owner. However, this same functionality could be acheived by the new admin setting the original admin. +Furthermore, given the prior art of the SAC's admin interface it makes sense to continue with this naming convention and the foundational nature of the admin interface means it should aim to be as minimal as possible. ## Implementations -Given the foundational aspect of this proposal, included is an implementation which uses with the proposed `contracttrait` macro to make it easy to add the trait to your contract. +The provided [admin-sep](https://github.com/ahalabs/admin-sep) implementation which uses with the proposed `contracttrait` macro to make it easy to add the trait and its functionality to your contract with little boilerplate. -- [admin-sep](https://github.com/ahalabs/admin-sep) - ```rust use soroban_sdk::{Address, Env, contract, contractimpl, contracttrait}; use admin_sep::{Administratable, Upgradable}; @@ -98,4 +96,4 @@ pub trait Upgradable: Administratable { ## Future Considerations -A simple macro could then be used to indicate where or not the method requires elevated permissions; it could also put a comment indicating the access control allowing downstream tooling to filter just normal user methods. +A simple macro could then be used to indicate where or not the method requires elevated permissions; it could also put into the comments indicating the access control allowing downstream tooling to filter normal user methods. diff --git a/admin_sep/src/administratable.rs b/admin_sep/src/administratable.rs index 9c88873..2fb4c4c 100644 --- a/admin_sep/src/administratable.rs +++ b/admin_sep/src/administratable.rs @@ -12,10 +12,10 @@ pub trait Administratable { } } -pub const STORAGE_KEY: Symbol = symbol_short!("ADMIN"); +pub const STORAGE_KEY: &Symbol = &symbol_short!("ADMIN"); pub fn get(env: &Env) -> Option
{ - env.storage().instance().get(&STORAGE_KEY) + env.storage().instance().get(STORAGE_KEY) } pub struct Admin; @@ -29,6 +29,6 @@ impl Administratable for Admin { if let Some(owner) = get(env) { owner.require_auth(); } - env.storage().instance().set(&STORAGE_KEY, &new_admin); + env.storage().instance().set(STORAGE_KEY, &new_admin); } } From aaafd4e6ff1b2c29b6935df81011418a46d86b13 Mon Sep 17 00:00:00 2001 From: Willem Wyndham Date: Mon, 18 Aug 2025 12:46:24 -0400 Subject: [PATCH 3/3] feat: show upgrade --- Cargo.lock | 21 +++++++++--------- Cargo.toml | 2 +- Makefile | 3 ++- README.md | 4 ++-- admin/Cargo.toml | 2 +- admin/Makefile | 5 ++--- admin/src/lib.rs | 8 +++---- admin/src/test.rs | 5 +---- admin_sep/Makefile | 17 -------------- admin_sep/src/administratable.rs | 38 ++++++++++++++------------------ admin_sep/src/upgradable.rs | 7 +++--- admin_v2/Cargo.toml | 1 + admin_v2/Makefile | 5 ++--- admin_v2/src/lib.rs | 13 +++++++---- 14 files changed, 56 insertions(+), 75 deletions(-) delete mode 100644 admin_sep/Makefile diff --git a/Cargo.lock b/Cargo.lock index 8d5493f..fe49795 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -545,6 +545,7 @@ version = "0.0.0" dependencies = [ "admin-sep", "soroban-sdk", + "stellar-strkey", ] [[package]] @@ -1262,8 +1263,8 @@ dependencies = [ [[package]] name = "soroban-ledger-snapshot" -version = "23.0.0-rc.2.3" -source = "git+https://github.com/ahalabs/rs-soroban-sdk?rev=4bdd847e386c8d8256ce7afef2b684899d3f189c#4bdd847e386c8d8256ce7afef2b684899d3f189c" +version = "23.0.0-rc.2.4" +source = "git+https://github.com/ahalabs/rs-soroban-sdk?rev=5a99659f1483c926ff87ea45f8823b8c00dc4cbd#5a99659f1483c926ff87ea45f8823b8c00dc4cbd" dependencies = [ "serde", "serde_json", @@ -1275,8 +1276,8 @@ dependencies = [ [[package]] name = "soroban-sdk" -version = "23.0.0-rc.2.3" -source = "git+https://github.com/ahalabs/rs-soroban-sdk?rev=4bdd847e386c8d8256ce7afef2b684899d3f189c#4bdd847e386c8d8256ce7afef2b684899d3f189c" +version = "23.0.0-rc.2.4" +source = "git+https://github.com/ahalabs/rs-soroban-sdk?rev=5a99659f1483c926ff87ea45f8823b8c00dc4cbd#5a99659f1483c926ff87ea45f8823b8c00dc4cbd" dependencies = [ "arbitrary", "bytes-lit", @@ -1297,8 +1298,8 @@ dependencies = [ [[package]] name = "soroban-sdk-macros" -version = "23.0.0-rc.2.3" -source = "git+https://github.com/ahalabs/rs-soroban-sdk?rev=4bdd847e386c8d8256ce7afef2b684899d3f189c#4bdd847e386c8d8256ce7afef2b684899d3f189c" +version = "23.0.0-rc.2.4" +source = "git+https://github.com/ahalabs/rs-soroban-sdk?rev=5a99659f1483c926ff87ea45f8823b8c00dc4cbd#5a99659f1483c926ff87ea45f8823b8c00dc4cbd" dependencies = [ "darling", "heck", @@ -1316,8 +1317,8 @@ dependencies = [ [[package]] name = "soroban-spec" -version = "23.0.0-rc.2.3" -source = "git+https://github.com/ahalabs/rs-soroban-sdk?rev=4bdd847e386c8d8256ce7afef2b684899d3f189c#4bdd847e386c8d8256ce7afef2b684899d3f189c" +version = "23.0.0-rc.2.4" +source = "git+https://github.com/ahalabs/rs-soroban-sdk?rev=5a99659f1483c926ff87ea45f8823b8c00dc4cbd#5a99659f1483c926ff87ea45f8823b8c00dc4cbd" dependencies = [ "base64", "stellar-xdr", @@ -1327,8 +1328,8 @@ dependencies = [ [[package]] name = "soroban-spec-rust" -version = "23.0.0-rc.2.3" -source = "git+https://github.com/ahalabs/rs-soroban-sdk?rev=4bdd847e386c8d8256ce7afef2b684899d3f189c#4bdd847e386c8d8256ce7afef2b684899d3f189c" +version = "23.0.0-rc.2.4" +source = "git+https://github.com/ahalabs/rs-soroban-sdk?rev=5a99659f1483c926ff87ea45f8823b8c00dc4cbd#5a99659f1483c926ff87ea45f8823b8c00dc4cbd" dependencies = [ "prettyplease", "proc-macro2", diff --git a/Cargo.toml b/Cargo.toml index 86c7948..ef30664 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ resolver = "2" members = ["admin_sep", "admin", "admin_v2"] [workspace.dependencies] -soroban-sdk = { git = "https://github.com/ahalabs/rs-soroban-sdk", rev = "4bdd847e386c8d8256ce7afef2b684899d3f189c" } +soroban-sdk = { git = "https://github.com/ahalabs/rs-soroban-sdk", rev = "5a99659f1483c926ff87ea45f8823b8c00dc4cbd" } [profile.contracts] inherits = "release" diff --git a/Makefile b/Makefile index b925409..627d731 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,7 @@ build: @for dir in $(SUBDIRS) ; do \ $(MAKE) -C $$dir build || exit 1; \ done + @ls -l target/stellar/*.wasm test: build @for dir in $(SUBDIRS) ; do \ @@ -23,4 +24,4 @@ fmt: clean: @for dir in $(SUBDIRS) ; do \ $(MAKE) -C $$dir clean || exit 1; \ - done \ No newline at end of file + done diff --git a/README.md b/README.md index 92f3b70..7cc02b6 100644 --- a/README.md +++ b/README.md @@ -76,10 +76,10 @@ impl Contract { } } -#[contracttrait] +#[contractimpl] impl Administratable for Contract {} -#[contracttrait] +#[contractimpl] impl Upgradable for Contract {} ``` diff --git a/admin/Cargo.toml b/admin/Cargo.toml index ae1ae5f..3acac50 100644 --- a/admin/Cargo.toml +++ b/admin/Cargo.toml @@ -10,7 +10,7 @@ crate-type = ["cdylib"] doctest = false [dependencies] -soroban-sdk = { workspace = true} +soroban-sdk = { workspace = true } admin-sep = { path = "../admin_sep" } [dev-dependencies] diff --git a/admin/Makefile b/admin/Makefile index c266f2e..0a79393 100644 --- a/admin/Makefile +++ b/admin/Makefile @@ -6,9 +6,8 @@ test: build cargo test build: - stellar contract build --out-dir target/stellar - stellar contract optimize --wasm target/stellar/soroban_admin_contract.wasm --wasm-out target/stellar/soroban_admin_contract.wasm - @ls -l target/stellar/*.wasm + stellar contract build --out-dir ../target/stellar + stellar contract optimize --wasm ../target/stellar/example_admin_contract.wasm --wasm-out ../target/stellar/example_admin_contract.wasm fmt: cargo fmt --all diff --git a/admin/src/lib.rs b/admin/src/lib.rs index 654c0bf..14ea2dc 100644 --- a/admin/src/lib.rs +++ b/admin/src/lib.rs @@ -1,22 +1,22 @@ #![no_std] use admin_sep::{Administratable, Upgradable}; -use soroban_sdk::{Address, Env, contract, contractimpl, contracttrait}; +use soroban_sdk::{Address, Env, contract, contractimpl}; #[contract] pub struct Contract; #[contractimpl] impl Contract { - pub fn __construct(env: &Env, admin: Address) { + pub fn __constructor(env: &Env, admin: &Address) { Self::set_admin(env, admin); } } -#[contracttrait] +#[contractimpl] impl Administratable for Contract {} -#[contracttrait] +#[contractimpl] impl Upgradable for Contract {} mod test; diff --git a/admin/src/test.rs b/admin/src/test.rs index 59d3304..25bf0d3 100644 --- a/admin/src/test.rs +++ b/admin/src/test.rs @@ -9,8 +9,5 @@ fn test() { let admin = Address::generate(&env); let contract_id = env.register(Contract, (admin.clone(),)); let _client = ContractClient::new(&env, &contract_id); - - // assert_eq!(client.increment(), 2); - // assert_eq!(client.increment(), 3); - // assert_eq!(client.increment(), 4); + assert_eq!(_client.admin(), admin); } diff --git a/admin_sep/Makefile b/admin_sep/Makefile deleted file mode 100644 index c266f2e..0000000 --- a/admin_sep/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -default: build - -all: test - -test: build - cargo test - -build: - stellar contract build --out-dir target/stellar - stellar contract optimize --wasm target/stellar/soroban_admin_contract.wasm --wasm-out target/stellar/soroban_admin_contract.wasm - @ls -l target/stellar/*.wasm - -fmt: - cargo fmt --all - -clean: - cargo clean diff --git a/admin_sep/src/administratable.rs b/admin_sep/src/administratable.rs index 2fb4c4c..ef1d248 100644 --- a/admin_sep/src/administratable.rs +++ b/admin_sep/src/administratable.rs @@ -1,34 +1,28 @@ use soroban_sdk::{Address, Env, Symbol, contracttrait, symbol_short}; /// Trait for using an admin address to control access. -#[contracttrait(default = Admin)] +#[contracttrait] pub trait Administratable { - fn admin(env: &Env) -> soroban_sdk::Address; - fn set_admin(env: &Env, new_admin: soroban_sdk::Address); + fn admin(env: &Env) -> soroban_sdk::Address { + unsafe { Self::admin_from_storage(env).unwrap_unchecked() } + } + + fn set_admin(env: &Env, new_admin: &soroban_sdk::Address) { + if let Some(owner) = Self::admin_from_storage(env) { + owner.require_auth(); + } + env.storage().instance().set(STORAGE_KEY, new_admin); + } #[internal] fn require_admin(env: &Env) { Self::admin(env).require_auth(); } -} -pub const STORAGE_KEY: &Symbol = &symbol_short!("ADMIN"); - -pub fn get(env: &Env) -> Option
{ - env.storage().instance().get(STORAGE_KEY) -} - -pub struct Admin; - -impl Administratable for Admin { - type Impl = Self; - fn admin(env: &Env) -> soroban_sdk::Address { - unsafe { get(env).unwrap_unchecked() } - } - fn set_admin(env: &Env, new_admin: soroban_sdk::Address) { - if let Some(owner) = get(env) { - owner.require_auth(); - } - env.storage().instance().set(STORAGE_KEY, &new_admin); + #[internal] + fn admin_from_storage(env: &Env) -> Option
{ + env.storage().instance().get(STORAGE_KEY) } } + +pub const STORAGE_KEY: &Symbol = &symbol_short!("ADMIN"); diff --git a/admin_sep/src/upgradable.rs b/admin_sep/src/upgradable.rs index da4c90c..92d4f90 100644 --- a/admin_sep/src/upgradable.rs +++ b/admin_sep/src/upgradable.rs @@ -1,9 +1,10 @@ +use crate::Administratable; use soroban_sdk::contracttrait; -use crate::administratable::Administratable; - -#[contracttrait(no_impl = true)] +#[contracttrait] pub trait Upgradable: Administratable { + /// Upgrades the contract to a new hash. + /// Admin Only. fn upgrade(env: &soroban_sdk::Env, wasm_hash: soroban_sdk::BytesN<32>) { Self::require_admin(env); env.deployer().update_current_contract_wasm(wasm_hash); diff --git a/admin_v2/Cargo.toml b/admin_v2/Cargo.toml index 682501d..dbd3e25 100644 --- a/admin_v2/Cargo.toml +++ b/admin_v2/Cargo.toml @@ -11,6 +11,7 @@ doctest = false [dependencies] soroban-sdk = { workspace = true } +stellar-strkey = "0.0.13" admin-sep = { path = "../admin_sep" } [dev-dependencies] diff --git a/admin_v2/Makefile b/admin_v2/Makefile index c266f2e..6dfa220 100644 --- a/admin_v2/Makefile +++ b/admin_v2/Makefile @@ -6,9 +6,8 @@ test: build cargo test build: - stellar contract build --out-dir target/stellar - stellar contract optimize --wasm target/stellar/soroban_admin_contract.wasm --wasm-out target/stellar/soroban_admin_contract.wasm - @ls -l target/stellar/*.wasm + stellar contract build --out-dir ../target/stellar + stellar contract optimize --wasm ../target/stellar/example_admin_contract_v2.wasm --wasm-out ../target/stellar/example_admin_contract_v2.wasm fmt: cargo fmt --all diff --git a/admin_v2/src/lib.rs b/admin_v2/src/lib.rs index 654c0bf..9282074 100644 --- a/admin_v2/src/lib.rs +++ b/admin_v2/src/lib.rs @@ -1,22 +1,27 @@ #![no_std] +use soroban_sdk::{Address, Env, contract, contractimpl}; + use admin_sep::{Administratable, Upgradable}; -use soroban_sdk::{Address, Env, contract, contractimpl, contracttrait}; #[contract] pub struct Contract; #[contractimpl] impl Contract { - pub fn __construct(env: &Env, admin: Address) { + pub fn __constructor(env: &Env, admin: &Address) { Self::set_admin(env, admin); } + + pub fn new_method(env: &Env) { + Self::require_admin(env); + } } -#[contracttrait] +#[contractimpl] impl Administratable for Contract {} -#[contracttrait] +#[contractimpl] impl Upgradable for Contract {} mod test;