diff --git a/.env b/.env new file mode 100644 index 0000000..c0c1eeb --- /dev/null +++ b/.env @@ -0,0 +1 @@ +REMOTE_NODENAME=https://thornode.ninerealms.com diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 0000000..31000a2 --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,22 @@ +name: Rust + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Build + run: cargo build --verbose + - name: Run tests + run: cargo test --verbose diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..9cdb059 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,1182 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "addr2line" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4fa78e18c64fce05e902adecd7a5eed15a5e0a3439f7b0e169f0252214865e3" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "backtrace" +version = "0.3.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4319208da049c43661739c5fade2ba182f09d1dc2299b32298d3a31692b17e12" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + +[[package]] +name = "base64" +version = "0.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" + +[[package]] +name = "bumpalo" +version = "3.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" + +[[package]] +name = "bytes" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" + +[[package]] +name = "cc" +version = "1.0.82" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "305fe645edc1442a0fa8b6726ba61d422798d37a52e12eaecf4b022ebbb88f01" +dependencies = [ + "libc", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "core-foundation" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" + +[[package]] +name = "dotenv" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" + +[[package]] +name = "encoding_rs" +version = "0.8.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "errno" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b30f669a7961ef1631673d2766cc92f52d64f7ef354d4fe0ddfd30ed52f0f4f" +dependencies = [ + "errno-dragonfly", + "libc", + "windows-sys", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "fastrand" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "form_urlencoded" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures-channel" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" + +[[package]] +name = "futures-sink" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" + +[[package]] +name = "futures-task" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" + +[[package]] +name = "futures-util" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +dependencies = [ + "futures-core", + "futures-task", + "pin-project-lite", + "pin-utils", +] + +[[package]] +name = "gimli" +version = "0.27.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" + +[[package]] +name = "h2" +version = "0.3.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97ec8491ebaf99c8eaa73058b045fe58073cd6be7f596ac993ced0b0a0c01049" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hermit-abi" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" + +[[package]] +name = "http" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hyper" +version = "0.14.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2 0.4.9", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-tls" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +dependencies = [ + "bytes", + "hyper", + "native-tls", + "tokio", + "tokio-native-tls", +] + +[[package]] +name = "idna" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown", +] + +[[package]] +name = "ipnet" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" + +[[package]] +name = "itoa" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" + +[[package]] +name = "js-sys" +version = "0.3.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.147" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" + +[[package]] +name = "linux-raw-sys" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" + +[[package]] +name = "lock_api" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" + +[[package]] +name = "memchr" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "mime_guess" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef" +dependencies = [ + "mime", + "unicase", +] + +[[package]] +name = "miniz_oxide" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +dependencies = [ + "adler", +] + +[[package]] +name = "mio" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" +dependencies = [ + "libc", + "wasi", + "windows-sys", +] + +[[package]] +name = "native-tls" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" +dependencies = [ + "lazy_static", + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "object" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8bda667d9f2b5051b8833f59f3bf748b28ef54f850f4fcb389a252aa383866d1" +dependencies = [ + "memchr", +] + +[[package]] +name = "odin" +version = "0.1.0" +dependencies = [ + "thorchain_rs", + "tokio", +] + +[[package]] +name = "odin-cli" +version = "0.1.0" + +[[package]] +name = "once_cell" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" + +[[package]] +name = "openssl" +version = "0.10.56" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "729b745ad4a5575dd06a3e1af1414bd330ee561c01b3899eb584baeaa8def17e" +dependencies = [ + "bitflags 1.3.2", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "openssl-sys" +version = "0.9.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "866b5f16f90776b9bb8dc1e1802ac6f0513de3a7a7465867bfbc563dc737faac" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets", +] + +[[package]] +name = "percent-encoding" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" + +[[package]] +name = "pin-project-lite" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12cc1b0bf1727a77a54b6654e7b5f1af8604923edc8b81885f8ec92f9e3f0a05" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkg-config" +version = "0.3.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" + +[[package]] +name = "proc-macro2" +version = "1.0.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "redox_syscall" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "reqwest" +version = "0.11.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cde824a14b7c14f85caff81225f411faacc04a2013f41670f41443742b1c1c55" +dependencies = [ + "base64", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-tls", + "ipnet", + "js-sys", + "log", + "mime", + "mime_guess", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "serde", + "serde_json", + "serde_urlencoded", + "tokio", + "tokio-native-tls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "winreg", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" + +[[package]] +name = "rustix" +version = "0.38.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ed4fa021d81c8392ce04db050a3da9a60299050b7ae1cf482d862b54a7218f" +dependencies = [ + "bitflags 2.4.0", + "errno", + "libc", + "linux-raw-sys", + "windows-sys", +] + +[[package]] +name = "ryu" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" + +[[package]] +name = "schannel" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "security-framework" +version = "2.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "serde" +version = "1.0.183" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32ac8da02677876d532745a130fc9d8e6edfa81a269b107c5b00829b91d8eb3c" + +[[package]] +name = "serde_derive" +version = "1.0.183" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aafe972d60b0b9bee71a91b92fee2d4fb3c9d7e8f6b179aa99f27203d99a4816" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.105" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "signal-hook-registry" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" +dependencies = [ + "libc", +] + +[[package]] +name = "slab" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" +dependencies = [ + "autocfg", +] + +[[package]] +name = "smallvec" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" + +[[package]] +name = "socket2" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "socket2" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "syn" +version = "2.0.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tempfile" +version = "3.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" +dependencies = [ + "cfg-if", + "fastrand", + "redox_syscall", + "rustix", + "windows-sys", +] + +[[package]] +name = "thorchain_rs" +version = "1.119.0" +dependencies = [ + "dotenv", + "reqwest", + "serde", + "serde_derive", + "serde_json", + "url", + "uuid", +] + +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17ed6077ed6cd6c74735e21f37eb16dc3935f96878b1fe961074089cc80893f9" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "num_cpus", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2 0.5.3", + "tokio-macros", + "windows-sys", +] + +[[package]] +name = "tokio-macros" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", +] + +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + +[[package]] +name = "tracing" +version = "0.1.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +dependencies = [ + "cfg-if", + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" + +[[package]] +name = "unicase" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" +dependencies = [ + "version_check", +] + +[[package]] +name = "unicode-bidi" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" + +[[package]] +name = "unicode-ident" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" + +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "url" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "uuid" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79daa5ed5740825c40b389c5e50312b9c86df53fccd33f281df655642b43869d" +dependencies = [ + "serde", +] + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[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.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" + +[[package]] +name = "web-sys" +version = "0.3.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "winreg" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" +dependencies = [ + "winapi", +] diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..eae00fe --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,3 @@ +[workspace] +members = ["thorchain-rs", "odin", "odin-cli"] +default-members = ["odin"] diff --git a/makefile b/makefile new file mode 100644 index 0000000..4df7d9d --- /dev/null +++ b/makefile @@ -0,0 +1,5 @@ +gen: + openapi-generator generate -g rust \ + -i https://thornode.ninerealms.com/thorchain/doc/openapi.yaml \ + -o thorchain-rust \ + --additional-properties=useSingleRequestParameter=true diff --git a/odin-cli/Cargo.toml b/odin-cli/Cargo.toml new file mode 100644 index 0000000..616d1cb --- /dev/null +++ b/odin-cli/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "odin-cli" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/odin-cli/src/main.rs b/odin-cli/src/main.rs new file mode 100644 index 0000000..e7a11a9 --- /dev/null +++ b/odin-cli/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +} diff --git a/odin/Cargo.toml b/odin/Cargo.toml new file mode 100644 index 0000000..0a9069b --- /dev/null +++ b/odin/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "odin" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +tokio = { version = "*", features = ["full"] } +thorchain_rs = { path = "../thorchain-rs" } diff --git a/odin/src/main.rs b/odin/src/main.rs new file mode 100644 index 0000000..9b0b4ce --- /dev/null +++ b/odin/src/main.rs @@ -0,0 +1,32 @@ +use state::State; +use std::sync::Arc; +use tokio::sync::oneshot; +use tokio::sync::Mutex; + +mod state; + +#[tokio::main] +async fn main() { + let state = Arc::new(Mutex::new(state::State::new())); + + let (_tx, rx) = oneshot::channel::<()>(); + + spawn_churn_checks(state.clone()).await; + + println!("Obin is watching..."); + + let _ = rx.await; +} + +async fn spawn_churn_checks(state: Arc>) -> tokio::task::JoinHandle<()> { + tokio::spawn(async move { + loop { + let mut state = state.lock().await; + state.update_churn_interval().await; + state.update_vaults().await; + let seconds = state.seconds_to_churn().await; + println!("{} seconds before next churn checks", seconds); + tokio::time::sleep(tokio::time::Duration::from_secs(seconds)).await; + } + }) +} diff --git a/odin/src/state.rs b/odin/src/state.rs new file mode 100644 index 0000000..7911ed4 --- /dev/null +++ b/odin/src/state.rs @@ -0,0 +1,59 @@ +use thorchain_rs::apis::configuration::Configuration; +use thorchain_rs::apis::mimir_api; +use thorchain_rs::apis::mimir_api::MimirKeyParams; +use thorchain_rs::apis::vaults_api::{asgard, AsgardParams}; + +const CHURN_MAX_RANGE: u64 = 43200; +const AVG_BLOCKSPEED: u64 = 6; + +pub struct State { + churn_interval: Option, + vaults: Vec, + config: Configuration, +} + +impl State { + pub fn new() -> Self { + Self { + churn_interval: None, + vaults: Vec::new(), + config: Configuration::default(), + } + } + + pub async fn update_churn_interval(&mut self) { + let params = MimirKeyParams { + key: "CHURNINTERVAL".to_string(), + height: None, + }; + + let churn_interval = mimir_api::mimir_key(&self.config, params).await.unwrap(); + + self.churn_interval = Some(churn_interval as u64); + } + + pub fn churn_interval(&self) -> Option { + self.churn_interval + } + + pub async fn update_vaults(&mut self) { + let asgard_params = AsgardParams::default(); + + let vaults = asgard(&self.config, asgard_params).await.unwrap(); + + self.vaults = vaults; + } + + pub fn vaults(&self) -> Vec { + self.vaults.clone() + } + + pub fn print_vaults(&self) { + println!("{:#?}", self.vaults); + } + + pub async fn seconds_to_churn(&self) -> u64 { + // TODO add check for above upper range. ie churn paused. + (self.churn_interval.unwrap() * AVG_BLOCKSPEED) / 2 + } +} diff --git a/thorchain-rs/.gitignore b/thorchain-rs/.gitignore new file mode 100644 index 0000000..6aa1064 --- /dev/null +++ b/thorchain-rs/.gitignore @@ -0,0 +1,3 @@ +/target/ +**/*.rs.bk +Cargo.lock diff --git a/thorchain-rs/.openapi-generator-ignore b/thorchain-rs/.openapi-generator-ignore new file mode 100644 index 0000000..7484ee5 --- /dev/null +++ b/thorchain-rs/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/thorchain-rs/.openapi-generator/FILES b/thorchain-rs/.openapi-generator/FILES new file mode 100644 index 0000000..805096e --- /dev/null +++ b/thorchain-rs/.openapi-generator/FILES @@ -0,0 +1,178 @@ +.gitignore +.openapi-generator-ignore +.travis.yml +Cargo.toml +README.md +docs/BanResponse.md +docs/BaseQuoteResponse.md +docs/Borrower.md +docs/BorrowersApi.md +docs/ChainHeight.md +docs/Coin.md +docs/ConstantsResponse.md +docs/HealthApi.md +docs/InboundAddress.md +docs/InvariantResponse.md +docs/InvariantsApi.md +docs/InvariantsResponse.md +docs/KeygenMetric.md +docs/KeysignInfo.md +docs/KeysignMetrics.md +docs/KeysignResponse.md +docs/LastBlock.md +docs/LiquidityProvider.md +docs/LiquidityProviderSummary.md +docs/LiquidityProvidersApi.md +docs/MetricsResponse.md +docs/MimirApi.md +docs/MimirNodesResponse.md +docs/MimirVote.md +docs/MsgSwap.md +docs/NetworkApi.md +docs/NetworkResponse.md +docs/Node.md +docs/NodeBondProvider.md +docs/NodeBondProviders.md +docs/NodeJail.md +docs/NodeKeygenMetric.md +docs/NodePreflightStatus.md +docs/NodePubKeySet.md +docs/NodesApi.md +docs/ObservedTx.md +docs/Ping.md +docs/PolApi.md +docs/PolResponse.md +docs/Pool.md +docs/PoolsApi.md +docs/QueueApi.md +docs/QueueResponse.md +docs/QuoteApi.md +docs/QuoteFees.md +docs/QuoteLoanCloseResponse.md +docs/QuoteLoanOpenResponse.md +docs/QuoteSaverDepositResponse.md +docs/QuoteSaverWithdrawResponse.md +docs/QuoteSwapResponse.md +docs/Saver.md +docs/SaversApi.md +docs/StreamingSwap.md +docs/StreamingSwapApi.md +docs/Thorname.md +docs/ThornameAlias.md +docs/ThornamesApi.md +docs/TransactionsApi.md +docs/TssApi.md +docs/TssKeysignMetric.md +docs/TssMetric.md +docs/Tx.md +docs/TxDetailsResponse.md +docs/TxOutItem.md +docs/TxResponse.md +docs/TxSignersResponse.md +docs/TxStagesResponse.md +docs/TxStagesResponseInboundConfirmationCounted.md +docs/TxStagesResponseInboundFinalised.md +docs/TxStagesResponseInboundObserved.md +docs/TxStagesResponseOutboundDelay.md +docs/TxStagesResponseOutboundSigned.md +docs/TxStagesResponseSwapFinalised.md +docs/TxStagesResponseSwapStatus.md +docs/TxStagesResponseSwapStatusStreaming.md +docs/TxStatusResponse.md +docs/TxStatusResponsePlannedOutTxsInner.md +docs/Vault.md +docs/VaultAddress.md +docs/VaultInfo.md +docs/VaultPubkeysResponse.md +docs/VaultRouter.md +docs/VaultsApi.md +docs/VersionResponse.md +git_push.sh +src/apis/borrowers_api.rs +src/apis/configuration.rs +src/apis/health_api.rs +src/apis/invariants_api.rs +src/apis/liquidity_providers_api.rs +src/apis/mimir_api.rs +src/apis/mod.rs +src/apis/network_api.rs +src/apis/nodes_api.rs +src/apis/pol_api.rs +src/apis/pools_api.rs +src/apis/queue_api.rs +src/apis/quote_api.rs +src/apis/savers_api.rs +src/apis/streaming_swap_api.rs +src/apis/thornames_api.rs +src/apis/transactions_api.rs +src/apis/tss_api.rs +src/apis/vaults_api.rs +src/lib.rs +src/models/ban_response.rs +src/models/base_quote_response.rs +src/models/borrower.rs +src/models/chain_height.rs +src/models/coin.rs +src/models/constants_response.rs +src/models/inbound_address.rs +src/models/invariant_response.rs +src/models/invariants_response.rs +src/models/keygen_metric.rs +src/models/keysign_info.rs +src/models/keysign_metrics.rs +src/models/keysign_response.rs +src/models/last_block.rs +src/models/liquidity_provider.rs +src/models/liquidity_provider_summary.rs +src/models/metrics_response.rs +src/models/mimir_nodes_response.rs +src/models/mimir_vote.rs +src/models/mod.rs +src/models/msg_swap.rs +src/models/network_response.rs +src/models/node.rs +src/models/node_bond_provider.rs +src/models/node_bond_providers.rs +src/models/node_jail.rs +src/models/node_keygen_metric.rs +src/models/node_preflight_status.rs +src/models/node_pub_key_set.rs +src/models/observed_tx.rs +src/models/ping.rs +src/models/pol_response.rs +src/models/pool.rs +src/models/queue_response.rs +src/models/quote_fees.rs +src/models/quote_loan_close_response.rs +src/models/quote_loan_open_response.rs +src/models/quote_saver_deposit_response.rs +src/models/quote_saver_withdraw_response.rs +src/models/quote_swap_response.rs +src/models/saver.rs +src/models/streaming_swap.rs +src/models/thorname.rs +src/models/thorname_alias.rs +src/models/tss_keysign_metric.rs +src/models/tss_metric.rs +src/models/tx.rs +src/models/tx_details_response.rs +src/models/tx_out_item.rs +src/models/tx_response.rs +src/models/tx_signers_response.rs +src/models/tx_stages_response.rs +src/models/tx_stages_response_inbound_confirmation_counted.rs +src/models/tx_stages_response_inbound_finalised.rs +src/models/tx_stages_response_inbound_observed.rs +src/models/tx_stages_response_outbound_delay.rs +src/models/tx_stages_response_outbound_signed.rs +src/models/tx_stages_response_swap_finalised.rs +src/models/tx_stages_response_swap_status.rs +src/models/tx_stages_response_swap_status_streaming.rs +src/models/tx_status_response.rs +src/models/tx_status_response_planned_out_txs_inner.rs +src/models/vault.rs +src/models/vault_address.rs +src/models/vault_info.rs +src/models/vault_pubkeys_response.rs +src/models/vault_router.rs +src/models/version_response.rs diff --git a/thorchain-rs/.openapi-generator/VERSION b/thorchain-rs/.openapi-generator/VERSION new file mode 100644 index 0000000..cd802a1 --- /dev/null +++ b/thorchain-rs/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.6.0 \ No newline at end of file diff --git a/thorchain-rs/.travis.yml b/thorchain-rs/.travis.yml new file mode 100644 index 0000000..22761ba --- /dev/null +++ b/thorchain-rs/.travis.yml @@ -0,0 +1 @@ +language: rust diff --git a/thorchain-rs/Cargo.toml b/thorchain-rs/Cargo.toml new file mode 100644 index 0000000..5545c9f --- /dev/null +++ b/thorchain-rs/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "thorchain_rs" +version = "1.119.0" +authors = ["devs@thorchain.org"] +description = "Thornode REST API." +# Override this license by providing a License Object in the OpenAPI. +license = "Unlicense" +edition = "2018" + +[dependencies] +dotenv = "0.15.0" +serde = "^1.0" +serde_derive = "^1.0" +serde_json = "^1.0" +url = "^2.2" +uuid = { version = "^1.0", features = ["serde"] } +[dependencies.reqwest] +version = "^0.11" +features = ["json", "multipart"] diff --git a/thorchain-rs/README.md b/thorchain-rs/README.md new file mode 100644 index 0000000..29c0d1a --- /dev/null +++ b/thorchain-rs/README.md @@ -0,0 +1,160 @@ +# Rust API client for openapi + +Thornode REST API. + + +## Overview + +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://openapis.org) from a remote server, you can easily generate an API client. + +- API version: 1.119.0 +- Package version: 1.119.0 +- Build package: `org.openapitools.codegen.languages.RustClientCodegen` + +## Installation + +Put the package under your project folder in a directory named `openapi` and add the following to `Cargo.toml` under `[dependencies]`: + +``` +openapi = { path = "./openapi" } +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://localhost* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*BorrowersApi* | [**borrower**](docs/BorrowersApi.md#borrower) | **GET** /thorchain/pool/{asset}/borrower/{address} | +*BorrowersApi* | [**borrowers**](docs/BorrowersApi.md#borrowers) | **GET** /thorchain/pool/{asset}/borrowers | +*HealthApi* | [**ping**](docs/HealthApi.md#ping) | **GET** /thorchain/ping | +*InvariantsApi* | [**invariant**](docs/InvariantsApi.md#invariant) | **GET** /thorchain/invariant/{invariant} | +*InvariantsApi* | [**invariants**](docs/InvariantsApi.md#invariants) | **GET** /thorchain/invariants | +*LiquidityProvidersApi* | [**liquidity_provider**](docs/LiquidityProvidersApi.md#liquidity_provider) | **GET** /thorchain/pool/{asset}/liquidity_provider/{address} | +*LiquidityProvidersApi* | [**liquidity_providers**](docs/LiquidityProvidersApi.md#liquidity_providers) | **GET** /thorchain/pool/{asset}/liquidity_providers | +*MimirApi* | [**mimir**](docs/MimirApi.md#mimir) | **GET** /thorchain/mimir | +*MimirApi* | [**mimir_admin**](docs/MimirApi.md#mimir_admin) | **GET** /thorchain/mimir/admin | +*MimirApi* | [**mimir_key**](docs/MimirApi.md#mimir_key) | **GET** /thorchain/mimir/key/{key} | +*MimirApi* | [**mimir_node**](docs/MimirApi.md#mimir_node) | **GET** /thorchain/mimir/node/{address} | +*MimirApi* | [**mimir_nodes**](docs/MimirApi.md#mimir_nodes) | **GET** /thorchain/mimir/nodes_all | +*NetworkApi* | [**ban**](docs/NetworkApi.md#ban) | **GET** /thorchain/ban/{address} | +*NetworkApi* | [**constants**](docs/NetworkApi.md#constants) | **GET** /thorchain/constants | +*NetworkApi* | [**inbound_addresses**](docs/NetworkApi.md#inbound_addresses) | **GET** /thorchain/inbound_addresses | +*NetworkApi* | [**lastblock**](docs/NetworkApi.md#lastblock) | **GET** /thorchain/lastblock | +*NetworkApi* | [**lastblock_chain**](docs/NetworkApi.md#lastblock_chain) | **GET** /thorchain/lastblock/{chain} | +*NetworkApi* | [**network**](docs/NetworkApi.md#network) | **GET** /thorchain/network | +*NetworkApi* | [**ragnarok**](docs/NetworkApi.md#ragnarok) | **GET** /thorchain/ragnarok | +*NetworkApi* | [**version**](docs/NetworkApi.md#version) | **GET** /thorchain/version | +*NodesApi* | [**node**](docs/NodesApi.md#node) | **GET** /thorchain/node/{address} | +*NodesApi* | [**nodes**](docs/NodesApi.md#nodes) | **GET** /thorchain/nodes | +*PolApi* | [**pol**](docs/PolApi.md#pol) | **GET** /thorchain/pol | +*PoolsApi* | [**pool**](docs/PoolsApi.md#pool) | **GET** /thorchain/pool/{asset} | +*PoolsApi* | [**pools**](docs/PoolsApi.md#pools) | **GET** /thorchain/pools | +*QueueApi* | [**queue**](docs/QueueApi.md#queue) | **GET** /thorchain/queue | +*QueueApi* | [**queue_outbound**](docs/QueueApi.md#queue_outbound) | **GET** /thorchain/queue/outbound | +*QueueApi* | [**queue_scheduled**](docs/QueueApi.md#queue_scheduled) | **GET** /thorchain/queue/scheduled | +*QueueApi* | [**queue_swap**](docs/QueueApi.md#queue_swap) | **GET** /thorchain/queue/swap | +*QuoteApi* | [**quoteloanclose**](docs/QuoteApi.md#quoteloanclose) | **GET** /thorchain/quote/loan/close | +*QuoteApi* | [**quoteloanopen**](docs/QuoteApi.md#quoteloanopen) | **GET** /thorchain/quote/loan/open | +*QuoteApi* | [**quotesaverdeposit**](docs/QuoteApi.md#quotesaverdeposit) | **GET** /thorchain/quote/saver/deposit | +*QuoteApi* | [**quotesaverwithdraw**](docs/QuoteApi.md#quotesaverwithdraw) | **GET** /thorchain/quote/saver/withdraw | +*QuoteApi* | [**quoteswap**](docs/QuoteApi.md#quoteswap) | **GET** /thorchain/quote/swap | +*SaversApi* | [**saver**](docs/SaversApi.md#saver) | **GET** /thorchain/pool/{asset}/saver/{address} | +*SaversApi* | [**savers**](docs/SaversApi.md#savers) | **GET** /thorchain/pool/{asset}/savers | +*StreamingSwapApi* | [**stream_swap**](docs/StreamingSwapApi.md#stream_swap) | **GET** /thorchain/swap/streaming/{hash} | +*StreamingSwapApi* | [**stream_swaps**](docs/StreamingSwapApi.md#stream_swaps) | **GET** /thorchain/swaps/streaming | +*TssApi* | [**keysign**](docs/TssApi.md#keysign) | **GET** /thorchain/keysign/{height} | +*TssApi* | [**keysign_pubkey**](docs/TssApi.md#keysign_pubkey) | **GET** /thorchain/keysign/{height}/{pubkey} | +*TssApi* | [**metrics**](docs/TssApi.md#metrics) | **GET** /thorchain/metrics | +*TssApi* | [**metrics_keygen**](docs/TssApi.md#metrics_keygen) | **GET** /thorchain/metric/keygen/{pubkey} | +*ThornamesApi* | [**thorname**](docs/ThornamesApi.md#thorname) | **GET** /thorchain/thorname/{name} | +*TransactionsApi* | [**tx**](docs/TransactionsApi.md#tx) | **GET** /thorchain/tx/{hash} | +*TransactionsApi* | [**tx_signers**](docs/TransactionsApi.md#tx_signers) | **GET** /thorchain/tx/details/{hash} | +*TransactionsApi* | [**tx_signers_old**](docs/TransactionsApi.md#tx_signers_old) | **GET** /thorchain/tx/{hash}/signers | +*VaultsApi* | [**asgard**](docs/VaultsApi.md#asgard) | **GET** /thorchain/vaults/asgard | +*VaultsApi* | [**vault**](docs/VaultsApi.md#vault) | **GET** /thorchain/vault/{pubkey} | +*VaultsApi* | [**vault_pubkeys**](docs/VaultsApi.md#vault_pubkeys) | **GET** /thorchain/vaults/pubkeys | +*VaultsApi* | [**yggdrasil**](docs/VaultsApi.md#yggdrasil) | **GET** /thorchain/vaults/yggdrasil | + + +## Documentation For Models + + - [BanResponse](docs/BanResponse.md) + - [BaseQuoteResponse](docs/BaseQuoteResponse.md) + - [Borrower](docs/Borrower.md) + - [ChainHeight](docs/ChainHeight.md) + - [Coin](docs/Coin.md) + - [ConstantsResponse](docs/ConstantsResponse.md) + - [InboundAddress](docs/InboundAddress.md) + - [InvariantResponse](docs/InvariantResponse.md) + - [InvariantsResponse](docs/InvariantsResponse.md) + - [KeygenMetric](docs/KeygenMetric.md) + - [KeysignInfo](docs/KeysignInfo.md) + - [KeysignMetrics](docs/KeysignMetrics.md) + - [KeysignResponse](docs/KeysignResponse.md) + - [LastBlock](docs/LastBlock.md) + - [LiquidityProvider](docs/LiquidityProvider.md) + - [LiquidityProviderSummary](docs/LiquidityProviderSummary.md) + - [MetricsResponse](docs/MetricsResponse.md) + - [MimirNodesResponse](docs/MimirNodesResponse.md) + - [MimirVote](docs/MimirVote.md) + - [MsgSwap](docs/MsgSwap.md) + - [NetworkResponse](docs/NetworkResponse.md) + - [Node](docs/Node.md) + - [NodeBondProvider](docs/NodeBondProvider.md) + - [NodeBondProviders](docs/NodeBondProviders.md) + - [NodeJail](docs/NodeJail.md) + - [NodeKeygenMetric](docs/NodeKeygenMetric.md) + - [NodePreflightStatus](docs/NodePreflightStatus.md) + - [NodePubKeySet](docs/NodePubKeySet.md) + - [ObservedTx](docs/ObservedTx.md) + - [Ping](docs/Ping.md) + - [PolResponse](docs/PolResponse.md) + - [Pool](docs/Pool.md) + - [QueueResponse](docs/QueueResponse.md) + - [QuoteFees](docs/QuoteFees.md) + - [QuoteLoanCloseResponse](docs/QuoteLoanCloseResponse.md) + - [QuoteLoanOpenResponse](docs/QuoteLoanOpenResponse.md) + - [QuoteSaverDepositResponse](docs/QuoteSaverDepositResponse.md) + - [QuoteSaverWithdrawResponse](docs/QuoteSaverWithdrawResponse.md) + - [QuoteSwapResponse](docs/QuoteSwapResponse.md) + - [Saver](docs/Saver.md) + - [StreamingSwap](docs/StreamingSwap.md) + - [Thorname](docs/Thorname.md) + - [ThornameAlias](docs/ThornameAlias.md) + - [TssKeysignMetric](docs/TssKeysignMetric.md) + - [TssMetric](docs/TssMetric.md) + - [Tx](docs/Tx.md) + - [TxDetailsResponse](docs/TxDetailsResponse.md) + - [TxOutItem](docs/TxOutItem.md) + - [TxResponse](docs/TxResponse.md) + - [TxSignersResponse](docs/TxSignersResponse.md) + - [TxStagesResponse](docs/TxStagesResponse.md) + - [TxStagesResponseInboundConfirmationCounted](docs/TxStagesResponseInboundConfirmationCounted.md) + - [TxStagesResponseInboundFinalised](docs/TxStagesResponseInboundFinalised.md) + - [TxStagesResponseInboundObserved](docs/TxStagesResponseInboundObserved.md) + - [TxStagesResponseOutboundDelay](docs/TxStagesResponseOutboundDelay.md) + - [TxStagesResponseOutboundSigned](docs/TxStagesResponseOutboundSigned.md) + - [TxStagesResponseSwapFinalised](docs/TxStagesResponseSwapFinalised.md) + - [TxStagesResponseSwapStatus](docs/TxStagesResponseSwapStatus.md) + - [TxStagesResponseSwapStatusStreaming](docs/TxStagesResponseSwapStatusStreaming.md) + - [TxStatusResponse](docs/TxStatusResponse.md) + - [TxStatusResponsePlannedOutTxsInner](docs/TxStatusResponsePlannedOutTxsInner.md) + - [Vault](docs/Vault.md) + - [VaultAddress](docs/VaultAddress.md) + - [VaultInfo](docs/VaultInfo.md) + - [VaultPubkeysResponse](docs/VaultPubkeysResponse.md) + - [VaultRouter](docs/VaultRouter.md) + - [VersionResponse](docs/VersionResponse.md) + + +To get access to the crate's generated documentation, use: + +``` +cargo doc --open +``` + +## Author + +devs@thorchain.org + diff --git a/thorchain-rs/docs/BanResponse.md b/thorchain-rs/docs/BanResponse.md new file mode 100644 index 0000000..0d0b53b --- /dev/null +++ b/thorchain-rs/docs/BanResponse.md @@ -0,0 +1,13 @@ +# BanResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**node_address** | Option<**String**> | | [optional] +**block_height** | Option<**i64**> | | [optional] +**signers** | Option<**Vec**> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/BaseQuoteResponse.md b/thorchain-rs/docs/BaseQuoteResponse.md new file mode 100644 index 0000000..064d9d9 --- /dev/null +++ b/thorchain-rs/docs/BaseQuoteResponse.md @@ -0,0 +1,24 @@ +# BaseQuoteResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**inbound_address** | Option<**String**> | the inbound address for the transaction on the source chain | [optional] +**inbound_confirmation_blocks** | Option<**i64**> | the approximate number of source chain blocks required before processing | [optional] +**inbound_confirmation_seconds** | Option<**i64**> | the approximate seconds for block confirmations required before processing | [optional] +**outbound_delay_blocks** | Option<**i64**> | the number of thorchain blocks the outbound will be delayed | [optional] +**outbound_delay_seconds** | Option<**i64**> | the approximate seconds for the outbound delay before it will be sent | [optional] +**fees** | Option<[**crate::models::QuoteFees**](QuoteFees.md)> | | [optional] +**slippage_bps** | Option<**i64**> | the total swap slippage in basis points | [optional] +**streaming_slippage_bps** | Option<**i64**> | the total streaming swap slippage in basis points | [optional] +**router** | Option<**String**> | the EVM chain router contract address | [optional] +**expiry** | Option<**i64**> | expiration timestamp in unix seconds | [optional] +**warning** | Option<**String**> | static warning message | [optional] +**notes** | Option<**String**> | chain specific quote notes | [optional] +**dust_threshold** | Option<**String**> | Defines the minimum transaction size for the chain in base units (sats, wei, uatom). Transctions with asset amounts lower than the dust_threshold are ignored. | [optional] +**recommended_min_amount_in** | Option<**String**> | The recommended minimum inbound amount for this transaction type & inbound asset. Sending less than this amount could result in failed refunds. | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/Borrower.md b/thorchain-rs/docs/Borrower.md new file mode 100644 index 0000000..4a73cba --- /dev/null +++ b/thorchain-rs/docs/Borrower.md @@ -0,0 +1,20 @@ +# Borrower + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**owner** | **String** | | +**asset** | **String** | | +**debt_issued** | **String** | | +**debt_repaid** | **String** | | +**debt_current** | **String** | | +**collateral_deposited** | **String** | | +**collateral_withdrawn** | **String** | | +**collateral_current** | **String** | | +**last_open_height** | **i64** | | +**last_repay_height** | **i64** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/BorrowersApi.md b/thorchain-rs/docs/BorrowersApi.md new file mode 100644 index 0000000..9135efc --- /dev/null +++ b/thorchain-rs/docs/BorrowersApi.md @@ -0,0 +1,73 @@ +# \BorrowersApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**borrower**](BorrowersApi.md#borrower) | **GET** /thorchain/pool/{asset}/borrower/{address} | +[**borrowers**](BorrowersApi.md#borrowers) | **GET** /thorchain/pool/{asset}/borrowers | + + + +## borrower + +> crate::models::Borrower borrower(asset, address, height) + + +Returns the borrower position given the pool and address. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**asset** | **String** | | [required] | +**address** | **String** | | [required] | +**height** | Option<**i64**> | optional block height, defaults to current tip | | + +### Return type + +[**crate::models::Borrower**](Borrower.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## borrowers + +> Vec borrowers(asset, height) + + +Returns all borrowers for the given pool. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**asset** | **String** | | [required] | +**height** | Option<**i64**> | optional block height, defaults to current tip | | + +### Return type + +[**Vec**](Borrower.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/thorchain-rs/docs/ChainHeight.md b/thorchain-rs/docs/ChainHeight.md new file mode 100644 index 0000000..33fed94 --- /dev/null +++ b/thorchain-rs/docs/ChainHeight.md @@ -0,0 +1,12 @@ +# ChainHeight + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**chain** | **String** | | +**height** | **i64** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/Coin.md b/thorchain-rs/docs/Coin.md new file mode 100644 index 0000000..40109e7 --- /dev/null +++ b/thorchain-rs/docs/Coin.md @@ -0,0 +1,13 @@ +# Coin + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**asset** | **String** | | +**amount** | **String** | | +**decimals** | Option<**i64**> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/ConstantsResponse.md b/thorchain-rs/docs/ConstantsResponse.md new file mode 100644 index 0000000..85e9f44 --- /dev/null +++ b/thorchain-rs/docs/ConstantsResponse.md @@ -0,0 +1,13 @@ +# ConstantsResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**int_64_values** | Option<**::std::collections::HashMap**> | | [optional] +**bool_values** | Option<**::std::collections::HashMap**> | | [optional] +**string_values** | Option<**::std::collections::HashMap**> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/HealthApi.md b/thorchain-rs/docs/HealthApi.md new file mode 100644 index 0000000..36cdf02 --- /dev/null +++ b/thorchain-rs/docs/HealthApi.md @@ -0,0 +1,34 @@ +# \HealthApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**ping**](HealthApi.md#ping) | **GET** /thorchain/ping | + + + +## ping + +> crate::models::Ping ping() + + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**crate::models::Ping**](Ping.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/thorchain-rs/docs/InboundAddress.md b/thorchain-rs/docs/InboundAddress.md new file mode 100644 index 0000000..bca004f --- /dev/null +++ b/thorchain-rs/docs/InboundAddress.md @@ -0,0 +1,23 @@ +# InboundAddress + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**chain** | Option<**String**> | | [optional] +**pub_key** | Option<**String**> | | [optional] +**address** | Option<**String**> | | [optional] +**router** | Option<**String**> | | [optional] +**halted** | **bool** | Returns true if trading is unavailable for this chain, either because trading is halted globally or specifically for this chain | +**global_trading_paused** | Option<**bool**> | Returns true if trading is paused globally | [optional] +**chain_trading_paused** | Option<**bool**> | Returns true if trading is paused for this chain | [optional] +**chain_lp_actions_paused** | Option<**bool**> | Returns true if LP actions are paused for this chain | [optional] +**gas_rate** | Option<**String**> | The minimum fee rate used by vaults to send outbound TXs. The actual fee rate may be higher. For EVM chains this is returned in gwei (1e9). | [optional] +**gas_rate_units** | Option<**String**> | Units of the gas_rate. | [optional] +**outbound_tx_size** | Option<**String**> | Avg size of outbound TXs on each chain. For UTXO chains it may be larger than average, as it takes into account vault consolidation txs, which can have many vouts | [optional] +**outbound_fee** | Option<**String**> | The total outbound fee charged to the user for outbound txs in the gas asset of the chain. | [optional] +**dust_threshold** | Option<**String**> | Defines the minimum transaction size for the chain in base units (sats, wei, uatom). Transactions with asset amounts lower than the dust_threshold are ignored. | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/InvariantResponse.md b/thorchain-rs/docs/InvariantResponse.md new file mode 100644 index 0000000..17f79f2 --- /dev/null +++ b/thorchain-rs/docs/InvariantResponse.md @@ -0,0 +1,13 @@ +# InvariantResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**invariant** | **String** | The name of the invariant. | +**broken** | **bool** | Returns true if the invariant is broken. | +**msg** | **Vec** | Informative message about the invariant result. | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/InvariantsApi.md b/thorchain-rs/docs/InvariantsApi.md new file mode 100644 index 0000000..0e267b3 --- /dev/null +++ b/thorchain-rs/docs/InvariantsApi.md @@ -0,0 +1,71 @@ +# \InvariantsApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**invariant**](InvariantsApi.md#invariant) | **GET** /thorchain/invariant/{invariant} | +[**invariants**](InvariantsApi.md#invariants) | **GET** /thorchain/invariants | + + + +## invariant + +> crate::models::InvariantResponse invariant(invariant, height) + + +Returns result of running the given invariant. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**invariant** | **String** | | [required] | +**height** | Option<**i64**> | optional block height, defaults to current tip | | + +### Return type + +[**crate::models::InvariantResponse**](InvariantResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## invariants + +> crate::models::InvariantsResponse invariants(height) + + +Returns a list of available invariants. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**height** | Option<**i64**> | optional block height, defaults to current tip | | + +### Return type + +[**crate::models::InvariantsResponse**](InvariantsResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/thorchain-rs/docs/InvariantsResponse.md b/thorchain-rs/docs/InvariantsResponse.md new file mode 100644 index 0000000..552af55 --- /dev/null +++ b/thorchain-rs/docs/InvariantsResponse.md @@ -0,0 +1,11 @@ +# InvariantsResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**invariants** | Option<**Vec**> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/KeygenMetric.md b/thorchain-rs/docs/KeygenMetric.md new file mode 100644 index 0000000..8c33873 --- /dev/null +++ b/thorchain-rs/docs/KeygenMetric.md @@ -0,0 +1,12 @@ +# KeygenMetric + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**pub_key** | Option<**String**> | | [optional] +**node_tss_times** | [**Vec**](NodeKeygenMetric.md) | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/KeysignInfo.md b/thorchain-rs/docs/KeysignInfo.md new file mode 100644 index 0000000..d184e07 --- /dev/null +++ b/thorchain-rs/docs/KeysignInfo.md @@ -0,0 +1,12 @@ +# KeysignInfo + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**height** | Option<**i64**> | the block(s) in which a tx out item is scheduled to be signed and moved from the scheduled outbound queue to the outbound queue | [optional] +**tx_array** | [**Vec**](TxOutItem.md) | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/KeysignMetrics.md b/thorchain-rs/docs/KeysignMetrics.md new file mode 100644 index 0000000..c9028ff --- /dev/null +++ b/thorchain-rs/docs/KeysignMetrics.md @@ -0,0 +1,12 @@ +# KeysignMetrics + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**tx_id** | Option<**String**> | | [optional] +**node_tss_times** | Option<[**Vec**](TssMetric.md)> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/KeysignResponse.md b/thorchain-rs/docs/KeysignResponse.md new file mode 100644 index 0000000..dbdcb84 --- /dev/null +++ b/thorchain-rs/docs/KeysignResponse.md @@ -0,0 +1,12 @@ +# KeysignResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**keysign** | Option<[**crate::models::KeysignInfo**](KeysignInfo.md)> | | [optional] +**signature** | Option<**String**> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/LastBlock.md b/thorchain-rs/docs/LastBlock.md new file mode 100644 index 0000000..aec5254 --- /dev/null +++ b/thorchain-rs/docs/LastBlock.md @@ -0,0 +1,14 @@ +# LastBlock + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**chain** | **String** | | +**last_observed_in** | **i64** | | +**last_signed_out** | **i64** | | +**thorchain** | **i64** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/LiquidityProvider.md b/thorchain-rs/docs/LiquidityProvider.md new file mode 100644 index 0000000..20e4553 --- /dev/null +++ b/thorchain-rs/docs/LiquidityProvider.md @@ -0,0 +1,26 @@ +# LiquidityProvider + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**asset** | **String** | | +**rune_address** | Option<**String**> | | [optional] +**asset_address** | Option<**String**> | | [optional] +**last_add_height** | Option<**i64**> | | [optional] +**last_withdraw_height** | Option<**i64**> | | [optional] +**units** | **String** | | +**pending_rune** | **String** | | +**pending_asset** | **String** | | +**pending_tx_id** | Option<**String**> | | [optional] +**rune_deposit_value** | **String** | | +**asset_deposit_value** | **String** | | +**rune_redeem_value** | **String** | | +**asset_redeem_value** | **String** | | +**luvi_deposit_value** | **String** | | +**luvi_redeem_value** | **String** | | +**luvi_growth_pct** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/LiquidityProviderSummary.md b/thorchain-rs/docs/LiquidityProviderSummary.md new file mode 100644 index 0000000..c9e6bd7 --- /dev/null +++ b/thorchain-rs/docs/LiquidityProviderSummary.md @@ -0,0 +1,21 @@ +# LiquidityProviderSummary + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**asset** | **String** | | +**rune_address** | Option<**String**> | | [optional] +**asset_address** | Option<**String**> | | [optional] +**last_add_height** | Option<**i64**> | | [optional] +**last_withdraw_height** | Option<**i64**> | | [optional] +**units** | **String** | | +**pending_rune** | **String** | | +**pending_asset** | **String** | | +**pending_tx_id** | Option<**String**> | | [optional] +**rune_deposit_value** | **String** | | +**asset_deposit_value** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/LiquidityProvidersApi.md b/thorchain-rs/docs/LiquidityProvidersApi.md new file mode 100644 index 0000000..276a7c0 --- /dev/null +++ b/thorchain-rs/docs/LiquidityProvidersApi.md @@ -0,0 +1,73 @@ +# \LiquidityProvidersApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**liquidity_provider**](LiquidityProvidersApi.md#liquidity_provider) | **GET** /thorchain/pool/{asset}/liquidity_provider/{address} | +[**liquidity_providers**](LiquidityProvidersApi.md#liquidity_providers) | **GET** /thorchain/pool/{asset}/liquidity_providers | + + + +## liquidity_provider + +> crate::models::LiquidityProvider liquidity_provider(asset, address, height) + + +Returns the liquidity provider information for an address and asset. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**asset** | **String** | | [required] | +**address** | **String** | | [required] | +**height** | Option<**i64**> | optional block height, defaults to current tip | | + +### Return type + +[**crate::models::LiquidityProvider**](LiquidityProvider.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## liquidity_providers + +> Vec liquidity_providers(asset, height) + + +Returns all liquidity provider information for an asset. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**asset** | **String** | | [required] | +**height** | Option<**i64**> | optional block height, defaults to current tip | | + +### Return type + +[**Vec**](LiquidityProviderSummary.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/thorchain-rs/docs/MetricsResponse.md b/thorchain-rs/docs/MetricsResponse.md new file mode 100644 index 0000000..af3ea07 --- /dev/null +++ b/thorchain-rs/docs/MetricsResponse.md @@ -0,0 +1,12 @@ +# MetricsResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**keygen** | Option<[**Vec**](KeygenMetric.md)> | | [optional] +**keysign** | Option<[**crate::models::KeysignMetrics**](KeysignMetrics.md)> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/MimirApi.md b/thorchain-rs/docs/MimirApi.md new file mode 100644 index 0000000..49785f3 --- /dev/null +++ b/thorchain-rs/docs/MimirApi.md @@ -0,0 +1,165 @@ +# \MimirApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**mimir**](MimirApi.md#mimir) | **GET** /thorchain/mimir | +[**mimir_admin**](MimirApi.md#mimir_admin) | **GET** /thorchain/mimir/admin | +[**mimir_key**](MimirApi.md#mimir_key) | **GET** /thorchain/mimir/key/{key} | +[**mimir_node**](MimirApi.md#mimir_node) | **GET** /thorchain/mimir/node/{address} | +[**mimir_nodes**](MimirApi.md#mimir_nodes) | **GET** /thorchain/mimir/nodes_all | + + + +## mimir + +> ::std::collections::HashMap mimir(height) + + +Returns current active mimir configuration. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**height** | Option<**i64**> | optional block height, defaults to current tip | | + +### Return type + +**::std::collections::HashMap** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## mimir_admin + +> ::std::collections::HashMap mimir_admin(height) + + +Returns current admin mimir configuration. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**height** | Option<**i64**> | optional block height, defaults to current tip | | + +### Return type + +**::std::collections::HashMap** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## mimir_key + +> i64 mimir_key(key, height) + + +Returns current active mimir configuration for the provided key. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**key** | **String** | the mimir key to lookup | [required] | +**height** | Option<**i64**> | optional block height, defaults to current tip | | + +### Return type + +**i64** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## mimir_node + +> ::std::collections::HashMap mimir_node(address, height) + + +Returns current node mimir configuration for the provided node address. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**address** | **String** | | [required] | +**height** | Option<**i64**> | optional block height, defaults to current tip | | + +### Return type + +**::std::collections::HashMap** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## mimir_nodes + +> crate::models::MimirNodesResponse mimir_nodes(height) + + +Returns current node mimir votes. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**height** | Option<**i64**> | optional block height, defaults to current tip | | + +### Return type + +[**crate::models::MimirNodesResponse**](MimirNodesResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/thorchain-rs/docs/MimirNodesResponse.md b/thorchain-rs/docs/MimirNodesResponse.md new file mode 100644 index 0000000..2042084 --- /dev/null +++ b/thorchain-rs/docs/MimirNodesResponse.md @@ -0,0 +1,11 @@ +# MimirNodesResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mimirs** | Option<[**Vec**](MimirVote.md)> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/MimirVote.md b/thorchain-rs/docs/MimirVote.md new file mode 100644 index 0000000..9dccd9f --- /dev/null +++ b/thorchain-rs/docs/MimirVote.md @@ -0,0 +1,13 @@ +# MimirVote + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**key** | Option<**String**> | | [optional] +**value** | Option<**i64**> | | [optional] +**signer** | Option<**String**> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/MsgSwap.md b/thorchain-rs/docs/MsgSwap.md new file mode 100644 index 0000000..c4fd410 --- /dev/null +++ b/thorchain-rs/docs/MsgSwap.md @@ -0,0 +1,23 @@ +# MsgSwap + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**tx** | [**crate::models::Tx**](Tx.md) | | +**target_asset** | **String** | the asset to be swapped to | +**destination** | Option<**String**> | the destination address to receive the swap output | [optional] +**trade_target** | **String** | the minimum amount of output asset to receive (else cancelling and refunding the swap) | +**affiliate_address** | Option<**String**> | the affiliate address which will receive any affiliate fee | [optional] +**affiliate_basis_points** | **String** | the affiliate fee in basis points | +**signer** | Option<**String**> | the signer (sender) of the transaction | [optional] +**aggregator** | Option<**String**> | the contract address if an aggregator is specified for a non-THORChain SwapOut | [optional] +**aggregator_target_address** | Option<**String**> | the desired output asset of the aggregator SwapOut | [optional] +**aggregator_target_limit** | Option<**String**> | the minimum amount of SwapOut asset to receive (else cancelling the SwapOut and receiving THORChain's output) | [optional] +**order_type** | Option<**i64**> | 0 if a market order (immediately completed or refunded), 1 if a limit order (held until fulfillable) | [optional] +**stream_quantity** | Option<**i32**> | number of swaps to execute in a streaming swap | [optional] +**stream_interval** | Option<**i32**> | the interval (in blocks) to execute the streaming swap | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/NetworkApi.md b/thorchain-rs/docs/NetworkApi.md new file mode 100644 index 0000000..4ff2cb6 --- /dev/null +++ b/thorchain-rs/docs/NetworkApi.md @@ -0,0 +1,258 @@ +# \NetworkApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**ban**](NetworkApi.md#ban) | **GET** /thorchain/ban/{address} | +[**constants**](NetworkApi.md#constants) | **GET** /thorchain/constants | +[**inbound_addresses**](NetworkApi.md#inbound_addresses) | **GET** /thorchain/inbound_addresses | +[**lastblock**](NetworkApi.md#lastblock) | **GET** /thorchain/lastblock | +[**lastblock_chain**](NetworkApi.md#lastblock_chain) | **GET** /thorchain/lastblock/{chain} | +[**network**](NetworkApi.md#network) | **GET** /thorchain/network | +[**ragnarok**](NetworkApi.md#ragnarok) | **GET** /thorchain/ragnarok | +[**version**](NetworkApi.md#version) | **GET** /thorchain/version | + + + +## ban + +> crate::models::BanResponse ban(address, height) + + +Returns the ban status for the provided node address. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**address** | **String** | | [required] | +**height** | Option<**i64**> | optional block height, defaults to current tip | | + +### Return type + +[**crate::models::BanResponse**](BanResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## constants + +> crate::models::ConstantsResponse constants(height) + + +Returns constant configuration, can be overridden by mimir. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**height** | Option<**i64**> | optional block height, defaults to current tip | | + +### Return type + +[**crate::models::ConstantsResponse**](ConstantsResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## inbound_addresses + +> Vec inbound_addresses(height) + + +Returns the set of asgard addresses that should be used for inbound transactions. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**height** | Option<**i64**> | optional block height, defaults to current tip | | + +### Return type + +[**Vec**](InboundAddress.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## lastblock + +> Vec lastblock(height) + + +Returns the last block information for all chains. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**height** | Option<**i64**> | optional block height, defaults to current tip | | + +### Return type + +[**Vec**](LastBlock.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## lastblock_chain + +> Vec lastblock_chain(chain, height) + + +Returns the last block information for the provided chain. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**chain** | **String** | | [required] | +**height** | Option<**i64**> | optional block height, defaults to current tip | | + +### Return type + +[**Vec**](LastBlock.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## network + +> crate::models::NetworkResponse network(height) + + +Returns network overview statistics. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**height** | Option<**i64**> | optional block height, defaults to current tip | | + +### Return type + +[**crate::models::NetworkResponse**](NetworkResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## ragnarok + +> bool ragnarok(height) + + +Returns a boolean indicating whether the chain is in ragnarok. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**height** | Option<**i64**> | optional block height, defaults to current tip | | + +### Return type + +**bool** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## version + +> crate::models::VersionResponse version(height) + + +Returns the network's current THORNode version, the network's next THORNode version, and the querier's THORNode version. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**height** | Option<**i64**> | optional block height, defaults to current tip | | + +### Return type + +[**crate::models::VersionResponse**](VersionResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/thorchain-rs/docs/NetworkResponse.md b/thorchain-rs/docs/NetworkResponse.md new file mode 100644 index 0000000..4cfae1f --- /dev/null +++ b/thorchain-rs/docs/NetworkResponse.md @@ -0,0 +1,24 @@ +# NetworkResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bond_reward_rune** | **String** | total amount of RUNE awarded to node operators | +**burned_bep_2_rune** | **String** | total of burned BEP2 RUNE | +**burned_erc_20_rune** | **String** | total of burned ERC20 RUNE | +**total_bond_units** | **String** | total bonded RUNE | +**effective_security_bond** | **String** | effective security bond used to determine maximum pooled RUNE | +**total_reserve** | **String** | total reserve RUNE | +**vaults_migrating** | **bool** | Returns true if there exist RetiringVaults which have not finished migrating funds to new ActiveVaults | +**gas_spent_rune** | **String** | Sum of the gas the network has spent to send outbounds | +**gas_withheld_rune** | **String** | Sum of the gas withheld from users to cover outbound gas | +**outbound_fee_multiplier** | Option<**String**> | Current outbound fee multiplier, in basis points | [optional] +**native_outbound_fee_rune** | **String** | the outbound transaction fee in rune, converted from the NativeOutboundFeeUSD mimir | +**native_tx_fee_rune** | **String** | the native transaction fee in rune, converted from the NativeTransactionFeeUSD mimir | +**tns_register_fee_rune** | **String** | the thorname register fee in rune, converted from the TNSRegisterFeeUSD mimir | +**tns_fee_per_block_rune** | **String** | the thorname fee per block in rune, converted from the TNSFeePerBlockUSD mimir | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/Node.md b/thorchain-rs/docs/Node.md new file mode 100644 index 0000000..2e47c7c --- /dev/null +++ b/thorchain-rs/docs/Node.md @@ -0,0 +1,31 @@ +# Node + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**node_address** | **String** | | +**status** | **String** | | +**pub_key_set** | [**crate::models::NodePubKeySet**](NodePubKeySet.md) | | +**validator_cons_pub_key** | **String** | the consensus pub key for the node | +**peer_id** | **String** | the P2PID (:6040/p2pid endpoint) of the node | +**active_block_height** | **i64** | the block height at which the node became active | +**status_since** | **i64** | the block height of the current provided information for the node | +**node_operator_address** | **String** | | +**total_bond** | **String** | current node bond | +**bond_providers** | [**crate::models::NodeBondProviders**](NodeBondProviders.md) | | +**signer_membership** | **Vec** | the set of vault public keys of which the node is a member | +**requested_to_leave** | **bool** | | +**forced_to_leave** | **bool** | indicates whether the node has been forced to leave by the network, typically via ban | +**leave_height** | **i64** | | +**ip_address** | **String** | | +**version** | **String** | the currently set version of the node | +**slash_points** | **i64** | the accumlated slash points, reset at churn but excessive slash points may carry over | +**jail** | [**crate::models::NodeJail**](NodeJail.md) | | +**current_award** | **String** | | +**observe_chains** | [**Vec**](ChainHeight.md) | the last observed heights for all chain by the node | +**preflight_status** | [**crate::models::NodePreflightStatus**](NodePreflightStatus.md) | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/NodeBondProvider.md b/thorchain-rs/docs/NodeBondProvider.md new file mode 100644 index 0000000..4031ebf --- /dev/null +++ b/thorchain-rs/docs/NodeBondProvider.md @@ -0,0 +1,12 @@ +# NodeBondProvider + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bond_address** | Option<**String**> | | [optional] +**bond** | Option<**String**> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/NodeBondProviders.md b/thorchain-rs/docs/NodeBondProviders.md new file mode 100644 index 0000000..813a160 --- /dev/null +++ b/thorchain-rs/docs/NodeBondProviders.md @@ -0,0 +1,12 @@ +# NodeBondProviders + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**node_operator_fee** | Option<**String**> | node operator fee in basis points | [optional] +**providers** | Option<[**crate::models::NodeBondProvider**](NodeBondProvider.md)> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/NodeJail.md b/thorchain-rs/docs/NodeJail.md new file mode 100644 index 0000000..0cfb3a7 --- /dev/null +++ b/thorchain-rs/docs/NodeJail.md @@ -0,0 +1,12 @@ +# NodeJail + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**release_height** | Option<**i64**> | | [optional] +**reason** | Option<**String**> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/NodeKeygenMetric.md b/thorchain-rs/docs/NodeKeygenMetric.md new file mode 100644 index 0000000..604e9f6 --- /dev/null +++ b/thorchain-rs/docs/NodeKeygenMetric.md @@ -0,0 +1,12 @@ +# NodeKeygenMetric + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**address** | Option<**String**> | | [optional] +**tss_time** | Option<**String**> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/NodePreflightStatus.md b/thorchain-rs/docs/NodePreflightStatus.md new file mode 100644 index 0000000..9a402e2 --- /dev/null +++ b/thorchain-rs/docs/NodePreflightStatus.md @@ -0,0 +1,13 @@ +# NodePreflightStatus + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**status** | **String** | the next status of the node | +**reason** | **String** | the reason for the transition to the next status | +**code** | **i64** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/NodePubKeySet.md b/thorchain-rs/docs/NodePubKeySet.md new file mode 100644 index 0000000..a90fd99 --- /dev/null +++ b/thorchain-rs/docs/NodePubKeySet.md @@ -0,0 +1,12 @@ +# NodePubKeySet + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**secp256k1** | Option<**String**> | | [optional] +**ed25519** | Option<**String**> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/NodesApi.md b/thorchain-rs/docs/NodesApi.md new file mode 100644 index 0000000..91bf1ec --- /dev/null +++ b/thorchain-rs/docs/NodesApi.md @@ -0,0 +1,71 @@ +# \NodesApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**node**](NodesApi.md#node) | **GET** /thorchain/node/{address} | +[**nodes**](NodesApi.md#nodes) | **GET** /thorchain/nodes | + + + +## node + +> crate::models::Node node(address, height) + + +Returns node information for the provided node address. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**address** | **String** | | [required] | +**height** | Option<**i64**> | optional block height, defaults to current tip | | + +### Return type + +[**crate::models::Node**](Node.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## nodes + +> Vec nodes(height) + + +Returns node information for all registered validators. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**height** | Option<**i64**> | optional block height, defaults to current tip | | + +### Return type + +[**Vec**](Node.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/thorchain-rs/docs/ObservedTx.md b/thorchain-rs/docs/ObservedTx.md new file mode 100644 index 0000000..6377e45 --- /dev/null +++ b/thorchain-rs/docs/ObservedTx.md @@ -0,0 +1,23 @@ +# ObservedTx + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**tx** | [**crate::models::Tx**](Tx.md) | | +**status** | Option<**String**> | | [optional] +**out_hashes** | Option<**Vec**> | | [optional] +**block_height** | Option<**i64**> | same as external_observed_height, to be deprecated in favour of external_observed_height | [optional] +**external_observed_height** | Option<**i64**> | the block height on the external source chain when the transaction was observed, not provided if chain is THOR | [optional] +**signers** | Option<**Vec**> | | [optional] +**observed_pub_key** | Option<**String**> | | [optional] +**keysign_ms** | Option<**i64**> | | [optional] +**finalise_height** | Option<**i64**> | same as external_confirmation_delay_height, to be deprecated in favour of external_confirmation_delay_height | [optional] +**external_confirmation_delay_height** | Option<**i64**> | the block height on the external source chain when confirmation counting will be complete, not provided if chain is THOR | [optional] +**aggregator** | Option<**String**> | the outbound aggregator to use, will also match a suffix | [optional] +**aggregator_target** | Option<**String**> | the aggregator target asset provided to transferOutAndCall | [optional] +**aggregator_target_limit** | Option<**String**> | the aggregator target asset limit provided to transferOutAndCall | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/Ping.md b/thorchain-rs/docs/Ping.md new file mode 100644 index 0000000..36d4c14 --- /dev/null +++ b/thorchain-rs/docs/Ping.md @@ -0,0 +1,11 @@ +# Ping + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ping** | Option<**String**> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/PolApi.md b/thorchain-rs/docs/PolApi.md new file mode 100644 index 0000000..7f33f17 --- /dev/null +++ b/thorchain-rs/docs/PolApi.md @@ -0,0 +1,39 @@ +# \PolApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**pol**](PolApi.md#pol) | **GET** /thorchain/pol | + + + +## pol + +> crate::models::PolResponse pol(height) + + +Returns protocol owned liquidity overview statistics. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**height** | Option<**i64**> | optional block height, defaults to current tip | | + +### Return type + +[**crate::models::PolResponse**](POLResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/thorchain-rs/docs/PolResponse.md b/thorchain-rs/docs/PolResponse.md new file mode 100644 index 0000000..9d7f2f8 --- /dev/null +++ b/thorchain-rs/docs/PolResponse.md @@ -0,0 +1,15 @@ +# PolResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**rune_deposited** | **String** | total amount of RUNE deposited into the pools | +**rune_withdrawn** | **String** | total amount of RUNE withdrawn from the pools | +**value** | **String** | total value of protocol's LP position in RUNE value | +**pnl** | **String** | profit and loss of protocol owned liquidity | +**current_deposit** | **String** | current amount of rune deposited | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/Pool.md b/thorchain-rs/docs/Pool.md new file mode 100644 index 0000000..a004fcf --- /dev/null +++ b/thorchain-rs/docs/Pool.md @@ -0,0 +1,27 @@ +# Pool + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**asset** | **String** | | +**status** | **String** | | +**decimals** | Option<**i64**> | | [optional] +**pending_inbound_asset** | **String** | | +**pending_inbound_rune** | **String** | | +**balance_asset** | **String** | | +**balance_rune** | **String** | | +**pool_units** | **String** | the total pool units, this is the sum of LP and synth units | +**lp_units** | **String** | the total pool liquidity provider units | +**synth_units** | **String** | the total synth units in the pool | +**synth_supply** | **String** | the total supply of synths for the asset | +**savers_depth** | **String** | the balance of L1 asset deposited into the Savers Vault | +**savers_units** | **String** | the number of units owned by Savers | +**synth_mint_paused** | **bool** | whether additional synths cannot be minted | +**synth_supply_remaining** | **String** | the amount of synth supply remaining before the current max supply is reached | +**loan_collateral** | **String** | the amount of collateral collects for loans | +**loan_cr** | **String** | the current loan collateralization ratio | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/PoolsApi.md b/thorchain-rs/docs/PoolsApi.md new file mode 100644 index 0000000..77a3ad5 --- /dev/null +++ b/thorchain-rs/docs/PoolsApi.md @@ -0,0 +1,71 @@ +# \PoolsApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**pool**](PoolsApi.md#pool) | **GET** /thorchain/pool/{asset} | +[**pools**](PoolsApi.md#pools) | **GET** /thorchain/pools | + + + +## pool + +> crate::models::Pool pool(asset, height) + + +Returns the pool information for the provided asset. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**asset** | **String** | | [required] | +**height** | Option<**i64**> | optional block height, defaults to current tip | | + +### Return type + +[**crate::models::Pool**](Pool.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## pools + +> Vec pools(height) + + +Returns the pool information for all assets. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**height** | Option<**i64**> | optional block height, defaults to current tip | | + +### Return type + +[**Vec**](Pool.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/thorchain-rs/docs/QueueApi.md b/thorchain-rs/docs/QueueApi.md new file mode 100644 index 0000000..9094f4b --- /dev/null +++ b/thorchain-rs/docs/QueueApi.md @@ -0,0 +1,132 @@ +# \QueueApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**queue**](QueueApi.md#queue) | **GET** /thorchain/queue | +[**queue_outbound**](QueueApi.md#queue_outbound) | **GET** /thorchain/queue/outbound | +[**queue_scheduled**](QueueApi.md#queue_scheduled) | **GET** /thorchain/queue/scheduled | +[**queue_swap**](QueueApi.md#queue_swap) | **GET** /thorchain/queue/swap | + + + +## queue + +> crate::models::QueueResponse queue(height) + + +Returns queue statistics. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**height** | Option<**i64**> | optional block height, defaults to current tip | | + +### Return type + +[**crate::models::QueueResponse**](QueueResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## queue_outbound + +> Vec queue_outbound(height) + + +Returns the outbound queue including estimated RUNE values. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**height** | Option<**i64**> | optional block height, defaults to current tip | | + +### Return type + +[**Vec**](TxOutItem.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## queue_scheduled + +> Vec queue_scheduled(height) + + +Returns the scheduled queue. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**height** | Option<**i64**> | optional block height, defaults to current tip | | + +### Return type + +[**Vec**](TxOutItem.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## queue_swap + +> Vec queue_swap(height) + + +Returns the swap queue. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**height** | Option<**i64**> | optional block height, defaults to current tip | | + +### Return type + +[**Vec**](MsgSwap.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/thorchain-rs/docs/QueueResponse.md b/thorchain-rs/docs/QueueResponse.md new file mode 100644 index 0000000..abc0076 --- /dev/null +++ b/thorchain-rs/docs/QueueResponse.md @@ -0,0 +1,14 @@ +# QueueResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**swap** | **i64** | | +**outbound** | **i64** | number of signed outbound tx in the queue | +**internal** | **i64** | | +**scheduled_outbound_value** | **String** | scheduled outbound value in RUNE | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/QuoteApi.md b/thorchain-rs/docs/QuoteApi.md new file mode 100644 index 0000000..0d434cb --- /dev/null +++ b/thorchain-rs/docs/QuoteApi.md @@ -0,0 +1,190 @@ +# \QuoteApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**quoteloanclose**](QuoteApi.md#quoteloanclose) | **GET** /thorchain/quote/loan/close | +[**quoteloanopen**](QuoteApi.md#quoteloanopen) | **GET** /thorchain/quote/loan/open | +[**quotesaverdeposit**](QuoteApi.md#quotesaverdeposit) | **GET** /thorchain/quote/saver/deposit | +[**quotesaverwithdraw**](QuoteApi.md#quotesaverwithdraw) | **GET** /thorchain/quote/saver/withdraw | +[**quoteswap**](QuoteApi.md#quoteswap) | **GET** /thorchain/quote/swap | + + + +## quoteloanclose + +> crate::models::QuoteLoanCloseResponse quoteloanclose(height, from_asset, amount, to_asset, loan_owner, min_out) + + +Provide a quote estimate for the provided loan close. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**height** | Option<**i64**> | optional block height, defaults to current tip | | +**from_asset** | Option<**String**> | the asset used to repay the loan | | +**amount** | Option<**i64**> | the asset amount in 1e8 decimals | | +**to_asset** | Option<**String**> | the collateral asset of the loan | | +**loan_owner** | Option<**String**> | the owner of the loan collateral | | +**min_out** | Option<**String**> | the minimum amount of the target asset to accept | | + +### Return type + +[**crate::models::QuoteLoanCloseResponse**](QuoteLoanCloseResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## quoteloanopen + +> crate::models::QuoteLoanOpenResponse quoteloanopen(height, from_asset, amount, to_asset, destination, min_out, affiliate_bps, affiliate) + + +Provide a quote estimate for the provided loan open. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**height** | Option<**i64**> | optional block height, defaults to current tip | | +**from_asset** | Option<**String**> | the collateral asset | | +**amount** | Option<**i64**> | the collateral asset amount in 1e8 decimals | | +**to_asset** | Option<**String**> | the target asset to receive (loan denominated in TOR regardless) | | +**destination** | Option<**String**> | the destination address, required to generate memo | | +**min_out** | Option<**String**> | the minimum amount of the target asset to accept | | +**affiliate_bps** | Option<**i64**> | the affiliate fee in basis points | | +**affiliate** | Option<**String**> | the affiliate (address or thorname) | | + +### Return type + +[**crate::models::QuoteLoanOpenResponse**](QuoteLoanOpenResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## quotesaverdeposit + +> crate::models::QuoteSaverDepositResponse quotesaverdeposit(height, asset, amount) + + +Provide a quote estimate for the provided saver deposit. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**height** | Option<**i64**> | optional block height, defaults to current tip | | +**asset** | Option<**String**> | the asset to deposit | | +**amount** | Option<**i64**> | the source asset amount in 1e8 decimals | | + +### Return type + +[**crate::models::QuoteSaverDepositResponse**](QuoteSaverDepositResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## quotesaverwithdraw + +> crate::models::QuoteSaverWithdrawResponse quotesaverwithdraw(height, asset, address, withdraw_bps) + + +Provide a quote estimate for the provided saver withdraw. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**height** | Option<**i64**> | optional block height, defaults to current tip | | +**asset** | Option<**String**> | the asset to withdraw | | +**address** | Option<**String**> | the address for the position | | +**withdraw_bps** | Option<**i64**> | the basis points of the existing position to withdraw | | + +### Return type + +[**crate::models::QuoteSaverWithdrawResponse**](QuoteSaverWithdrawResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## quoteswap + +> crate::models::QuoteSwapResponse quoteswap(height, from_asset, to_asset, amount, destination, streaming_interval, streaming_quantity, from_address, tolerance_bps, affiliate_bps, affiliate) + + +Provide a quote estimate for the provided swap. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**height** | Option<**i64**> | optional block height, defaults to current tip | | +**from_asset** | Option<**String**> | the source asset | | +**to_asset** | Option<**String**> | the target asset | | +**amount** | Option<**i64**> | the source asset amount in 1e8 decimals | | +**destination** | Option<**String**> | the destination address, required to generate memo | | +**streaming_interval** | Option<**i64**> | the interval in which streaming swaps are swapped | | +**streaming_quantity** | Option<**i64**> | the quantity of swaps within a streaming swap | | +**from_address** | Option<**String**> | the from address, required if the from asset is a synth | | +**tolerance_bps** | Option<**i64**> | the maximum basis points from the current feeless swap price to set the limit in the generated memo | | +**affiliate_bps** | Option<**i64**> | the affiliate fee in basis points | | +**affiliate** | Option<**String**> | the affiliate (address or thorname) | | + +### Return type + +[**crate::models::QuoteSwapResponse**](QuoteSwapResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/thorchain-rs/docs/QuoteFees.md b/thorchain-rs/docs/QuoteFees.md new file mode 100644 index 0000000..7c90037 --- /dev/null +++ b/thorchain-rs/docs/QuoteFees.md @@ -0,0 +1,15 @@ +# QuoteFees + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**asset** | **String** | | +**affiliate** | Option<**String**> | | [optional] +**outbound** | **String** | | +**liquidity** | Option<**String**> | liquidity fees paid to pools | [optional] +**total_bps** | Option<**String**> | total basis points in fees relative to amount out | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/QuoteLoanCloseResponse.md b/thorchain-rs/docs/QuoteLoanCloseResponse.md new file mode 100644 index 0000000..ec66dd0 --- /dev/null +++ b/thorchain-rs/docs/QuoteLoanCloseResponse.md @@ -0,0 +1,28 @@ +# QuoteLoanCloseResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**inbound_address** | Option<**String**> | the inbound address for the transaction on the source chain | [optional] +**inbound_confirmation_blocks** | Option<**i64**> | the approximate number of source chain blocks required before processing | [optional] +**inbound_confirmation_seconds** | Option<**i64**> | the approximate seconds for block confirmations required before processing | [optional] +**outbound_delay_blocks** | **i64** | the number of thorchain blocks the outbound will be delayed | +**outbound_delay_seconds** | **i64** | the approximate seconds for the outbound delay before it will be sent | +**fees** | [**crate::models::QuoteFees**](QuoteFees.md) | | +**slippage_bps** | Option<**i64**> | the total swap slippage in basis points | [optional] +**streaming_slippage_bps** | Option<**i64**> | the total streaming swap slippage in basis points | [optional] +**router** | Option<**String**> | the EVM chain router contract address | [optional] +**expiry** | **i64** | expiration timestamp in unix seconds | +**warning** | **String** | static warning message | +**notes** | **String** | chain specific quote notes | +**dust_threshold** | Option<**String**> | Defines the minimum transaction size for the chain in base units (sats, wei, uatom). Transctions with asset amounts lower than the dust_threshold are ignored. | [optional] +**recommended_min_amount_in** | Option<**String**> | The recommended minimum inbound amount for this transaction type & inbound asset. Sending less than this amount could result in failed refunds. | [optional] +**memo** | **String** | generated memo for the loan close | +**expected_amount_out** | **String** | the amount of collateral asset the user can expect to receive after fees in 1e8 decimals | +**expected_collateral_withdrawn** | **String** | the expected amount of collateral decrease on the loan | +**expected_debt_repaid** | **String** | the expected amount of TOR debt decrease on the loan | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/QuoteLoanOpenResponse.md b/thorchain-rs/docs/QuoteLoanOpenResponse.md new file mode 100644 index 0000000..b1d4c47 --- /dev/null +++ b/thorchain-rs/docs/QuoteLoanOpenResponse.md @@ -0,0 +1,29 @@ +# QuoteLoanOpenResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**inbound_address** | Option<**String**> | the inbound address for the transaction on the source chain | [optional] +**inbound_confirmation_blocks** | Option<**i64**> | the approximate number of source chain blocks required before processing | [optional] +**inbound_confirmation_seconds** | Option<**i64**> | the approximate seconds for block confirmations required before processing | [optional] +**outbound_delay_blocks** | **i64** | the number of thorchain blocks the outbound will be delayed | +**outbound_delay_seconds** | **i64** | the approximate seconds for the outbound delay before it will be sent | +**fees** | [**crate::models::QuoteFees**](QuoteFees.md) | | +**slippage_bps** | Option<**i64**> | the total swap slippage in basis points | [optional] +**streaming_slippage_bps** | Option<**i64**> | the total streaming swap slippage in basis points | [optional] +**router** | Option<**String**> | the EVM chain router contract address | [optional] +**expiry** | **i64** | expiration timestamp in unix seconds | +**warning** | **String** | static warning message | +**notes** | **String** | chain specific quote notes | +**dust_threshold** | Option<**String**> | Defines the minimum transaction size for the chain in base units (sats, wei, uatom). Transctions with asset amounts lower than the dust_threshold are ignored. | [optional] +**recommended_min_amount_in** | Option<**String**> | The recommended minimum inbound amount for this transaction type & inbound asset. Sending less than this amount could result in failed refunds. | [optional] +**memo** | Option<**String**> | generated memo for the loan open | [optional] +**expected_amount_out** | **String** | the amount of the target asset the user can expect to receive after fees in 1e8 decimals | +**expected_collateralization_ratio** | **String** | the expected collateralization ratio in basis points | +**expected_collateral_deposited** | **String** | the expected amount of collateral increase on the loan | +**expected_debt_issued** | **String** | the expected amount of TOR debt increase on the loan | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/QuoteSaverDepositResponse.md b/thorchain-rs/docs/QuoteSaverDepositResponse.md new file mode 100644 index 0000000..19d6155 --- /dev/null +++ b/thorchain-rs/docs/QuoteSaverDepositResponse.md @@ -0,0 +1,27 @@ +# QuoteSaverDepositResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**inbound_address** | **String** | the inbound address for the transaction on the source chain | +**inbound_confirmation_blocks** | Option<**i64**> | the approximate number of source chain blocks required before processing | [optional] +**inbound_confirmation_seconds** | Option<**i64**> | the approximate seconds for block confirmations required before processing | [optional] +**outbound_delay_blocks** | Option<**i64**> | the number of thorchain blocks the outbound will be delayed | [optional] +**outbound_delay_seconds** | Option<**i64**> | the approximate seconds for the outbound delay before it will be sent | [optional] +**fees** | [**crate::models::QuoteFees**](QuoteFees.md) | | +**slippage_bps** | **i64** | the total swap slippage in basis points | +**streaming_slippage_bps** | Option<**i64**> | the total streaming swap slippage in basis points | [optional] +**router** | Option<**String**> | the EVM chain router contract address | [optional] +**expiry** | **i64** | expiration timestamp in unix seconds | +**warning** | **String** | static warning message | +**notes** | **String** | chain specific quote notes | +**dust_threshold** | Option<**String**> | Defines the minimum transaction size for the chain in base units (sats, wei, uatom). Transctions with asset amounts lower than the dust_threshold are ignored. | [optional] +**recommended_min_amount_in** | Option<**String**> | The recommended minimum inbound amount for this transaction type & inbound asset. Sending less than this amount could result in failed refunds. | [optional] +**memo** | **String** | generated memo for the deposit | +**expected_amount_out** | Option<**String**> | same as expected_amount_deposit, to be deprecated in favour of expected_amount_deposit | [optional] +**expected_amount_deposit** | **String** | the amount of the target asset the user can expect to deposit after fees | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/QuoteSaverWithdrawResponse.md b/thorchain-rs/docs/QuoteSaverWithdrawResponse.md new file mode 100644 index 0000000..301de52 --- /dev/null +++ b/thorchain-rs/docs/QuoteSaverWithdrawResponse.md @@ -0,0 +1,27 @@ +# QuoteSaverWithdrawResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**inbound_address** | **String** | the inbound address for the transaction on the source chain | +**inbound_confirmation_blocks** | Option<**i64**> | the approximate number of source chain blocks required before processing | [optional] +**inbound_confirmation_seconds** | Option<**i64**> | the approximate seconds for block confirmations required before processing | [optional] +**outbound_delay_blocks** | **i64** | the number of thorchain blocks the outbound will be delayed | +**outbound_delay_seconds** | **i64** | the approximate seconds for the outbound delay before it will be sent | +**fees** | [**crate::models::QuoteFees**](QuoteFees.md) | | +**slippage_bps** | **i64** | the total swap slippage in basis points | +**streaming_slippage_bps** | Option<**i64**> | the total streaming swap slippage in basis points | [optional] +**router** | Option<**String**> | the EVM chain router contract address | [optional] +**expiry** | **i64** | expiration timestamp in unix seconds | +**warning** | **String** | static warning message | +**notes** | **String** | chain specific quote notes | +**dust_threshold** | Option<**String**> | Defines the minimum transaction size for the chain in base units (sats, wei, uatom). Transctions with asset amounts lower than the dust_threshold are ignored. | [optional] +**recommended_min_amount_in** | Option<**String**> | The recommended minimum inbound amount for this transaction type & inbound asset. Sending less than this amount could result in failed refunds. | [optional] +**memo** | **String** | generated memo for the withdraw, the client can use this OR send the dust amount | +**dust_amount** | **String** | the dust amount of the target asset the user should send to initialize the withdraw, the client can send this OR provide the memo | +**expected_amount_out** | **String** | the amount of the target asset the user can expect to withdraw after fees in 1e8 decimals | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/QuoteSwapResponse.md b/thorchain-rs/docs/QuoteSwapResponse.md new file mode 100644 index 0000000..8a254f0 --- /dev/null +++ b/thorchain-rs/docs/QuoteSwapResponse.md @@ -0,0 +1,31 @@ +# QuoteSwapResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**inbound_address** | Option<**String**> | the inbound address for the transaction on the source chain | [optional] +**inbound_confirmation_blocks** | Option<**i64**> | the approximate number of source chain blocks required before processing | [optional] +**inbound_confirmation_seconds** | Option<**i64**> | the approximate seconds for block confirmations required before processing | [optional] +**outbound_delay_blocks** | **i64** | the number of thorchain blocks the outbound will be delayed | +**outbound_delay_seconds** | **i64** | the approximate seconds for the outbound delay before it will be sent | +**fees** | [**crate::models::QuoteFees**](QuoteFees.md) | | +**slippage_bps** | **i64** | the total swap slippage in basis points | +**streaming_slippage_bps** | **i64** | the total streaming swap slippage in basis points | +**router** | Option<**String**> | the EVM chain router contract address | [optional] +**expiry** | **i64** | expiration timestamp in unix seconds | +**warning** | **String** | static warning message | +**notes** | **String** | chain specific quote notes | +**dust_threshold** | Option<**String**> | Defines the minimum transaction size for the chain in base units (sats, wei, uatom). Transctions with asset amounts lower than the dust_threshold are ignored. | [optional] +**recommended_min_amount_in** | Option<**String**> | The recommended minimum inbound amount for this transaction type & inbound asset. Sending less than this amount could result in failed refunds. | [optional] +**memo** | Option<**String**> | generated memo for the swap | [optional] +**expected_amount_out** | **String** | the amount of the target asset the user can expect to receive after fees | +**expected_amount_out_streaming** | **String** | the amount of the target asset the user can expect to receive after fees for a streaming swap | +**max_streaming_quantity** | Option<**i64**> | the maxiumum amount of trades a streaming swap can do for a trade | [optional] +**streaming_swap_blocks** | Option<**i64**> | the number of blocks the streaming swap will execute over | [optional] +**streaming_swap_seconds** | Option<**i64**> | approx the number of seconds the streaming swap will execute over | [optional] +**total_swap_seconds** | Option<**i64**> | total number of seconds a swap is expected to take (inbound conf + streaming swap + outbound delay) | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/Saver.md b/thorchain-rs/docs/Saver.md new file mode 100644 index 0000000..ed6462a --- /dev/null +++ b/thorchain-rs/docs/Saver.md @@ -0,0 +1,18 @@ +# Saver + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**asset** | **String** | | +**asset_address** | **String** | | +**last_add_height** | Option<**i64**> | | [optional] +**last_withdraw_height** | Option<**i64**> | | [optional] +**units** | **String** | | +**asset_deposit_value** | **String** | | +**asset_redeem_value** | **String** | | +**growth_pct** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/SaversApi.md b/thorchain-rs/docs/SaversApi.md new file mode 100644 index 0000000..2d9ae7a --- /dev/null +++ b/thorchain-rs/docs/SaversApi.md @@ -0,0 +1,73 @@ +# \SaversApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**saver**](SaversApi.md#saver) | **GET** /thorchain/pool/{asset}/saver/{address} | +[**savers**](SaversApi.md#savers) | **GET** /thorchain/pool/{asset}/savers | + + + +## saver + +> crate::models::Saver saver(asset, address, height) + + +Returns the saver position given then savers pool and address. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**asset** | **String** | | [required] | +**address** | **String** | | [required] | +**height** | Option<**i64**> | optional block height, defaults to current tip | | + +### Return type + +[**crate::models::Saver**](Saver.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## savers + +> Vec savers(asset, height) + + +Returns all savers for the savers pool. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**asset** | **String** | | [required] | +**height** | Option<**i64**> | optional block height, defaults to current tip | | + +### Return type + +[**Vec**](Saver.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/thorchain-rs/docs/StreamingSwap.md b/thorchain-rs/docs/StreamingSwap.md new file mode 100644 index 0000000..26e93c2 --- /dev/null +++ b/thorchain-rs/docs/StreamingSwap.md @@ -0,0 +1,21 @@ +# StreamingSwap + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**tx_id** | Option<**String**> | the hash of a transaction | [optional] +**interval** | Option<**i32**> | how often each swap is made, in blocks | [optional] +**quantity** | Option<**i32**> | the total number of swaps in a streaming swaps | [optional] +**count** | Option<**i32**> | the amount of swap attempts so far | [optional] +**last_height** | Option<**i64**> | the block height of the latest swap | [optional] +**trade_target** | Option<**String**> | the total number of tokens the swapper wants to receive of the output asset | [optional] +**deposit** | Option<**String**> | the number of input tokens the swapper has deposited | [optional] +**r#in** | Option<**String**> | the amount of input tokens that have been swapped so far | [optional] +**out** | Option<**String**> | the amount of output tokens that have been swapped so far | [optional] +**failed_swaps** | Option<**Vec**> | the list of swap indexes that failed | [optional] +**failed_swap_reasons** | Option<**Vec**> | the list of reasons that sub-swaps have failed | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/StreamingSwapApi.md b/thorchain-rs/docs/StreamingSwapApi.md new file mode 100644 index 0000000..8b7b426 --- /dev/null +++ b/thorchain-rs/docs/StreamingSwapApi.md @@ -0,0 +1,71 @@ +# \StreamingSwapApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**stream_swap**](StreamingSwapApi.md#stream_swap) | **GET** /thorchain/swap/streaming/{hash} | +[**stream_swaps**](StreamingSwapApi.md#stream_swaps) | **GET** /thorchain/swaps/streaming | + + + +## stream_swap + +> crate::models::StreamingSwap stream_swap(hash, height) + + +Returns the state of a streaming swap + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**hash** | **String** | | [required] | +**height** | Option<**i64**> | optional block height, defaults to current tip | | + +### Return type + +[**crate::models::StreamingSwap**](StreamingSwap.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## stream_swaps + +> Vec stream_swaps(height) + + +Returns the state of all streaming swaps + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**height** | Option<**i64**> | optional block height, defaults to current tip | | + +### Return type + +[**Vec**](StreamingSwap.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/thorchain-rs/docs/Thorname.md b/thorchain-rs/docs/Thorname.md new file mode 100644 index 0000000..0001c70 --- /dev/null +++ b/thorchain-rs/docs/Thorname.md @@ -0,0 +1,16 @@ +# Thorname + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | Option<**String**> | | [optional] +**expire_block_height** | Option<**i64**> | | [optional] +**owner** | Option<**String**> | | [optional] +**preferred_asset** | **String** | | +**affiliate_collector_rune** | Option<**String**> | Amount of RUNE currently accrued by this thorname in affiliate fees waiting to be swapped to preferred asset. | [optional] +**aliases** | [**Vec**](ThornameAlias.md) | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/ThornameAlias.md b/thorchain-rs/docs/ThornameAlias.md new file mode 100644 index 0000000..2c2a3bc --- /dev/null +++ b/thorchain-rs/docs/ThornameAlias.md @@ -0,0 +1,12 @@ +# ThornameAlias + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**chain** | Option<**String**> | | [optional] +**address** | Option<**String**> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/ThornamesApi.md b/thorchain-rs/docs/ThornamesApi.md new file mode 100644 index 0000000..cbc661d --- /dev/null +++ b/thorchain-rs/docs/ThornamesApi.md @@ -0,0 +1,40 @@ +# \ThornamesApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**thorname**](ThornamesApi.md#thorname) | **GET** /thorchain/thorname/{name} | + + + +## thorname + +> Vec thorname(name, height) + + +Returns addresses registered to the provided thorname. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**name** | **String** | the thornode to lookup | [required] | +**height** | Option<**i64**> | optional block height, defaults to current tip | | + +### Return type + +[**Vec**](Thorname.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/thorchain-rs/docs/TransactionsApi.md b/thorchain-rs/docs/TransactionsApi.md new file mode 100644 index 0000000..be37312 --- /dev/null +++ b/thorchain-rs/docs/TransactionsApi.md @@ -0,0 +1,104 @@ +# \TransactionsApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**tx**](TransactionsApi.md#tx) | **GET** /thorchain/tx/{hash} | +[**tx_signers**](TransactionsApi.md#tx_signers) | **GET** /thorchain/tx/details/{hash} | +[**tx_signers_old**](TransactionsApi.md#tx_signers_old) | **GET** /thorchain/tx/{hash}/signers | + + + +## tx + +> crate::models::TxResponse tx(hash, height) + + +Returns the observed transaction for a provided inbound or outbound hash. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**hash** | **String** | | [required] | +**height** | Option<**i64**> | optional block height, defaults to current tip | | + +### Return type + +[**crate::models::TxResponse**](TxResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## tx_signers + +> crate::models::TxDetailsResponse tx_signers(hash, height) + + +Returns the signers for a provided inbound or outbound hash. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**hash** | **String** | | [required] | +**height** | Option<**i64**> | optional block height, defaults to current tip | | + +### Return type + +[**crate::models::TxDetailsResponse**](TxDetailsResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## tx_signers_old + +> crate::models::TxSignersResponse tx_signers_old(hash, height) + + +Deprecated - migrate to /thorchain/tx/details. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**hash** | **String** | | [required] | +**height** | Option<**i64**> | optional block height, defaults to current tip | | + +### Return type + +[**crate::models::TxSignersResponse**](TxSignersResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/thorchain-rs/docs/TssApi.md b/thorchain-rs/docs/TssApi.md new file mode 100644 index 0000000..8e10595 --- /dev/null +++ b/thorchain-rs/docs/TssApi.md @@ -0,0 +1,134 @@ +# \TssApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**keysign**](TssApi.md#keysign) | **GET** /thorchain/keysign/{height} | +[**keysign_pubkey**](TssApi.md#keysign_pubkey) | **GET** /thorchain/keysign/{height}/{pubkey} | +[**metrics**](TssApi.md#metrics) | **GET** /thorchain/metrics | +[**metrics_keygen**](TssApi.md#metrics_keygen) | **GET** /thorchain/metric/keygen/{pubkey} | + + + +## keysign + +> crate::models::KeysignResponse keysign(height) + + +Returns keysign information for the provided height - the height being the first block a tx out item appears in the signed-but-unobserved outbound queue. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**height** | **i64** | | [required] | + +### Return type + +[**crate::models::KeysignResponse**](KeysignResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## keysign_pubkey + +> crate::models::KeysignResponse keysign_pubkey(height, pubkey) + + +Returns keysign information for the provided height and pubkey - the height being the block at which a tx out item is scheduled to be signed and moved from the scheduled outbound queue to the outbound queue. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**height** | **i64** | | [required] | +**pubkey** | **String** | | [required] | + +### Return type + +[**crate::models::KeysignResponse**](KeysignResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## metrics + +> crate::models::MetricsResponse metrics(height) + + +Returns keygen and keysign metrics for current vaults. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**height** | Option<**i64**> | optional block height, defaults to current tip | | + +### Return type + +[**crate::models::MetricsResponse**](MetricsResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## metrics_keygen + +> Vec metrics_keygen(pubkey, height) + + +Returns keygen metrics for the provided vault pubkey. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**pubkey** | **String** | | [required] | +**height** | Option<**i64**> | optional block height, defaults to current tip | | + +### Return type + +[**Vec**](KeygenMetric.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/thorchain-rs/docs/TssKeysignMetric.md b/thorchain-rs/docs/TssKeysignMetric.md new file mode 100644 index 0000000..18c05da --- /dev/null +++ b/thorchain-rs/docs/TssKeysignMetric.md @@ -0,0 +1,12 @@ +# TssKeysignMetric + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**tx_id** | Option<**String**> | | [optional] +**node_tss_times** | [**Vec**](TssMetric.md) | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/TssMetric.md b/thorchain-rs/docs/TssMetric.md new file mode 100644 index 0000000..c388a81 --- /dev/null +++ b/thorchain-rs/docs/TssMetric.md @@ -0,0 +1,12 @@ +# TssMetric + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**address** | Option<**String**> | | [optional] +**tss_time** | Option<**i64**> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/Tx.md b/thorchain-rs/docs/Tx.md new file mode 100644 index 0000000..24c6cc6 --- /dev/null +++ b/thorchain-rs/docs/Tx.md @@ -0,0 +1,17 @@ +# Tx + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | Option<**String**> | | [optional] +**chain** | Option<**String**> | | [optional] +**from_address** | Option<**String**> | | [optional] +**to_address** | Option<**String**> | | [optional] +**coins** | [**Vec**](Coin.md) | | +**gas** | [**Vec**](Coin.md) | | +**memo** | Option<**String**> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/TxDetailsResponse.md b/thorchain-rs/docs/TxDetailsResponse.md new file mode 100644 index 0000000..f616f17 --- /dev/null +++ b/thorchain-rs/docs/TxDetailsResponse.md @@ -0,0 +1,20 @@ +# TxDetailsResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**tx_id** | Option<**String**> | | [optional] +**tx** | [**crate::models::ObservedTx**](ObservedTx.md) | | +**txs** | [**Vec**](ObservedTx.md) | | +**actions** | [**Vec**](TxOutItem.md) | | +**out_txs** | [**Vec**](Tx.md) | | +**consensus_height** | Option<**i64**> | the thorchain height at which the inbound reached consensus | [optional] +**finalised_height** | Option<**i64**> | the thorchain height at which the outbound was finalised | [optional] +**updated_vault** | Option<**bool**> | | [optional] +**reverted** | Option<**bool**> | | [optional] +**outbound_height** | Option<**i64**> | the thorchain height for which the outbound was scheduled | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/TxOutItem.md b/thorchain-rs/docs/TxOutItem.md new file mode 100644 index 0000000..002d947 --- /dev/null +++ b/thorchain-rs/docs/TxOutItem.md @@ -0,0 +1,20 @@ +# TxOutItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**chain** | **String** | | +**to_address** | **String** | | +**vault_pub_key** | Option<**String**> | | [optional] +**coin** | [**crate::models::Coin**](Coin.md) | | +**memo** | Option<**String**> | | [optional] +**max_gas** | [**Vec**](Coin.md) | | +**gas_rate** | Option<**i64**> | | [optional] +**in_hash** | Option<**String**> | | [optional] +**out_hash** | Option<**String**> | | [optional] +**height** | **i64** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/TxResponse.md b/thorchain-rs/docs/TxResponse.md new file mode 100644 index 0000000..460abe9 --- /dev/null +++ b/thorchain-rs/docs/TxResponse.md @@ -0,0 +1,15 @@ +# TxResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**observed_tx** | Option<[**crate::models::ObservedTx**](ObservedTx.md)> | | [optional] +**consensus_height** | Option<**i64**> | the thorchain height at which the inbound reached consensus | [optional] +**finalised_height** | Option<**i64**> | the thorchain height at which the outbound was finalised | [optional] +**outbound_height** | Option<**i64**> | the thorchain height for which the outbound was scheduled | [optional] +**keysign_metric** | Option<[**crate::models::TssKeysignMetric**](TssKeysignMetric.md)> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/TxSignersResponse.md b/thorchain-rs/docs/TxSignersResponse.md new file mode 100644 index 0000000..1605024 --- /dev/null +++ b/thorchain-rs/docs/TxSignersResponse.md @@ -0,0 +1,20 @@ +# TxSignersResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**tx_id** | Option<**String**> | | [optional] +**tx** | [**crate::models::ObservedTx**](ObservedTx.md) | | +**txs** | [**Vec**](ObservedTx.md) | | +**actions** | [**Vec**](TxOutItem.md) | | +**out_txs** | [**Vec**](Tx.md) | | +**consensus_height** | Option<**i64**> | the thorchain height at which the inbound reached consensus | [optional] +**finalised_height** | Option<**i64**> | the thorchain height at which the outbound was finalised | [optional] +**updated_vault** | Option<**bool**> | | [optional] +**reverted** | Option<**bool**> | | [optional] +**outbound_height** | Option<**i64**> | the thorchain height for which the outbound was scheduled | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/TxStagesResponse.md b/thorchain-rs/docs/TxStagesResponse.md new file mode 100644 index 0000000..32f5005 --- /dev/null +++ b/thorchain-rs/docs/TxStagesResponse.md @@ -0,0 +1,17 @@ +# TxStagesResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**inbound_observed** | [**crate::models::TxStagesResponseInboundObserved**](TxStagesResponse_inbound_observed.md) | | +**inbound_confirmation_counted** | Option<[**crate::models::TxStagesResponseInboundConfirmationCounted**](TxStagesResponse_inbound_confirmation_counted.md)> | | [optional] +**inbound_finalised** | Option<[**crate::models::TxStagesResponseInboundFinalised**](TxStagesResponse_inbound_finalised.md)> | | [optional] +**swap_status** | Option<[**crate::models::TxStagesResponseSwapStatus**](TxStagesResponse_swap_status.md)> | | [optional] +**swap_finalised** | Option<[**crate::models::TxStagesResponseSwapFinalised**](TxStagesResponse_swap_finalised.md)> | | [optional] +**outbound_delay** | Option<[**crate::models::TxStagesResponseOutboundDelay**](TxStagesResponse_outbound_delay.md)> | | [optional] +**outbound_signed** | Option<[**crate::models::TxStagesResponseOutboundSigned**](TxStagesResponse_outbound_signed.md)> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/TxStagesResponseInboundConfirmationCounted.md b/thorchain-rs/docs/TxStagesResponseInboundConfirmationCounted.md new file mode 100644 index 0000000..7cc439a --- /dev/null +++ b/thorchain-rs/docs/TxStagesResponseInboundConfirmationCounted.md @@ -0,0 +1,16 @@ +# TxStagesResponseInboundConfirmationCounted + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**counting_start_height** | Option<**i64**> | the THORChain block height when confirmation counting began | [optional] +**chain** | Option<**String**> | the external source chain for which confirmation counting takes place | [optional] +**external_observed_height** | Option<**i64**> | the block height on the external source chain when the transaction was observed | [optional] +**external_confirmation_delay_height** | Option<**i64**> | the block height on the external source chain when confirmation counting will be complete | [optional] +**remaining_confirmation_seconds** | Option<**i64**> | the estimated remaining seconds before confirmation counting completes | [optional] +**completed** | **bool** | returns true if no transaction confirmation counting remains to be done | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/TxStagesResponseInboundFinalised.md b/thorchain-rs/docs/TxStagesResponseInboundFinalised.md new file mode 100644 index 0000000..c123580 --- /dev/null +++ b/thorchain-rs/docs/TxStagesResponseInboundFinalised.md @@ -0,0 +1,11 @@ +# TxStagesResponseInboundFinalised + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**completed** | **bool** | returns true if the inbound transaction has been finalised (THORChain agreeing it exists) | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/TxStagesResponseInboundObserved.md b/thorchain-rs/docs/TxStagesResponseInboundObserved.md new file mode 100644 index 0000000..ea515c9 --- /dev/null +++ b/thorchain-rs/docs/TxStagesResponseInboundObserved.md @@ -0,0 +1,14 @@ +# TxStagesResponseInboundObserved + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**started** | Option<**bool**> | returns true if any nodes have observed the transaction (to be deprecated in favour of counts) | [optional] +**pre_confirmation_count** | Option<**i32**> | number of signers for pre-confirmation-counting observations | [optional] +**final_count** | Option<**i32**> | number of signers for final observations, after any confirmation counting complete | [optional] +**completed** | **bool** | returns true if no transaction observation remains to be done | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/TxStagesResponseOutboundDelay.md b/thorchain-rs/docs/TxStagesResponseOutboundDelay.md new file mode 100644 index 0000000..0540406 --- /dev/null +++ b/thorchain-rs/docs/TxStagesResponseOutboundDelay.md @@ -0,0 +1,13 @@ +# TxStagesResponseOutboundDelay + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**remaining_delay_blocks** | Option<**i64**> | the number of remaining THORChain blocks the outbound will be delayed | [optional] +**remaining_delay_seconds** | Option<**i64**> | the estimated remaining seconds of the outbound delay before it will be sent | [optional] +**completed** | **bool** | returns true if no transaction outbound delay remains | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/TxStagesResponseOutboundSigned.md b/thorchain-rs/docs/TxStagesResponseOutboundSigned.md new file mode 100644 index 0000000..f9e09bf --- /dev/null +++ b/thorchain-rs/docs/TxStagesResponseOutboundSigned.md @@ -0,0 +1,13 @@ +# TxStagesResponseOutboundSigned + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**scheduled_outbound_height** | Option<**i64**> | THORChain height for which the external outbound is scheduled | [optional] +**blocks_since_scheduled** | Option<**i64**> | THORChain blocks since the scheduled outbound height | [optional] +**completed** | **bool** | returns true if an external transaction has been signed and broadcast (and observed in its mempool) | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/TxStagesResponseSwapFinalised.md b/thorchain-rs/docs/TxStagesResponseSwapFinalised.md new file mode 100644 index 0000000..b77f5f2 --- /dev/null +++ b/thorchain-rs/docs/TxStagesResponseSwapFinalised.md @@ -0,0 +1,11 @@ +# TxStagesResponseSwapFinalised + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**completed** | **bool** | (to be deprecated in favor of swap_status) returns true if an inbound transaction's swap (successful or refunded) is no longer pending | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/TxStagesResponseSwapStatus.md b/thorchain-rs/docs/TxStagesResponseSwapStatus.md new file mode 100644 index 0000000..13e758b --- /dev/null +++ b/thorchain-rs/docs/TxStagesResponseSwapStatus.md @@ -0,0 +1,12 @@ +# TxStagesResponseSwapStatus + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**pending** | **bool** | true when awaiting a swap | +**streaming** | Option<[**crate::models::TxStagesResponseSwapStatusStreaming**](TxStagesResponse_swap_status_streaming.md)> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/TxStagesResponseSwapStatusStreaming.md b/thorchain-rs/docs/TxStagesResponseSwapStatusStreaming.md new file mode 100644 index 0000000..f759536 --- /dev/null +++ b/thorchain-rs/docs/TxStagesResponseSwapStatusStreaming.md @@ -0,0 +1,13 @@ +# TxStagesResponseSwapStatusStreaming + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**interval** | **i32** | how often each swap is made, in blocks | +**quantity** | **i32** | the total number of swaps in a streaming swaps | +**count** | **i32** | the amount of swap attempts so far | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/TxStatusResponse.md b/thorchain-rs/docs/TxStatusResponse.md new file mode 100644 index 0000000..6c14e2c --- /dev/null +++ b/thorchain-rs/docs/TxStatusResponse.md @@ -0,0 +1,14 @@ +# TxStatusResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**tx** | Option<[**crate::models::Tx**](Tx.md)> | | [optional] +**planned_out_txs** | Option<[**Vec**](TxStatusResponse_planned_out_txs_inner.md)> | | [optional] +**out_txs** | Option<[**Vec**](Tx.md)> | | [optional] +**stages** | [**crate::models::TxStagesResponse**](TxStagesResponse.md) | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/TxStatusResponsePlannedOutTxsInner.md b/thorchain-rs/docs/TxStatusResponsePlannedOutTxsInner.md new file mode 100644 index 0000000..71b6137 --- /dev/null +++ b/thorchain-rs/docs/TxStatusResponsePlannedOutTxsInner.md @@ -0,0 +1,14 @@ +# TxStatusResponsePlannedOutTxsInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**chain** | **String** | | +**to_address** | **String** | | +**coin** | [**crate::models::Coin**](Coin.md) | | +**refund** | **bool** | returns true if the planned transaction has a refund memo | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/Vault.md b/thorchain-rs/docs/Vault.md new file mode 100644 index 0000000..8464481 --- /dev/null +++ b/thorchain-rs/docs/Vault.md @@ -0,0 +1,24 @@ +# Vault + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**block_height** | Option<**i64**> | | [optional] +**pub_key** | Option<**String**> | | [optional] +**coins** | [**Vec**](Coin.md) | | +**r#type** | Option<**String**> | | [optional] +**status** | Option<**String**> | | [optional] +**status_since** | Option<**i64**> | | [optional] +**membership** | Option<**Vec**> | the list of node public keys which are members of the vault | [optional] +**chains** | Option<**Vec**> | | [optional] +**inbound_tx_count** | Option<**i64**> | | [optional] +**outbound_tx_count** | Option<**i64**> | | [optional] +**pending_tx_block_heights** | Option<**Vec**> | | [optional] +**routers** | [**Vec**](VaultRouter.md) | | +**addresses** | [**Vec**](VaultAddress.md) | | +**frozen** | Option<**Vec**> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/VaultAddress.md b/thorchain-rs/docs/VaultAddress.md new file mode 100644 index 0000000..07c4f79 --- /dev/null +++ b/thorchain-rs/docs/VaultAddress.md @@ -0,0 +1,12 @@ +# VaultAddress + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**chain** | Option<**String**> | | [optional] +**address** | Option<**String**> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/VaultInfo.md b/thorchain-rs/docs/VaultInfo.md new file mode 100644 index 0000000..eb4edcd --- /dev/null +++ b/thorchain-rs/docs/VaultInfo.md @@ -0,0 +1,12 @@ +# VaultInfo + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**pub_key** | **String** | | +**routers** | [**Vec**](VaultRouter.md) | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/VaultPubkeysResponse.md b/thorchain-rs/docs/VaultPubkeysResponse.md new file mode 100644 index 0000000..c2c913a --- /dev/null +++ b/thorchain-rs/docs/VaultPubkeysResponse.md @@ -0,0 +1,13 @@ +# VaultPubkeysResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**asgard** | [**Vec**](VaultInfo.md) | | +**yggdrasil** | [**Vec**](VaultInfo.md) | | +**inactive** | [**Vec**](VaultInfo.md) | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/VaultRouter.md b/thorchain-rs/docs/VaultRouter.md new file mode 100644 index 0000000..1a24133 --- /dev/null +++ b/thorchain-rs/docs/VaultRouter.md @@ -0,0 +1,12 @@ +# VaultRouter + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**chain** | Option<**String**> | | [optional] +**router** | Option<**String**> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/docs/VaultsApi.md b/thorchain-rs/docs/VaultsApi.md new file mode 100644 index 0000000..3e5a0a8 --- /dev/null +++ b/thorchain-rs/docs/VaultsApi.md @@ -0,0 +1,133 @@ +# \VaultsApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**asgard**](VaultsApi.md#asgard) | **GET** /thorchain/vaults/asgard | +[**vault**](VaultsApi.md#vault) | **GET** /thorchain/vault/{pubkey} | +[**vault_pubkeys**](VaultsApi.md#vault_pubkeys) | **GET** /thorchain/vaults/pubkeys | +[**yggdrasil**](VaultsApi.md#yggdrasil) | **GET** /thorchain/vaults/yggdrasil | + + + +## asgard + +> Vec asgard(height) + + +Returns current asgard vaults. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**height** | Option<**i64**> | optional block height, defaults to current tip | | + +### Return type + +[**Vec**](Vault.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## vault + +> crate::models::Vault vault(pubkey, height) + + +Returns the vault for the provided pubkey. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**pubkey** | **String** | | [required] | +**height** | Option<**i64**> | optional block height, defaults to current tip | | + +### Return type + +[**crate::models::Vault**](Vault.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## vault_pubkeys + +> crate::models::VaultPubkeysResponse vault_pubkeys(height) + + +Returns all pubkeys for current vaults. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**height** | Option<**i64**> | optional block height, defaults to current tip | | + +### Return type + +[**crate::models::VaultPubkeysResponse**](VaultPubkeysResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## yggdrasil + +> Vec yggdrasil(height) + + +Returns current yggdrasil vaults. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**height** | Option<**i64**> | optional block height, defaults to current tip | | + +### Return type + +[**Vec**](Vault.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/thorchain-rs/docs/VersionResponse.md b/thorchain-rs/docs/VersionResponse.md new file mode 100644 index 0000000..6f237f5 --- /dev/null +++ b/thorchain-rs/docs/VersionResponse.md @@ -0,0 +1,14 @@ +# VersionResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**current** | **String** | current version | +**next** | **String** | next version (minimum version for a node to become Active) | +**next_since_height** | Option<**i64**> | height at which the minimum joining version last changed | [optional] +**querier** | **String** | querier version | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thorchain-rs/git_push.sh b/thorchain-rs/git_push.sh new file mode 100644 index 0000000..f53a75d --- /dev/null +++ b/thorchain-rs/git_push.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=$(git remote) +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/thorchain-rs/src/apis/borrowers_api.rs b/thorchain-rs/src/apis/borrowers_api.rs new file mode 100644 index 0000000..81ffb3a --- /dev/null +++ b/thorchain-rs/src/apis/borrowers_api.rs @@ -0,0 +1,122 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + +use reqwest; + +use crate::apis::ResponseContent; +use super::{Error, configuration}; + +/// struct for passing parameters to the method [`borrower`] +#[derive(Clone, Debug, Default)] +pub struct BorrowerParams { + pub asset: String, + pub address: String, + /// optional block height, defaults to current tip + pub height: Option +} + +/// struct for passing parameters to the method [`borrowers`] +#[derive(Clone, Debug, Default)] +pub struct BorrowersParams { + pub asset: String, + /// optional block height, defaults to current tip + pub height: Option +} + + +/// struct for typed errors of method [`borrower`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum BorrowerError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`borrowers`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum BorrowersError { + UnknownValue(serde_json::Value), +} + + +/// Returns the borrower position given the pool and address. +pub async fn borrower(configuration: &configuration::Configuration, params: BorrowerParams) -> Result> { + let local_var_configuration = configuration; + + // unbox the parameters + let asset = params.asset; + let address = params.address; + let height = params.height; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/pool/{asset}/borrower/{address}", local_var_configuration.base_path, asset=crate::apis::urlencode(asset), address=crate::apis::urlencode(address)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = height { + local_var_req_builder = local_var_req_builder.query(&[("height", &local_var_str.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + +/// Returns all borrowers for the given pool. +pub async fn borrowers(configuration: &configuration::Configuration, params: BorrowersParams) -> Result, Error> { + let local_var_configuration = configuration; + + // unbox the parameters + let asset = params.asset; + let height = params.height; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/pool/{asset}/borrowers", local_var_configuration.base_path, asset=crate::apis::urlencode(asset)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = height { + local_var_req_builder = local_var_req_builder.query(&[("height", &local_var_str.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + diff --git a/thorchain-rs/src/apis/configuration.rs b/thorchain-rs/src/apis/configuration.rs new file mode 100644 index 0000000..6fef228 --- /dev/null +++ b/thorchain-rs/src/apis/configuration.rs @@ -0,0 +1,57 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + +extern crate dotenv; + +use dotenv::dotenv; +use std::env; + +#[derive(Debug, Clone)] +pub struct Configuration { + pub base_path: String, + pub user_agent: Option, + pub client: reqwest::Client, + pub basic_auth: Option, + pub oauth_access_token: Option, + pub bearer_access_token: Option, + pub api_key: Option, + // TODO: take an oauth2 token source, similar to the go one +} + +pub type BasicAuth = (String, Option); + +#[derive(Debug, Clone)] +pub struct ApiKey { + pub prefix: Option, + pub key: String, +} + +impl Configuration { + pub fn new() -> Configuration { + Configuration::default() + } +} + +impl Default for Configuration { + fn default() -> Self { + dotenv().ok(); + let hostname = env::var("REMOTE_NODENAME").expect("REMOTE_NODENAME must be set"); + + Configuration { + base_path: hostname.to_owned(), + user_agent: Some("OpenAPI-Generator/1.119.0/rust".to_owned()), + client: reqwest::Client::new(), + basic_auth: None, + oauth_access_token: None, + bearer_access_token: None, + api_key: None, + } + } +} diff --git a/thorchain-rs/src/apis/health_api.rs b/thorchain-rs/src/apis/health_api.rs new file mode 100644 index 0000000..98b6279 --- /dev/null +++ b/thorchain-rs/src/apis/health_api.rs @@ -0,0 +1,55 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + +use reqwest; + +use crate::apis::ResponseContent; +use super::{Error, configuration}; + + +/// struct for typed errors of method [`ping`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum PingError { + UnknownValue(serde_json::Value), +} + + +pub async fn ping(configuration: &configuration::Configuration) -> Result> { + let local_var_configuration = configuration; + + // unbox the parameters + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/ping", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + diff --git a/thorchain-rs/src/apis/invariants_api.rs b/thorchain-rs/src/apis/invariants_api.rs new file mode 100644 index 0000000..b84c09b --- /dev/null +++ b/thorchain-rs/src/apis/invariants_api.rs @@ -0,0 +1,118 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + +use reqwest; + +use crate::apis::ResponseContent; +use super::{Error, configuration}; + +/// struct for passing parameters to the method [`invariant`] +#[derive(Clone, Debug, Default)] +pub struct InvariantParams { + pub invariant: String, + /// optional block height, defaults to current tip + pub height: Option +} + +/// struct for passing parameters to the method [`invariants`] +#[derive(Clone, Debug, Default)] +pub struct InvariantsParams { + /// optional block height, defaults to current tip + pub height: Option +} + + +/// struct for typed errors of method [`invariant`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum InvariantError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`invariants`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum InvariantsError { + UnknownValue(serde_json::Value), +} + + +/// Returns result of running the given invariant. +pub async fn invariant(configuration: &configuration::Configuration, params: InvariantParams) -> Result> { + let local_var_configuration = configuration; + + // unbox the parameters + let invariant = params.invariant; + let height = params.height; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/invariant/{invariant}", local_var_configuration.base_path, invariant=crate::apis::urlencode(invariant)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = height { + local_var_req_builder = local_var_req_builder.query(&[("height", &local_var_str.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + +/// Returns a list of available invariants. +pub async fn invariants(configuration: &configuration::Configuration, params: InvariantsParams) -> Result> { + let local_var_configuration = configuration; + + // unbox the parameters + let height = params.height; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/invariants", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = height { + local_var_req_builder = local_var_req_builder.query(&[("height", &local_var_str.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + diff --git a/thorchain-rs/src/apis/liquidity_providers_api.rs b/thorchain-rs/src/apis/liquidity_providers_api.rs new file mode 100644 index 0000000..6ebce1f --- /dev/null +++ b/thorchain-rs/src/apis/liquidity_providers_api.rs @@ -0,0 +1,122 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + +use reqwest; + +use crate::apis::ResponseContent; +use super::{Error, configuration}; + +/// struct for passing parameters to the method [`liquidity_provider`] +#[derive(Clone, Debug, Default)] +pub struct LiquidityProviderParams { + pub asset: String, + pub address: String, + /// optional block height, defaults to current tip + pub height: Option +} + +/// struct for passing parameters to the method [`liquidity_providers`] +#[derive(Clone, Debug, Default)] +pub struct LiquidityProvidersParams { + pub asset: String, + /// optional block height, defaults to current tip + pub height: Option +} + + +/// struct for typed errors of method [`liquidity_provider`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum LiquidityProviderError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`liquidity_providers`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum LiquidityProvidersError { + UnknownValue(serde_json::Value), +} + + +/// Returns the liquidity provider information for an address and asset. +pub async fn liquidity_provider(configuration: &configuration::Configuration, params: LiquidityProviderParams) -> Result> { + let local_var_configuration = configuration; + + // unbox the parameters + let asset = params.asset; + let address = params.address; + let height = params.height; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/pool/{asset}/liquidity_provider/{address}", local_var_configuration.base_path, asset=crate::apis::urlencode(asset), address=crate::apis::urlencode(address)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = height { + local_var_req_builder = local_var_req_builder.query(&[("height", &local_var_str.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + +/// Returns all liquidity provider information for an asset. +pub async fn liquidity_providers(configuration: &configuration::Configuration, params: LiquidityProvidersParams) -> Result, Error> { + let local_var_configuration = configuration; + + // unbox the parameters + let asset = params.asset; + let height = params.height; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/pool/{asset}/liquidity_providers", local_var_configuration.base_path, asset=crate::apis::urlencode(asset)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = height { + local_var_req_builder = local_var_req_builder.query(&[("height", &local_var_str.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + diff --git a/thorchain-rs/src/apis/mimir_api.rs b/thorchain-rs/src/apis/mimir_api.rs new file mode 100644 index 0000000..cd8e622 --- /dev/null +++ b/thorchain-rs/src/apis/mimir_api.rs @@ -0,0 +1,268 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + +use reqwest; + +use crate::apis::ResponseContent; +use super::{Error, configuration}; + +/// struct for passing parameters to the method [`mimir`] +#[derive(Clone, Debug, Default)] +pub struct MimirParams { + /// optional block height, defaults to current tip + pub height: Option +} + +/// struct for passing parameters to the method [`mimir_admin`] +#[derive(Clone, Debug, Default)] +pub struct MimirAdminParams { + /// optional block height, defaults to current tip + pub height: Option +} + +/// struct for passing parameters to the method [`mimir_key`] +#[derive(Clone, Debug, Default)] +pub struct MimirKeyParams { + /// the mimir key to lookup + pub key: String, + /// optional block height, defaults to current tip + pub height: Option +} + +/// struct for passing parameters to the method [`mimir_node`] +#[derive(Clone, Debug, Default)] +pub struct MimirNodeParams { + pub address: String, + /// optional block height, defaults to current tip + pub height: Option +} + +/// struct for passing parameters to the method [`mimir_nodes`] +#[derive(Clone, Debug, Default)] +pub struct MimirNodesParams { + /// optional block height, defaults to current tip + pub height: Option +} + + +/// struct for typed errors of method [`mimir`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum MimirError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`mimir_admin`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum MimirAdminError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`mimir_key`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum MimirKeyError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`mimir_node`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum MimirNodeError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`mimir_nodes`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum MimirNodesError { + UnknownValue(serde_json::Value), +} + + +/// Returns current active mimir configuration. +pub async fn mimir(configuration: &configuration::Configuration, params: MimirParams) -> Result<::std::collections::HashMap, Error> { + let local_var_configuration = configuration; + + // unbox the parameters + let height = params.height; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/mimir", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = height { + local_var_req_builder = local_var_req_builder.query(&[("height", &local_var_str.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + +/// Returns current admin mimir configuration. +pub async fn mimir_admin(configuration: &configuration::Configuration, params: MimirAdminParams) -> Result<::std::collections::HashMap, Error> { + let local_var_configuration = configuration; + + // unbox the parameters + let height = params.height; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/mimir/admin", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = height { + local_var_req_builder = local_var_req_builder.query(&[("height", &local_var_str.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + +/// Returns current active mimir configuration for the provided key. +pub async fn mimir_key(configuration: &configuration::Configuration, params: MimirKeyParams) -> Result> { + let local_var_configuration = configuration; + + // unbox the parameters + let key = params.key; + let height = params.height; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/mimir/key/{key}", local_var_configuration.base_path, key=crate::apis::urlencode(key)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = height { + local_var_req_builder = local_var_req_builder.query(&[("height", &local_var_str.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + +/// Returns current node mimir configuration for the provided node address. +pub async fn mimir_node(configuration: &configuration::Configuration, params: MimirNodeParams) -> Result<::std::collections::HashMap, Error> { + let local_var_configuration = configuration; + + // unbox the parameters + let address = params.address; + let height = params.height; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/mimir/node/{address}", local_var_configuration.base_path, address=crate::apis::urlencode(address)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = height { + local_var_req_builder = local_var_req_builder.query(&[("height", &local_var_str.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + +/// Returns current node mimir votes. +pub async fn mimir_nodes(configuration: &configuration::Configuration, params: MimirNodesParams) -> Result> { + let local_var_configuration = configuration; + + // unbox the parameters + let height = params.height; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/mimir/nodes_all", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = height { + local_var_req_builder = local_var_req_builder.query(&[("height", &local_var_str.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + diff --git a/thorchain-rs/src/apis/mod.rs b/thorchain-rs/src/apis/mod.rs new file mode 100644 index 0000000..194df6e --- /dev/null +++ b/thorchain-rs/src/apis/mod.rs @@ -0,0 +1,111 @@ +use std::error; +use std::fmt; + +#[derive(Debug, Clone)] +pub struct ResponseContent { + pub status: reqwest::StatusCode, + pub content: String, + pub entity: Option, +} + +#[derive(Debug)] +pub enum Error { + Reqwest(reqwest::Error), + Serde(serde_json::Error), + Io(std::io::Error), + ResponseError(ResponseContent), +} + +impl fmt::Display for Error { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + let (module, e) = match self { + Error::Reqwest(e) => ("reqwest", e.to_string()), + Error::Serde(e) => ("serde", e.to_string()), + Error::Io(e) => ("IO", e.to_string()), + Error::ResponseError(e) => ("response", format!("status code {}", e.status)), + }; + write!(f, "error in {}: {}", module, e) + } +} + +impl error::Error for Error { + fn source(&self) -> Option<&(dyn error::Error + 'static)> { + Some(match self { + Error::Reqwest(e) => e, + Error::Serde(e) => e, + Error::Io(e) => e, + Error::ResponseError(_) => return None, + }) + } +} + +impl From for Error { + fn from(e: reqwest::Error) -> Self { + Error::Reqwest(e) + } +} + +impl From for Error { + fn from(e: serde_json::Error) -> Self { + Error::Serde(e) + } +} + +impl From for Error { + fn from(e: std::io::Error) -> Self { + Error::Io(e) + } +} + +pub fn urlencode>(s: T) -> String { + ::url::form_urlencoded::byte_serialize(s.as_ref().as_bytes()).collect() +} + +pub fn parse_deep_object(prefix: &str, value: &serde_json::Value) -> Vec<(String, String)> { + if let serde_json::Value::Object(object) = value { + let mut params = vec![]; + + for (key, value) in object { + match value { + serde_json::Value::Object(_) => params.append(&mut parse_deep_object( + &format!("{}[{}]", prefix, key), + value, + )), + serde_json::Value::Array(array) => { + for (i, value) in array.iter().enumerate() { + params.append(&mut parse_deep_object( + &format!("{}[{}][{}]", prefix, key, i), + value, + )); + } + }, + serde_json::Value::String(s) => params.push((format!("{}[{}]", prefix, key), s.clone())), + _ => params.push((format!("{}[{}]", prefix, key), value.to_string())), + } + } + + return params; + } + + unimplemented!("Only objects are supported with style=deepObject") +} + +pub mod borrowers_api; +pub mod health_api; +pub mod invariants_api; +pub mod liquidity_providers_api; +pub mod mimir_api; +pub mod network_api; +pub mod nodes_api; +pub mod pol_api; +pub mod pools_api; +pub mod queue_api; +pub mod quote_api; +pub mod savers_api; +pub mod streaming_swap_api; +pub mod tss_api; +pub mod thornames_api; +pub mod transactions_api; +pub mod vaults_api; + +pub mod configuration; diff --git a/thorchain-rs/src/apis/network_api.rs b/thorchain-rs/src/apis/network_api.rs new file mode 100644 index 0000000..38848cf --- /dev/null +++ b/thorchain-rs/src/apis/network_api.rs @@ -0,0 +1,414 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + +use reqwest; + +use crate::apis::ResponseContent; +use super::{Error, configuration}; + +/// struct for passing parameters to the method [`ban`] +#[derive(Clone, Debug, Default)] +pub struct BanParams { + pub address: String, + /// optional block height, defaults to current tip + pub height: Option +} + +/// struct for passing parameters to the method [`constants`] +#[derive(Clone, Debug, Default)] +pub struct ConstantsParams { + /// optional block height, defaults to current tip + pub height: Option +} + +/// struct for passing parameters to the method [`inbound_addresses`] +#[derive(Clone, Debug, Default)] +pub struct InboundAddressesParams { + /// optional block height, defaults to current tip + pub height: Option +} + +/// struct for passing parameters to the method [`lastblock`] +#[derive(Clone, Debug, Default)] +pub struct LastblockParams { + /// optional block height, defaults to current tip + pub height: Option +} + +/// struct for passing parameters to the method [`lastblock_chain`] +#[derive(Clone, Debug, Default)] +pub struct LastblockChainParams { + pub chain: String, + /// optional block height, defaults to current tip + pub height: Option +} + +/// struct for passing parameters to the method [`network`] +#[derive(Clone, Debug, Default)] +pub struct NetworkParams { + /// optional block height, defaults to current tip + pub height: Option +} + +/// struct for passing parameters to the method [`ragnarok`] +#[derive(Clone, Debug, Default)] +pub struct RagnarokParams { + /// optional block height, defaults to current tip + pub height: Option +} + +/// struct for passing parameters to the method [`version`] +#[derive(Clone, Debug, Default)] +pub struct VersionParams { + /// optional block height, defaults to current tip + pub height: Option +} + + +/// struct for typed errors of method [`ban`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum BanError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`constants`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ConstantsError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`inbound_addresses`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum InboundAddressesError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`lastblock`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum LastblockError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`lastblock_chain`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum LastblockChainError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`network`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum NetworkError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`ragnarok`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum RagnarokError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`version`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum VersionError { + UnknownValue(serde_json::Value), +} + + +/// Returns the ban status for the provided node address. +pub async fn ban(configuration: &configuration::Configuration, params: BanParams) -> Result> { + let local_var_configuration = configuration; + + // unbox the parameters + let address = params.address; + let height = params.height; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/ban/{address}", local_var_configuration.base_path, address=crate::apis::urlencode(address)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = height { + local_var_req_builder = local_var_req_builder.query(&[("height", &local_var_str.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + +/// Returns constant configuration, can be overridden by mimir. +pub async fn constants(configuration: &configuration::Configuration, params: ConstantsParams) -> Result> { + let local_var_configuration = configuration; + + // unbox the parameters + let height = params.height; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/constants", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = height { + local_var_req_builder = local_var_req_builder.query(&[("height", &local_var_str.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + +/// Returns the set of asgard addresses that should be used for inbound transactions. +pub async fn inbound_addresses(configuration: &configuration::Configuration, params: InboundAddressesParams) -> Result, Error> { + let local_var_configuration = configuration; + + // unbox the parameters + let height = params.height; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/inbound_addresses", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = height { + local_var_req_builder = local_var_req_builder.query(&[("height", &local_var_str.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + +/// Returns the last block information for all chains. +pub async fn lastblock(configuration: &configuration::Configuration, params: LastblockParams) -> Result, Error> { + let local_var_configuration = configuration; + + // unbox the parameters + let height = params.height; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/lastblock", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = height { + local_var_req_builder = local_var_req_builder.query(&[("height", &local_var_str.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + +/// Returns the last block information for the provided chain. +pub async fn lastblock_chain(configuration: &configuration::Configuration, params: LastblockChainParams) -> Result, Error> { + let local_var_configuration = configuration; + + // unbox the parameters + let chain = params.chain; + let height = params.height; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/lastblock/{chain}", local_var_configuration.base_path, chain=crate::apis::urlencode(chain)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = height { + local_var_req_builder = local_var_req_builder.query(&[("height", &local_var_str.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + +/// Returns network overview statistics. +pub async fn network(configuration: &configuration::Configuration, params: NetworkParams) -> Result> { + let local_var_configuration = configuration; + + // unbox the parameters + let height = params.height; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/network", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = height { + local_var_req_builder = local_var_req_builder.query(&[("height", &local_var_str.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + +/// Returns a boolean indicating whether the chain is in ragnarok. +pub async fn ragnarok(configuration: &configuration::Configuration, params: RagnarokParams) -> Result> { + let local_var_configuration = configuration; + + // unbox the parameters + let height = params.height; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/ragnarok", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = height { + local_var_req_builder = local_var_req_builder.query(&[("height", &local_var_str.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + +/// Returns the network's current THORNode version, the network's next THORNode version, and the querier's THORNode version. +pub async fn version(configuration: &configuration::Configuration, params: VersionParams) -> Result> { + let local_var_configuration = configuration; + + // unbox the parameters + let height = params.height; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/version", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = height { + local_var_req_builder = local_var_req_builder.query(&[("height", &local_var_str.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + diff --git a/thorchain-rs/src/apis/nodes_api.rs b/thorchain-rs/src/apis/nodes_api.rs new file mode 100644 index 0000000..7f709c8 --- /dev/null +++ b/thorchain-rs/src/apis/nodes_api.rs @@ -0,0 +1,118 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + +use reqwest; + +use crate::apis::ResponseContent; +use super::{Error, configuration}; + +/// struct for passing parameters to the method [`node`] +#[derive(Clone, Debug, Default)] +pub struct NodeParams { + pub address: String, + /// optional block height, defaults to current tip + pub height: Option +} + +/// struct for passing parameters to the method [`nodes`] +#[derive(Clone, Debug, Default)] +pub struct NodesParams { + /// optional block height, defaults to current tip + pub height: Option +} + + +/// struct for typed errors of method [`node`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum NodeError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`nodes`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum NodesError { + UnknownValue(serde_json::Value), +} + + +/// Returns node information for the provided node address. +pub async fn node(configuration: &configuration::Configuration, params: NodeParams) -> Result> { + let local_var_configuration = configuration; + + // unbox the parameters + let address = params.address; + let height = params.height; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/node/{address}", local_var_configuration.base_path, address=crate::apis::urlencode(address)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = height { + local_var_req_builder = local_var_req_builder.query(&[("height", &local_var_str.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + +/// Returns node information for all registered validators. +pub async fn nodes(configuration: &configuration::Configuration, params: NodesParams) -> Result, Error> { + let local_var_configuration = configuration; + + // unbox the parameters + let height = params.height; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/nodes", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = height { + local_var_req_builder = local_var_req_builder.query(&[("height", &local_var_str.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + diff --git a/thorchain-rs/src/apis/pol_api.rs b/thorchain-rs/src/apis/pol_api.rs new file mode 100644 index 0000000..feb0b76 --- /dev/null +++ b/thorchain-rs/src/apis/pol_api.rs @@ -0,0 +1,67 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + +use reqwest; + +use crate::apis::ResponseContent; +use super::{Error, configuration}; + +/// struct for passing parameters to the method [`pol`] +#[derive(Clone, Debug, Default)] +pub struct PolParams { + /// optional block height, defaults to current tip + pub height: Option +} + + +/// struct for typed errors of method [`pol`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum PolError { + UnknownValue(serde_json::Value), +} + + +/// Returns protocol owned liquidity overview statistics. +pub async fn pol(configuration: &configuration::Configuration, params: PolParams) -> Result> { + let local_var_configuration = configuration; + + // unbox the parameters + let height = params.height; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/pol", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = height { + local_var_req_builder = local_var_req_builder.query(&[("height", &local_var_str.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + diff --git a/thorchain-rs/src/apis/pools_api.rs b/thorchain-rs/src/apis/pools_api.rs new file mode 100644 index 0000000..f4f7cbc --- /dev/null +++ b/thorchain-rs/src/apis/pools_api.rs @@ -0,0 +1,118 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + +use reqwest; + +use crate::apis::ResponseContent; +use super::{Error, configuration}; + +/// struct for passing parameters to the method [`pool`] +#[derive(Clone, Debug, Default)] +pub struct PoolParams { + pub asset: String, + /// optional block height, defaults to current tip + pub height: Option +} + +/// struct for passing parameters to the method [`pools`] +#[derive(Clone, Debug, Default)] +pub struct PoolsParams { + /// optional block height, defaults to current tip + pub height: Option +} + + +/// struct for typed errors of method [`pool`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum PoolError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`pools`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum PoolsError { + UnknownValue(serde_json::Value), +} + + +/// Returns the pool information for the provided asset. +pub async fn pool(configuration: &configuration::Configuration, params: PoolParams) -> Result> { + let local_var_configuration = configuration; + + // unbox the parameters + let asset = params.asset; + let height = params.height; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/pool/{asset}", local_var_configuration.base_path, asset=crate::apis::urlencode(asset)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = height { + local_var_req_builder = local_var_req_builder.query(&[("height", &local_var_str.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + +/// Returns the pool information for all assets. +pub async fn pools(configuration: &configuration::Configuration, params: PoolsParams) -> Result, Error> { + let local_var_configuration = configuration; + + // unbox the parameters + let height = params.height; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/pools", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = height { + local_var_req_builder = local_var_req_builder.query(&[("height", &local_var_str.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + diff --git a/thorchain-rs/src/apis/queue_api.rs b/thorchain-rs/src/apis/queue_api.rs new file mode 100644 index 0000000..9114027 --- /dev/null +++ b/thorchain-rs/src/apis/queue_api.rs @@ -0,0 +1,214 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + +use reqwest; + +use crate::apis::ResponseContent; +use super::{Error, configuration}; + +/// struct for passing parameters to the method [`queue`] +#[derive(Clone, Debug, Default)] +pub struct QueueParams { + /// optional block height, defaults to current tip + pub height: Option +} + +/// struct for passing parameters to the method [`queue_outbound`] +#[derive(Clone, Debug, Default)] +pub struct QueueOutboundParams { + /// optional block height, defaults to current tip + pub height: Option +} + +/// struct for passing parameters to the method [`queue_scheduled`] +#[derive(Clone, Debug, Default)] +pub struct QueueScheduledParams { + /// optional block height, defaults to current tip + pub height: Option +} + +/// struct for passing parameters to the method [`queue_swap`] +#[derive(Clone, Debug, Default)] +pub struct QueueSwapParams { + /// optional block height, defaults to current tip + pub height: Option +} + + +/// struct for typed errors of method [`queue`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum QueueError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`queue_outbound`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum QueueOutboundError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`queue_scheduled`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum QueueScheduledError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`queue_swap`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum QueueSwapError { + UnknownValue(serde_json::Value), +} + + +/// Returns queue statistics. +pub async fn queue(configuration: &configuration::Configuration, params: QueueParams) -> Result> { + let local_var_configuration = configuration; + + // unbox the parameters + let height = params.height; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/queue", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = height { + local_var_req_builder = local_var_req_builder.query(&[("height", &local_var_str.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + +/// Returns the outbound queue including estimated RUNE values. +pub async fn queue_outbound(configuration: &configuration::Configuration, params: QueueOutboundParams) -> Result, Error> { + let local_var_configuration = configuration; + + // unbox the parameters + let height = params.height; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/queue/outbound", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = height { + local_var_req_builder = local_var_req_builder.query(&[("height", &local_var_str.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + +/// Returns the scheduled queue. +pub async fn queue_scheduled(configuration: &configuration::Configuration, params: QueueScheduledParams) -> Result, Error> { + let local_var_configuration = configuration; + + // unbox the parameters + let height = params.height; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/queue/scheduled", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = height { + local_var_req_builder = local_var_req_builder.query(&[("height", &local_var_str.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + +/// Returns the swap queue. +pub async fn queue_swap(configuration: &configuration::Configuration, params: QueueSwapParams) -> Result, Error> { + let local_var_configuration = configuration; + + // unbox the parameters + let height = params.height; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/queue/swap", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = height { + local_var_req_builder = local_var_req_builder.query(&[("height", &local_var_str.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + diff --git a/thorchain-rs/src/apis/quote_api.rs b/thorchain-rs/src/apis/quote_api.rs new file mode 100644 index 0000000..cf3ec91 --- /dev/null +++ b/thorchain-rs/src/apis/quote_api.rs @@ -0,0 +1,425 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + +use reqwest; + +use crate::apis::ResponseContent; +use super::{Error, configuration}; + +/// struct for passing parameters to the method [`quoteloanclose`] +#[derive(Clone, Debug, Default)] +pub struct QuoteloancloseParams { + /// optional block height, defaults to current tip + pub height: Option, + /// the asset used to repay the loan + pub from_asset: Option, + /// the asset amount in 1e8 decimals + pub amount: Option, + /// the collateral asset of the loan + pub to_asset: Option, + /// the owner of the loan collateral + pub loan_owner: Option, + /// the minimum amount of the target asset to accept + pub min_out: Option +} + +/// struct for passing parameters to the method [`quoteloanopen`] +#[derive(Clone, Debug, Default)] +pub struct QuoteloanopenParams { + /// optional block height, defaults to current tip + pub height: Option, + /// the collateral asset + pub from_asset: Option, + /// the collateral asset amount in 1e8 decimals + pub amount: Option, + /// the target asset to receive (loan denominated in TOR regardless) + pub to_asset: Option, + /// the destination address, required to generate memo + pub destination: Option, + /// the minimum amount of the target asset to accept + pub min_out: Option, + /// the affiliate fee in basis points + pub affiliate_bps: Option, + /// the affiliate (address or thorname) + pub affiliate: Option +} + +/// struct for passing parameters to the method [`quotesaverdeposit`] +#[derive(Clone, Debug, Default)] +pub struct QuotesaverdepositParams { + /// optional block height, defaults to current tip + pub height: Option, + /// the asset to deposit + pub asset: Option, + /// the source asset amount in 1e8 decimals + pub amount: Option +} + +/// struct for passing parameters to the method [`quotesaverwithdraw`] +#[derive(Clone, Debug, Default)] +pub struct QuotesaverwithdrawParams { + /// optional block height, defaults to current tip + pub height: Option, + /// the asset to withdraw + pub asset: Option, + /// the address for the position + pub address: Option, + /// the basis points of the existing position to withdraw + pub withdraw_bps: Option +} + +/// struct for passing parameters to the method [`quoteswap`] +#[derive(Clone, Debug, Default)] +pub struct QuoteswapParams { + /// optional block height, defaults to current tip + pub height: Option, + /// the source asset + pub from_asset: Option, + /// the target asset + pub to_asset: Option, + /// the source asset amount in 1e8 decimals + pub amount: Option, + /// the destination address, required to generate memo + pub destination: Option, + /// the interval in which streaming swaps are swapped + pub streaming_interval: Option, + /// the quantity of swaps within a streaming swap + pub streaming_quantity: Option, + /// the from address, required if the from asset is a synth + pub from_address: Option, + /// the maximum basis points from the current feeless swap price to set the limit in the generated memo + pub tolerance_bps: Option, + /// the affiliate fee in basis points + pub affiliate_bps: Option, + /// the affiliate (address or thorname) + pub affiliate: Option +} + + +/// struct for typed errors of method [`quoteloanclose`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum QuoteloancloseError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`quoteloanopen`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum QuoteloanopenError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`quotesaverdeposit`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum QuotesaverdepositError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`quotesaverwithdraw`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum QuotesaverwithdrawError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`quoteswap`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum QuoteswapError { + UnknownValue(serde_json::Value), +} + + +/// Provide a quote estimate for the provided loan close. +pub async fn quoteloanclose(configuration: &configuration::Configuration, params: QuoteloancloseParams) -> Result> { + let local_var_configuration = configuration; + + // unbox the parameters + let height = params.height; + let from_asset = params.from_asset; + let amount = params.amount; + let to_asset = params.to_asset; + let loan_owner = params.loan_owner; + let min_out = params.min_out; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/quote/loan/close", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = height { + local_var_req_builder = local_var_req_builder.query(&[("height", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = from_asset { + local_var_req_builder = local_var_req_builder.query(&[("from_asset", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = amount { + local_var_req_builder = local_var_req_builder.query(&[("amount", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = to_asset { + local_var_req_builder = local_var_req_builder.query(&[("to_asset", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = loan_owner { + local_var_req_builder = local_var_req_builder.query(&[("loan_owner", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = min_out { + local_var_req_builder = local_var_req_builder.query(&[("min_out", &local_var_str.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + +/// Provide a quote estimate for the provided loan open. +pub async fn quoteloanopen(configuration: &configuration::Configuration, params: QuoteloanopenParams) -> Result> { + let local_var_configuration = configuration; + + // unbox the parameters + let height = params.height; + let from_asset = params.from_asset; + let amount = params.amount; + let to_asset = params.to_asset; + let destination = params.destination; + let min_out = params.min_out; + let affiliate_bps = params.affiliate_bps; + let affiliate = params.affiliate; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/quote/loan/open", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = height { + local_var_req_builder = local_var_req_builder.query(&[("height", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = from_asset { + local_var_req_builder = local_var_req_builder.query(&[("from_asset", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = amount { + local_var_req_builder = local_var_req_builder.query(&[("amount", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = to_asset { + local_var_req_builder = local_var_req_builder.query(&[("to_asset", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = destination { + local_var_req_builder = local_var_req_builder.query(&[("destination", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = min_out { + local_var_req_builder = local_var_req_builder.query(&[("min_out", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = affiliate_bps { + local_var_req_builder = local_var_req_builder.query(&[("affiliate_bps", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = affiliate { + local_var_req_builder = local_var_req_builder.query(&[("affiliate", &local_var_str.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + +/// Provide a quote estimate for the provided saver deposit. +pub async fn quotesaverdeposit(configuration: &configuration::Configuration, params: QuotesaverdepositParams) -> Result> { + let local_var_configuration = configuration; + + // unbox the parameters + let height = params.height; + let asset = params.asset; + let amount = params.amount; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/quote/saver/deposit", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = height { + local_var_req_builder = local_var_req_builder.query(&[("height", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = asset { + local_var_req_builder = local_var_req_builder.query(&[("asset", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = amount { + local_var_req_builder = local_var_req_builder.query(&[("amount", &local_var_str.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + +/// Provide a quote estimate for the provided saver withdraw. +pub async fn quotesaverwithdraw(configuration: &configuration::Configuration, params: QuotesaverwithdrawParams) -> Result> { + let local_var_configuration = configuration; + + // unbox the parameters + let height = params.height; + let asset = params.asset; + let address = params.address; + let withdraw_bps = params.withdraw_bps; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/quote/saver/withdraw", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = height { + local_var_req_builder = local_var_req_builder.query(&[("height", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = asset { + local_var_req_builder = local_var_req_builder.query(&[("asset", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = address { + local_var_req_builder = local_var_req_builder.query(&[("address", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = withdraw_bps { + local_var_req_builder = local_var_req_builder.query(&[("withdraw_bps", &local_var_str.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + +/// Provide a quote estimate for the provided swap. +pub async fn quoteswap(configuration: &configuration::Configuration, params: QuoteswapParams) -> Result> { + let local_var_configuration = configuration; + + // unbox the parameters + let height = params.height; + let from_asset = params.from_asset; + let to_asset = params.to_asset; + let amount = params.amount; + let destination = params.destination; + let streaming_interval = params.streaming_interval; + let streaming_quantity = params.streaming_quantity; + let from_address = params.from_address; + let tolerance_bps = params.tolerance_bps; + let affiliate_bps = params.affiliate_bps; + let affiliate = params.affiliate; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/quote/swap", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = height { + local_var_req_builder = local_var_req_builder.query(&[("height", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = from_asset { + local_var_req_builder = local_var_req_builder.query(&[("from_asset", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = to_asset { + local_var_req_builder = local_var_req_builder.query(&[("to_asset", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = amount { + local_var_req_builder = local_var_req_builder.query(&[("amount", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = destination { + local_var_req_builder = local_var_req_builder.query(&[("destination", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = streaming_interval { + local_var_req_builder = local_var_req_builder.query(&[("streaming_interval", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = streaming_quantity { + local_var_req_builder = local_var_req_builder.query(&[("streaming_quantity", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = from_address { + local_var_req_builder = local_var_req_builder.query(&[("from_address", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = tolerance_bps { + local_var_req_builder = local_var_req_builder.query(&[("tolerance_bps", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = affiliate_bps { + local_var_req_builder = local_var_req_builder.query(&[("affiliate_bps", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = affiliate { + local_var_req_builder = local_var_req_builder.query(&[("affiliate", &local_var_str.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + diff --git a/thorchain-rs/src/apis/savers_api.rs b/thorchain-rs/src/apis/savers_api.rs new file mode 100644 index 0000000..02daf25 --- /dev/null +++ b/thorchain-rs/src/apis/savers_api.rs @@ -0,0 +1,122 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + +use reqwest; + +use crate::apis::ResponseContent; +use super::{Error, configuration}; + +/// struct for passing parameters to the method [`saver`] +#[derive(Clone, Debug, Default)] +pub struct SaverParams { + pub asset: String, + pub address: String, + /// optional block height, defaults to current tip + pub height: Option +} + +/// struct for passing parameters to the method [`savers`] +#[derive(Clone, Debug, Default)] +pub struct SaversParams { + pub asset: String, + /// optional block height, defaults to current tip + pub height: Option +} + + +/// struct for typed errors of method [`saver`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum SaverError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`savers`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum SaversError { + UnknownValue(serde_json::Value), +} + + +/// Returns the saver position given then savers pool and address. +pub async fn saver(configuration: &configuration::Configuration, params: SaverParams) -> Result> { + let local_var_configuration = configuration; + + // unbox the parameters + let asset = params.asset; + let address = params.address; + let height = params.height; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/pool/{asset}/saver/{address}", local_var_configuration.base_path, asset=crate::apis::urlencode(asset), address=crate::apis::urlencode(address)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = height { + local_var_req_builder = local_var_req_builder.query(&[("height", &local_var_str.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + +/// Returns all savers for the savers pool. +pub async fn savers(configuration: &configuration::Configuration, params: SaversParams) -> Result, Error> { + let local_var_configuration = configuration; + + // unbox the parameters + let asset = params.asset; + let height = params.height; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/pool/{asset}/savers", local_var_configuration.base_path, asset=crate::apis::urlencode(asset)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = height { + local_var_req_builder = local_var_req_builder.query(&[("height", &local_var_str.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + diff --git a/thorchain-rs/src/apis/streaming_swap_api.rs b/thorchain-rs/src/apis/streaming_swap_api.rs new file mode 100644 index 0000000..c6c9ed5 --- /dev/null +++ b/thorchain-rs/src/apis/streaming_swap_api.rs @@ -0,0 +1,118 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + +use reqwest; + +use crate::apis::ResponseContent; +use super::{Error, configuration}; + +/// struct for passing parameters to the method [`stream_swap`] +#[derive(Clone, Debug, Default)] +pub struct StreamSwapParams { + pub hash: String, + /// optional block height, defaults to current tip + pub height: Option +} + +/// struct for passing parameters to the method [`stream_swaps`] +#[derive(Clone, Debug, Default)] +pub struct StreamSwapsParams { + /// optional block height, defaults to current tip + pub height: Option +} + + +/// struct for typed errors of method [`stream_swap`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum StreamSwapError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`stream_swaps`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum StreamSwapsError { + UnknownValue(serde_json::Value), +} + + +/// Returns the state of a streaming swap +pub async fn stream_swap(configuration: &configuration::Configuration, params: StreamSwapParams) -> Result> { + let local_var_configuration = configuration; + + // unbox the parameters + let hash = params.hash; + let height = params.height; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/swap/streaming/{hash}", local_var_configuration.base_path, hash=crate::apis::urlencode(hash)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = height { + local_var_req_builder = local_var_req_builder.query(&[("height", &local_var_str.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + +/// Returns the state of all streaming swaps +pub async fn stream_swaps(configuration: &configuration::Configuration, params: StreamSwapsParams) -> Result, Error> { + let local_var_configuration = configuration; + + // unbox the parameters + let height = params.height; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/swaps/streaming", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = height { + local_var_req_builder = local_var_req_builder.query(&[("height", &local_var_str.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + diff --git a/thorchain-rs/src/apis/thornames_api.rs b/thorchain-rs/src/apis/thornames_api.rs new file mode 100644 index 0000000..bf2996b --- /dev/null +++ b/thorchain-rs/src/apis/thornames_api.rs @@ -0,0 +1,70 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + +use reqwest; + +use crate::apis::ResponseContent; +use super::{Error, configuration}; + +/// struct for passing parameters to the method [`thorname`] +#[derive(Clone, Debug, Default)] +pub struct ThornameParams { + /// the thornode to lookup + pub name: String, + /// optional block height, defaults to current tip + pub height: Option +} + + +/// struct for typed errors of method [`thorname`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ThornameError { + UnknownValue(serde_json::Value), +} + + +/// Returns addresses registered to the provided thorname. +pub async fn thorname(configuration: &configuration::Configuration, params: ThornameParams) -> Result, Error> { + let local_var_configuration = configuration; + + // unbox the parameters + let name = params.name; + let height = params.height; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/thorname/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = height { + local_var_req_builder = local_var_req_builder.query(&[("height", &local_var_str.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + diff --git a/thorchain-rs/src/apis/transactions_api.rs b/thorchain-rs/src/apis/transactions_api.rs new file mode 100644 index 0000000..4148b28 --- /dev/null +++ b/thorchain-rs/src/apis/transactions_api.rs @@ -0,0 +1,171 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + +use reqwest; + +use crate::apis::ResponseContent; +use super::{Error, configuration}; + +/// struct for passing parameters to the method [`tx`] +#[derive(Clone, Debug, Default)] +pub struct TxParams { + pub hash: String, + /// optional block height, defaults to current tip + pub height: Option +} + +/// struct for passing parameters to the method [`tx_signers`] +#[derive(Clone, Debug, Default)] +pub struct TxSignersParams { + pub hash: String, + /// optional block height, defaults to current tip + pub height: Option +} + +/// struct for passing parameters to the method [`tx_signers_old`] +#[derive(Clone, Debug, Default)] +pub struct TxSignersOldParams { + pub hash: String, + /// optional block height, defaults to current tip + pub height: Option +} + + +/// struct for typed errors of method [`tx`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum TxError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`tx_signers`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum TxSignersError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`tx_signers_old`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum TxSignersOldError { + UnknownValue(serde_json::Value), +} + + +/// Returns the observed transaction for a provided inbound or outbound hash. +pub async fn tx(configuration: &configuration::Configuration, params: TxParams) -> Result> { + let local_var_configuration = configuration; + + // unbox the parameters + let hash = params.hash; + let height = params.height; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/tx/{hash}", local_var_configuration.base_path, hash=crate::apis::urlencode(hash)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = height { + local_var_req_builder = local_var_req_builder.query(&[("height", &local_var_str.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + +/// Returns the signers for a provided inbound or outbound hash. +pub async fn tx_signers(configuration: &configuration::Configuration, params: TxSignersParams) -> Result> { + let local_var_configuration = configuration; + + // unbox the parameters + let hash = params.hash; + let height = params.height; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/tx/details/{hash}", local_var_configuration.base_path, hash=crate::apis::urlencode(hash)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = height { + local_var_req_builder = local_var_req_builder.query(&[("height", &local_var_str.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + +/// Deprecated - migrate to /thorchain/tx/details. +pub async fn tx_signers_old(configuration: &configuration::Configuration, params: TxSignersOldParams) -> Result> { + let local_var_configuration = configuration; + + // unbox the parameters + let hash = params.hash; + let height = params.height; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/tx/{hash}/signers", local_var_configuration.base_path, hash=crate::apis::urlencode(hash)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = height { + local_var_req_builder = local_var_req_builder.query(&[("height", &local_var_str.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + diff --git a/thorchain-rs/src/apis/tss_api.rs b/thorchain-rs/src/apis/tss_api.rs new file mode 100644 index 0000000..cd8079b --- /dev/null +++ b/thorchain-rs/src/apis/tss_api.rs @@ -0,0 +1,210 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + +use reqwest; + +use crate::apis::ResponseContent; +use super::{Error, configuration}; + +/// struct for passing parameters to the method [`keysign`] +#[derive(Clone, Debug, Default)] +pub struct KeysignParams { + pub height: i64 +} + +/// struct for passing parameters to the method [`keysign_pubkey`] +#[derive(Clone, Debug, Default)] +pub struct KeysignPubkeyParams { + pub height: i64, + pub pubkey: String +} + +/// struct for passing parameters to the method [`metrics`] +#[derive(Clone, Debug, Default)] +pub struct MetricsParams { + /// optional block height, defaults to current tip + pub height: Option +} + +/// struct for passing parameters to the method [`metrics_keygen`] +#[derive(Clone, Debug, Default)] +pub struct MetricsKeygenParams { + pub pubkey: String, + /// optional block height, defaults to current tip + pub height: Option +} + + +/// struct for typed errors of method [`keysign`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum KeysignError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`keysign_pubkey`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum KeysignPubkeyError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`metrics`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum MetricsError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`metrics_keygen`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum MetricsKeygenError { + UnknownValue(serde_json::Value), +} + + +/// Returns keysign information for the provided height - the height being the first block a tx out item appears in the signed-but-unobserved outbound queue. +pub async fn keysign(configuration: &configuration::Configuration, params: KeysignParams) -> Result> { + let local_var_configuration = configuration; + + // unbox the parameters + let height = params.height; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/keysign/{height}", local_var_configuration.base_path, height=height); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + +/// Returns keysign information for the provided height and pubkey - the height being the block at which a tx out item is scheduled to be signed and moved from the scheduled outbound queue to the outbound queue. +pub async fn keysign_pubkey(configuration: &configuration::Configuration, params: KeysignPubkeyParams) -> Result> { + let local_var_configuration = configuration; + + // unbox the parameters + let height = params.height; + let pubkey = params.pubkey; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/keysign/{height}/{pubkey}", local_var_configuration.base_path, height=height, pubkey=crate::apis::urlencode(pubkey)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + +/// Returns keygen and keysign metrics for current vaults. +pub async fn metrics(configuration: &configuration::Configuration, params: MetricsParams) -> Result> { + let local_var_configuration = configuration; + + // unbox the parameters + let height = params.height; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/metrics", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = height { + local_var_req_builder = local_var_req_builder.query(&[("height", &local_var_str.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + +/// Returns keygen metrics for the provided vault pubkey. +pub async fn metrics_keygen(configuration: &configuration::Configuration, params: MetricsKeygenParams) -> Result, Error> { + let local_var_configuration = configuration; + + // unbox the parameters + let pubkey = params.pubkey; + let height = params.height; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/metric/keygen/{pubkey}", local_var_configuration.base_path, pubkey=crate::apis::urlencode(pubkey)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = height { + local_var_req_builder = local_var_req_builder.query(&[("height", &local_var_str.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + diff --git a/thorchain-rs/src/apis/vaults_api.rs b/thorchain-rs/src/apis/vaults_api.rs new file mode 100644 index 0000000..5329eb7 --- /dev/null +++ b/thorchain-rs/src/apis/vaults_api.rs @@ -0,0 +1,216 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + +use reqwest; + +use crate::apis::ResponseContent; +use super::{Error, configuration}; + +/// struct for passing parameters to the method [`asgard`] +#[derive(Clone, Debug, Default)] +pub struct AsgardParams { + /// optional block height, defaults to current tip + pub height: Option +} + +/// struct for passing parameters to the method [`vault`] +#[derive(Clone, Debug, Default)] +pub struct VaultParams { + pub pubkey: String, + /// optional block height, defaults to current tip + pub height: Option +} + +/// struct for passing parameters to the method [`vault_pubkeys`] +#[derive(Clone, Debug, Default)] +pub struct VaultPubkeysParams { + /// optional block height, defaults to current tip + pub height: Option +} + +/// struct for passing parameters to the method [`yggdrasil`] +#[derive(Clone, Debug, Default)] +pub struct YggdrasilParams { + /// optional block height, defaults to current tip + pub height: Option +} + + +/// struct for typed errors of method [`asgard`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum AsgardError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`vault`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum VaultError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`vault_pubkeys`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum VaultPubkeysError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`yggdrasil`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum YggdrasilError { + UnknownValue(serde_json::Value), +} + + +/// Returns current asgard vaults. +pub async fn asgard(configuration: &configuration::Configuration, params: AsgardParams) -> Result, Error> { + let local_var_configuration = configuration; + + // unbox the parameters + let height = params.height; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/vaults/asgard", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = height { + local_var_req_builder = local_var_req_builder.query(&[("height", &local_var_str.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + +/// Returns the vault for the provided pubkey. +pub async fn vault(configuration: &configuration::Configuration, params: VaultParams) -> Result> { + let local_var_configuration = configuration; + + // unbox the parameters + let pubkey = params.pubkey; + let height = params.height; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/vault/{pubkey}", local_var_configuration.base_path, pubkey=crate::apis::urlencode(pubkey)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = height { + local_var_req_builder = local_var_req_builder.query(&[("height", &local_var_str.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + +/// Returns all pubkeys for current vaults. +pub async fn vault_pubkeys(configuration: &configuration::Configuration, params: VaultPubkeysParams) -> Result> { + let local_var_configuration = configuration; + + // unbox the parameters + let height = params.height; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/vaults/pubkeys", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = height { + local_var_req_builder = local_var_req_builder.query(&[("height", &local_var_str.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + +/// Returns current yggdrasil vaults. +pub async fn yggdrasil(configuration: &configuration::Configuration, params: YggdrasilParams) -> Result, Error> { + let local_var_configuration = configuration; + + // unbox the parameters + let height = params.height; + + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/thorchain/vaults/yggdrasil", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = height { + local_var_req_builder = local_var_req_builder.query(&[("height", &local_var_str.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + diff --git a/thorchain-rs/src/lib.rs b/thorchain-rs/src/lib.rs new file mode 100644 index 0000000..c1dd666 --- /dev/null +++ b/thorchain-rs/src/lib.rs @@ -0,0 +1,10 @@ +#[macro_use] +extern crate serde_derive; + +extern crate serde; +extern crate serde_json; +extern crate url; +extern crate reqwest; + +pub mod apis; +pub mod models; diff --git a/thorchain-rs/src/models/ban_response.rs b/thorchain-rs/src/models/ban_response.rs new file mode 100644 index 0000000..1406c64 --- /dev/null +++ b/thorchain-rs/src/models/ban_response.rs @@ -0,0 +1,34 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct BanResponse { + #[serde(rename = "node_address", skip_serializing_if = "Option::is_none")] + pub node_address: Option, + #[serde(rename = "block_height", skip_serializing_if = "Option::is_none")] + pub block_height: Option, + #[serde(rename = "signers", skip_serializing_if = "Option::is_none")] + pub signers: Option>, +} + +impl BanResponse { + pub fn new() -> BanResponse { + BanResponse { + node_address: None, + block_height: None, + signers: None, + } + } +} + + diff --git a/thorchain-rs/src/models/base_quote_response.rs b/thorchain-rs/src/models/base_quote_response.rs new file mode 100644 index 0000000..7df2c77 --- /dev/null +++ b/thorchain-rs/src/models/base_quote_response.rs @@ -0,0 +1,80 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct BaseQuoteResponse { + /// the inbound address for the transaction on the source chain + #[serde(rename = "inbound_address", skip_serializing_if = "Option::is_none")] + pub inbound_address: Option, + /// the approximate number of source chain blocks required before processing + #[serde(rename = "inbound_confirmation_blocks", skip_serializing_if = "Option::is_none")] + pub inbound_confirmation_blocks: Option, + /// the approximate seconds for block confirmations required before processing + #[serde(rename = "inbound_confirmation_seconds", skip_serializing_if = "Option::is_none")] + pub inbound_confirmation_seconds: Option, + /// the number of thorchain blocks the outbound will be delayed + #[serde(rename = "outbound_delay_blocks", skip_serializing_if = "Option::is_none")] + pub outbound_delay_blocks: Option, + /// the approximate seconds for the outbound delay before it will be sent + #[serde(rename = "outbound_delay_seconds", skip_serializing_if = "Option::is_none")] + pub outbound_delay_seconds: Option, + #[serde(rename = "fees", skip_serializing_if = "Option::is_none")] + pub fees: Option>, + /// the total swap slippage in basis points + #[serde(rename = "slippage_bps", skip_serializing_if = "Option::is_none")] + pub slippage_bps: Option, + /// the total streaming swap slippage in basis points + #[serde(rename = "streaming_slippage_bps", skip_serializing_if = "Option::is_none")] + pub streaming_slippage_bps: Option, + /// the EVM chain router contract address + #[serde(rename = "router", skip_serializing_if = "Option::is_none")] + pub router: Option, + /// expiration timestamp in unix seconds + #[serde(rename = "expiry", skip_serializing_if = "Option::is_none")] + pub expiry: Option, + /// static warning message + #[serde(rename = "warning", skip_serializing_if = "Option::is_none")] + pub warning: Option, + /// chain specific quote notes + #[serde(rename = "notes", skip_serializing_if = "Option::is_none")] + pub notes: Option, + /// Defines the minimum transaction size for the chain in base units (sats, wei, uatom). Transctions with asset amounts lower than the dust_threshold are ignored. + #[serde(rename = "dust_threshold", skip_serializing_if = "Option::is_none")] + pub dust_threshold: Option, + /// The recommended minimum inbound amount for this transaction type & inbound asset. Sending less than this amount could result in failed refunds. + #[serde(rename = "recommended_min_amount_in", skip_serializing_if = "Option::is_none")] + pub recommended_min_amount_in: Option, +} + +impl BaseQuoteResponse { + pub fn new() -> BaseQuoteResponse { + BaseQuoteResponse { + inbound_address: None, + inbound_confirmation_blocks: None, + inbound_confirmation_seconds: None, + outbound_delay_blocks: None, + outbound_delay_seconds: None, + fees: None, + slippage_bps: None, + streaming_slippage_bps: None, + router: None, + expiry: None, + warning: None, + notes: None, + dust_threshold: None, + recommended_min_amount_in: None, + } + } +} + + diff --git a/thorchain-rs/src/models/borrower.rs b/thorchain-rs/src/models/borrower.rs new file mode 100644 index 0000000..5211be9 --- /dev/null +++ b/thorchain-rs/src/models/borrower.rs @@ -0,0 +1,55 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct Borrower { + #[serde(rename = "owner")] + pub owner: String, + #[serde(rename = "asset")] + pub asset: String, + #[serde(rename = "debt_issued")] + pub debt_issued: String, + #[serde(rename = "debt_repaid")] + pub debt_repaid: String, + #[serde(rename = "debt_current")] + pub debt_current: String, + #[serde(rename = "collateral_deposited")] + pub collateral_deposited: String, + #[serde(rename = "collateral_withdrawn")] + pub collateral_withdrawn: String, + #[serde(rename = "collateral_current")] + pub collateral_current: String, + #[serde(rename = "last_open_height")] + pub last_open_height: i64, + #[serde(rename = "last_repay_height")] + pub last_repay_height: i64, +} + +impl Borrower { + pub fn new(owner: String, asset: String, debt_issued: String, debt_repaid: String, debt_current: String, collateral_deposited: String, collateral_withdrawn: String, collateral_current: String, last_open_height: i64, last_repay_height: i64) -> Borrower { + Borrower { + owner, + asset, + debt_issued, + debt_repaid, + debt_current, + collateral_deposited, + collateral_withdrawn, + collateral_current, + last_open_height, + last_repay_height, + } + } +} + + diff --git a/thorchain-rs/src/models/chain_height.rs b/thorchain-rs/src/models/chain_height.rs new file mode 100644 index 0000000..20de762 --- /dev/null +++ b/thorchain-rs/src/models/chain_height.rs @@ -0,0 +1,31 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct ChainHeight { + #[serde(rename = "chain")] + pub chain: String, + #[serde(rename = "height")] + pub height: i64, +} + +impl ChainHeight { + pub fn new(chain: String, height: i64) -> ChainHeight { + ChainHeight { + chain, + height, + } + } +} + + diff --git a/thorchain-rs/src/models/coin.rs b/thorchain-rs/src/models/coin.rs new file mode 100644 index 0000000..41ab19d --- /dev/null +++ b/thorchain-rs/src/models/coin.rs @@ -0,0 +1,34 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct Coin { + #[serde(rename = "asset")] + pub asset: String, + #[serde(rename = "amount")] + pub amount: String, + #[serde(rename = "decimals", skip_serializing_if = "Option::is_none")] + pub decimals: Option, +} + +impl Coin { + pub fn new(asset: String, amount: String) -> Coin { + Coin { + asset, + amount, + decimals: None, + } + } +} + + diff --git a/thorchain-rs/src/models/constants_response.rs b/thorchain-rs/src/models/constants_response.rs new file mode 100644 index 0000000..1053b13 --- /dev/null +++ b/thorchain-rs/src/models/constants_response.rs @@ -0,0 +1,34 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct ConstantsResponse { + #[serde(rename = "int_64_values", skip_serializing_if = "Option::is_none")] + pub int_64_values: Option<::std::collections::HashMap>, + #[serde(rename = "bool_values", skip_serializing_if = "Option::is_none")] + pub bool_values: Option<::std::collections::HashMap>, + #[serde(rename = "string_values", skip_serializing_if = "Option::is_none")] + pub string_values: Option<::std::collections::HashMap>, +} + +impl ConstantsResponse { + pub fn new() -> ConstantsResponse { + ConstantsResponse { + int_64_values: None, + bool_values: None, + string_values: None, + } + } +} + + diff --git a/thorchain-rs/src/models/inbound_address.rs b/thorchain-rs/src/models/inbound_address.rs new file mode 100644 index 0000000..c326e78 --- /dev/null +++ b/thorchain-rs/src/models/inbound_address.rs @@ -0,0 +1,73 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct InboundAddress { + #[serde(rename = "chain", skip_serializing_if = "Option::is_none")] + pub chain: Option, + #[serde(rename = "pub_key", skip_serializing_if = "Option::is_none")] + pub pub_key: Option, + #[serde(rename = "address", skip_serializing_if = "Option::is_none")] + pub address: Option, + #[serde(rename = "router", skip_serializing_if = "Option::is_none")] + pub router: Option, + /// Returns true if trading is unavailable for this chain, either because trading is halted globally or specifically for this chain + #[serde(rename = "halted")] + pub halted: bool, + /// Returns true if trading is paused globally + #[serde(rename = "global_trading_paused", skip_serializing_if = "Option::is_none")] + pub global_trading_paused: Option, + /// Returns true if trading is paused for this chain + #[serde(rename = "chain_trading_paused", skip_serializing_if = "Option::is_none")] + pub chain_trading_paused: Option, + /// Returns true if LP actions are paused for this chain + #[serde(rename = "chain_lp_actions_paused", skip_serializing_if = "Option::is_none")] + pub chain_lp_actions_paused: Option, + /// The minimum fee rate used by vaults to send outbound TXs. The actual fee rate may be higher. For EVM chains this is returned in gwei (1e9). + #[serde(rename = "gas_rate", skip_serializing_if = "Option::is_none")] + pub gas_rate: Option, + /// Units of the gas_rate. + #[serde(rename = "gas_rate_units", skip_serializing_if = "Option::is_none")] + pub gas_rate_units: Option, + /// Avg size of outbound TXs on each chain. For UTXO chains it may be larger than average, as it takes into account vault consolidation txs, which can have many vouts + #[serde(rename = "outbound_tx_size", skip_serializing_if = "Option::is_none")] + pub outbound_tx_size: Option, + /// The total outbound fee charged to the user for outbound txs in the gas asset of the chain. + #[serde(rename = "outbound_fee", skip_serializing_if = "Option::is_none")] + pub outbound_fee: Option, + /// Defines the minimum transaction size for the chain in base units (sats, wei, uatom). Transactions with asset amounts lower than the dust_threshold are ignored. + #[serde(rename = "dust_threshold", skip_serializing_if = "Option::is_none")] + pub dust_threshold: Option, +} + +impl InboundAddress { + pub fn new(halted: bool) -> InboundAddress { + InboundAddress { + chain: None, + pub_key: None, + address: None, + router: None, + halted, + global_trading_paused: None, + chain_trading_paused: None, + chain_lp_actions_paused: None, + gas_rate: None, + gas_rate_units: None, + outbound_tx_size: None, + outbound_fee: None, + dust_threshold: None, + } + } +} + + diff --git a/thorchain-rs/src/models/invariant_response.rs b/thorchain-rs/src/models/invariant_response.rs new file mode 100644 index 0000000..12ce03c --- /dev/null +++ b/thorchain-rs/src/models/invariant_response.rs @@ -0,0 +1,37 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct InvariantResponse { + /// The name of the invariant. + #[serde(rename = "invariant")] + pub invariant: String, + /// Returns true if the invariant is broken. + #[serde(rename = "broken")] + pub broken: bool, + /// Informative message about the invariant result. + #[serde(rename = "msg")] + pub msg: Vec, +} + +impl InvariantResponse { + pub fn new(invariant: String, broken: bool, msg: Vec) -> InvariantResponse { + InvariantResponse { + invariant, + broken, + msg, + } + } +} + + diff --git a/thorchain-rs/src/models/invariants_response.rs b/thorchain-rs/src/models/invariants_response.rs new file mode 100644 index 0000000..2cc8040 --- /dev/null +++ b/thorchain-rs/src/models/invariants_response.rs @@ -0,0 +1,28 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct InvariantsResponse { + #[serde(rename = "invariants", skip_serializing_if = "Option::is_none")] + pub invariants: Option>, +} + +impl InvariantsResponse { + pub fn new() -> InvariantsResponse { + InvariantsResponse { + invariants: None, + } + } +} + + diff --git a/thorchain-rs/src/models/keygen_metric.rs b/thorchain-rs/src/models/keygen_metric.rs new file mode 100644 index 0000000..da7af13 --- /dev/null +++ b/thorchain-rs/src/models/keygen_metric.rs @@ -0,0 +1,31 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct KeygenMetric { + #[serde(rename = "pub_key", skip_serializing_if = "Option::is_none")] + pub pub_key: Option, + #[serde(rename = "node_tss_times")] + pub node_tss_times: Vec, +} + +impl KeygenMetric { + pub fn new(node_tss_times: Vec) -> KeygenMetric { + KeygenMetric { + pub_key: None, + node_tss_times, + } + } +} + + diff --git a/thorchain-rs/src/models/keysign_info.rs b/thorchain-rs/src/models/keysign_info.rs new file mode 100644 index 0000000..adfb319 --- /dev/null +++ b/thorchain-rs/src/models/keysign_info.rs @@ -0,0 +1,32 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct KeysignInfo { + /// the block(s) in which a tx out item is scheduled to be signed and moved from the scheduled outbound queue to the outbound queue + #[serde(rename = "height", skip_serializing_if = "Option::is_none")] + pub height: Option, + #[serde(rename = "tx_array")] + pub tx_array: Vec, +} + +impl KeysignInfo { + pub fn new(tx_array: Vec) -> KeysignInfo { + KeysignInfo { + height: None, + tx_array, + } + } +} + + diff --git a/thorchain-rs/src/models/keysign_metrics.rs b/thorchain-rs/src/models/keysign_metrics.rs new file mode 100644 index 0000000..d8257d1 --- /dev/null +++ b/thorchain-rs/src/models/keysign_metrics.rs @@ -0,0 +1,31 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct KeysignMetrics { + #[serde(rename = "tx_id", skip_serializing_if = "Option::is_none")] + pub tx_id: Option, + #[serde(rename = "node_tss_times", skip_serializing_if = "Option::is_none")] + pub node_tss_times: Option>, +} + +impl KeysignMetrics { + pub fn new() -> KeysignMetrics { + KeysignMetrics { + tx_id: None, + node_tss_times: None, + } + } +} + + diff --git a/thorchain-rs/src/models/keysign_response.rs b/thorchain-rs/src/models/keysign_response.rs new file mode 100644 index 0000000..fbe2476 --- /dev/null +++ b/thorchain-rs/src/models/keysign_response.rs @@ -0,0 +1,31 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct KeysignResponse { + #[serde(rename = "keysign", skip_serializing_if = "Option::is_none")] + pub keysign: Option>, + #[serde(rename = "signature", skip_serializing_if = "Option::is_none")] + pub signature: Option, +} + +impl KeysignResponse { + pub fn new() -> KeysignResponse { + KeysignResponse { + keysign: None, + signature: None, + } + } +} + + diff --git a/thorchain-rs/src/models/last_block.rs b/thorchain-rs/src/models/last_block.rs new file mode 100644 index 0000000..8aeeac3 --- /dev/null +++ b/thorchain-rs/src/models/last_block.rs @@ -0,0 +1,37 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct LastBlock { + #[serde(rename = "chain")] + pub chain: String, + #[serde(rename = "last_observed_in")] + pub last_observed_in: i64, + #[serde(rename = "last_signed_out")] + pub last_signed_out: i64, + #[serde(rename = "thorchain")] + pub thorchain: i64, +} + +impl LastBlock { + pub fn new(chain: String, last_observed_in: i64, last_signed_out: i64, thorchain: i64) -> LastBlock { + LastBlock { + chain, + last_observed_in, + last_signed_out, + thorchain, + } + } +} + + diff --git a/thorchain-rs/src/models/liquidity_provider.rs b/thorchain-rs/src/models/liquidity_provider.rs new file mode 100644 index 0000000..f0761cd --- /dev/null +++ b/thorchain-rs/src/models/liquidity_provider.rs @@ -0,0 +1,73 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct LiquidityProvider { + #[serde(rename = "asset")] + pub asset: String, + #[serde(rename = "rune_address", skip_serializing_if = "Option::is_none")] + pub rune_address: Option, + #[serde(rename = "asset_address", skip_serializing_if = "Option::is_none")] + pub asset_address: Option, + #[serde(rename = "last_add_height", skip_serializing_if = "Option::is_none")] + pub last_add_height: Option, + #[serde(rename = "last_withdraw_height", skip_serializing_if = "Option::is_none")] + pub last_withdraw_height: Option, + #[serde(rename = "units")] + pub units: String, + #[serde(rename = "pending_rune")] + pub pending_rune: String, + #[serde(rename = "pending_asset")] + pub pending_asset: String, + #[serde(rename = "pending_tx_id", skip_serializing_if = "Option::is_none")] + pub pending_tx_id: Option, + #[serde(rename = "rune_deposit_value")] + pub rune_deposit_value: String, + #[serde(rename = "asset_deposit_value")] + pub asset_deposit_value: String, + #[serde(rename = "rune_redeem_value")] + pub rune_redeem_value: String, + #[serde(rename = "asset_redeem_value")] + pub asset_redeem_value: String, + #[serde(rename = "luvi_deposit_value")] + pub luvi_deposit_value: String, + #[serde(rename = "luvi_redeem_value")] + pub luvi_redeem_value: String, + #[serde(rename = "luvi_growth_pct")] + pub luvi_growth_pct: String, +} + +impl LiquidityProvider { + pub fn new(asset: String, units: String, pending_rune: String, pending_asset: String, rune_deposit_value: String, asset_deposit_value: String, rune_redeem_value: String, asset_redeem_value: String, luvi_deposit_value: String, luvi_redeem_value: String, luvi_growth_pct: String) -> LiquidityProvider { + LiquidityProvider { + asset, + rune_address: None, + asset_address: None, + last_add_height: None, + last_withdraw_height: None, + units, + pending_rune, + pending_asset, + pending_tx_id: None, + rune_deposit_value, + asset_deposit_value, + rune_redeem_value, + asset_redeem_value, + luvi_deposit_value, + luvi_redeem_value, + luvi_growth_pct, + } + } +} + + diff --git a/thorchain-rs/src/models/liquidity_provider_summary.rs b/thorchain-rs/src/models/liquidity_provider_summary.rs new file mode 100644 index 0000000..c822668 --- /dev/null +++ b/thorchain-rs/src/models/liquidity_provider_summary.rs @@ -0,0 +1,58 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct LiquidityProviderSummary { + #[serde(rename = "asset")] + pub asset: String, + #[serde(rename = "rune_address", skip_serializing_if = "Option::is_none")] + pub rune_address: Option, + #[serde(rename = "asset_address", skip_serializing_if = "Option::is_none")] + pub asset_address: Option, + #[serde(rename = "last_add_height", skip_serializing_if = "Option::is_none")] + pub last_add_height: Option, + #[serde(rename = "last_withdraw_height", skip_serializing_if = "Option::is_none")] + pub last_withdraw_height: Option, + #[serde(rename = "units")] + pub units: String, + #[serde(rename = "pending_rune")] + pub pending_rune: String, + #[serde(rename = "pending_asset")] + pub pending_asset: String, + #[serde(rename = "pending_tx_id", skip_serializing_if = "Option::is_none")] + pub pending_tx_id: Option, + #[serde(rename = "rune_deposit_value")] + pub rune_deposit_value: String, + #[serde(rename = "asset_deposit_value")] + pub asset_deposit_value: String, +} + +impl LiquidityProviderSummary { + pub fn new(asset: String, units: String, pending_rune: String, pending_asset: String, rune_deposit_value: String, asset_deposit_value: String) -> LiquidityProviderSummary { + LiquidityProviderSummary { + asset, + rune_address: None, + asset_address: None, + last_add_height: None, + last_withdraw_height: None, + units, + pending_rune, + pending_asset, + pending_tx_id: None, + rune_deposit_value, + asset_deposit_value, + } + } +} + + diff --git a/thorchain-rs/src/models/metrics_response.rs b/thorchain-rs/src/models/metrics_response.rs new file mode 100644 index 0000000..b4fdde3 --- /dev/null +++ b/thorchain-rs/src/models/metrics_response.rs @@ -0,0 +1,31 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct MetricsResponse { + #[serde(rename = "keygen", skip_serializing_if = "Option::is_none")] + pub keygen: Option>, + #[serde(rename = "keysign", skip_serializing_if = "Option::is_none")] + pub keysign: Option>, +} + +impl MetricsResponse { + pub fn new() -> MetricsResponse { + MetricsResponse { + keygen: None, + keysign: None, + } + } +} + + diff --git a/thorchain-rs/src/models/mimir_nodes_response.rs b/thorchain-rs/src/models/mimir_nodes_response.rs new file mode 100644 index 0000000..803e23d --- /dev/null +++ b/thorchain-rs/src/models/mimir_nodes_response.rs @@ -0,0 +1,28 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct MimirNodesResponse { + #[serde(rename = "mimirs", skip_serializing_if = "Option::is_none")] + pub mimirs: Option>, +} + +impl MimirNodesResponse { + pub fn new() -> MimirNodesResponse { + MimirNodesResponse { + mimirs: None, + } + } +} + + diff --git a/thorchain-rs/src/models/mimir_vote.rs b/thorchain-rs/src/models/mimir_vote.rs new file mode 100644 index 0000000..992496d --- /dev/null +++ b/thorchain-rs/src/models/mimir_vote.rs @@ -0,0 +1,34 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct MimirVote { + #[serde(rename = "key", skip_serializing_if = "Option::is_none")] + pub key: Option, + #[serde(rename = "value", skip_serializing_if = "Option::is_none")] + pub value: Option, + #[serde(rename = "signer", skip_serializing_if = "Option::is_none")] + pub signer: Option, +} + +impl MimirVote { + pub fn new() -> MimirVote { + MimirVote { + key: None, + value: None, + signer: None, + } + } +} + + diff --git a/thorchain-rs/src/models/mod.rs b/thorchain-rs/src/models/mod.rs new file mode 100644 index 0000000..9194f95 --- /dev/null +++ b/thorchain-rs/src/models/mod.rs @@ -0,0 +1,134 @@ +pub mod ban_response; +pub use self::ban_response::BanResponse; +pub mod base_quote_response; +pub use self::base_quote_response::BaseQuoteResponse; +pub mod borrower; +pub use self::borrower::Borrower; +pub mod chain_height; +pub use self::chain_height::ChainHeight; +pub mod coin; +pub use self::coin::Coin; +pub mod constants_response; +pub use self::constants_response::ConstantsResponse; +pub mod inbound_address; +pub use self::inbound_address::InboundAddress; +pub mod invariant_response; +pub use self::invariant_response::InvariantResponse; +pub mod invariants_response; +pub use self::invariants_response::InvariantsResponse; +pub mod keygen_metric; +pub use self::keygen_metric::KeygenMetric; +pub mod keysign_info; +pub use self::keysign_info::KeysignInfo; +pub mod keysign_metrics; +pub use self::keysign_metrics::KeysignMetrics; +pub mod keysign_response; +pub use self::keysign_response::KeysignResponse; +pub mod last_block; +pub use self::last_block::LastBlock; +pub mod liquidity_provider; +pub use self::liquidity_provider::LiquidityProvider; +pub mod liquidity_provider_summary; +pub use self::liquidity_provider_summary::LiquidityProviderSummary; +pub mod metrics_response; +pub use self::metrics_response::MetricsResponse; +pub mod mimir_nodes_response; +pub use self::mimir_nodes_response::MimirNodesResponse; +pub mod mimir_vote; +pub use self::mimir_vote::MimirVote; +pub mod msg_swap; +pub use self::msg_swap::MsgSwap; +pub mod network_response; +pub use self::network_response::NetworkResponse; +pub mod node; +pub use self::node::Node; +pub mod node_bond_provider; +pub use self::node_bond_provider::NodeBondProvider; +pub mod node_bond_providers; +pub use self::node_bond_providers::NodeBondProviders; +pub mod node_jail; +pub use self::node_jail::NodeJail; +pub mod node_keygen_metric; +pub use self::node_keygen_metric::NodeKeygenMetric; +pub mod node_preflight_status; +pub use self::node_preflight_status::NodePreflightStatus; +pub mod node_pub_key_set; +pub use self::node_pub_key_set::NodePubKeySet; +pub mod observed_tx; +pub use self::observed_tx::ObservedTx; +pub mod ping; +pub use self::ping::Ping; +pub mod pol_response; +pub use self::pol_response::PolResponse; +pub mod pool; +pub use self::pool::Pool; +pub mod queue_response; +pub use self::queue_response::QueueResponse; +pub mod quote_fees; +pub use self::quote_fees::QuoteFees; +pub mod quote_loan_close_response; +pub use self::quote_loan_close_response::QuoteLoanCloseResponse; +pub mod quote_loan_open_response; +pub use self::quote_loan_open_response::QuoteLoanOpenResponse; +pub mod quote_saver_deposit_response; +pub use self::quote_saver_deposit_response::QuoteSaverDepositResponse; +pub mod quote_saver_withdraw_response; +pub use self::quote_saver_withdraw_response::QuoteSaverWithdrawResponse; +pub mod quote_swap_response; +pub use self::quote_swap_response::QuoteSwapResponse; +pub mod saver; +pub use self::saver::Saver; +pub mod streaming_swap; +pub use self::streaming_swap::StreamingSwap; +pub mod thorname; +pub use self::thorname::Thorname; +pub mod thorname_alias; +pub use self::thorname_alias::ThornameAlias; +pub mod tss_keysign_metric; +pub use self::tss_keysign_metric::TssKeysignMetric; +pub mod tss_metric; +pub use self::tss_metric::TssMetric; +pub mod tx; +pub use self::tx::Tx; +pub mod tx_details_response; +pub use self::tx_details_response::TxDetailsResponse; +pub mod tx_out_item; +pub use self::tx_out_item::TxOutItem; +pub mod tx_response; +pub use self::tx_response::TxResponse; +pub mod tx_signers_response; +pub use self::tx_signers_response::TxSignersResponse; +pub mod tx_stages_response; +pub use self::tx_stages_response::TxStagesResponse; +pub mod tx_stages_response_inbound_confirmation_counted; +pub use self::tx_stages_response_inbound_confirmation_counted::TxStagesResponseInboundConfirmationCounted; +pub mod tx_stages_response_inbound_finalised; +pub use self::tx_stages_response_inbound_finalised::TxStagesResponseInboundFinalised; +pub mod tx_stages_response_inbound_observed; +pub use self::tx_stages_response_inbound_observed::TxStagesResponseInboundObserved; +pub mod tx_stages_response_outbound_delay; +pub use self::tx_stages_response_outbound_delay::TxStagesResponseOutboundDelay; +pub mod tx_stages_response_outbound_signed; +pub use self::tx_stages_response_outbound_signed::TxStagesResponseOutboundSigned; +pub mod tx_stages_response_swap_finalised; +pub use self::tx_stages_response_swap_finalised::TxStagesResponseSwapFinalised; +pub mod tx_stages_response_swap_status; +pub use self::tx_stages_response_swap_status::TxStagesResponseSwapStatus; +pub mod tx_stages_response_swap_status_streaming; +pub use self::tx_stages_response_swap_status_streaming::TxStagesResponseSwapStatusStreaming; +pub mod tx_status_response; +pub use self::tx_status_response::TxStatusResponse; +pub mod tx_status_response_planned_out_txs_inner; +pub use self::tx_status_response_planned_out_txs_inner::TxStatusResponsePlannedOutTxsInner; +pub mod vault; +pub use self::vault::Vault; +pub mod vault_address; +pub use self::vault_address::VaultAddress; +pub mod vault_info; +pub use self::vault_info::VaultInfo; +pub mod vault_pubkeys_response; +pub use self::vault_pubkeys_response::VaultPubkeysResponse; +pub mod vault_router; +pub use self::vault_router::VaultRouter; +pub mod version_response; +pub use self::version_response::VersionResponse; diff --git a/thorchain-rs/src/models/msg_swap.rs b/thorchain-rs/src/models/msg_swap.rs new file mode 100644 index 0000000..8567e61 --- /dev/null +++ b/thorchain-rs/src/models/msg_swap.rs @@ -0,0 +1,76 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct MsgSwap { + #[serde(rename = "tx")] + pub tx: Box, + /// the asset to be swapped to + #[serde(rename = "target_asset")] + pub target_asset: String, + /// the destination address to receive the swap output + #[serde(rename = "destination", skip_serializing_if = "Option::is_none")] + pub destination: Option, + /// the minimum amount of output asset to receive (else cancelling and refunding the swap) + #[serde(rename = "trade_target")] + pub trade_target: String, + /// the affiliate address which will receive any affiliate fee + #[serde(rename = "affiliate_address", skip_serializing_if = "Option::is_none")] + pub affiliate_address: Option, + /// the affiliate fee in basis points + #[serde(rename = "affiliate_basis_points")] + pub affiliate_basis_points: String, + /// the signer (sender) of the transaction + #[serde(rename = "signer", skip_serializing_if = "Option::is_none")] + pub signer: Option, + /// the contract address if an aggregator is specified for a non-THORChain SwapOut + #[serde(rename = "aggregator", skip_serializing_if = "Option::is_none")] + pub aggregator: Option, + /// the desired output asset of the aggregator SwapOut + #[serde(rename = "aggregator_target_address", skip_serializing_if = "Option::is_none")] + pub aggregator_target_address: Option, + /// the minimum amount of SwapOut asset to receive (else cancelling the SwapOut and receiving THORChain's output) + #[serde(rename = "aggregator_target_limit", skip_serializing_if = "Option::is_none")] + pub aggregator_target_limit: Option, + /// 0 if a market order (immediately completed or refunded), 1 if a limit order (held until fulfillable) + #[serde(rename = "order_type", skip_serializing_if = "Option::is_none")] + pub order_type: Option, + /// number of swaps to execute in a streaming swap + #[serde(rename = "stream_quantity", skip_serializing_if = "Option::is_none")] + pub stream_quantity: Option, + /// the interval (in blocks) to execute the streaming swap + #[serde(rename = "stream_interval", skip_serializing_if = "Option::is_none")] + pub stream_interval: Option, +} + +impl MsgSwap { + pub fn new(tx: crate::models::Tx, target_asset: String, trade_target: String, affiliate_basis_points: String) -> MsgSwap { + MsgSwap { + tx: Box::new(tx), + target_asset, + destination: None, + trade_target, + affiliate_address: None, + affiliate_basis_points, + signer: None, + aggregator: None, + aggregator_target_address: None, + aggregator_target_limit: None, + order_type: None, + stream_quantity: None, + stream_interval: None, + } + } +} + + diff --git a/thorchain-rs/src/models/network_response.rs b/thorchain-rs/src/models/network_response.rs new file mode 100644 index 0000000..1f02823 --- /dev/null +++ b/thorchain-rs/src/models/network_response.rs @@ -0,0 +1,81 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct NetworkResponse { + /// total amount of RUNE awarded to node operators + #[serde(rename = "bond_reward_rune")] + pub bond_reward_rune: String, + /// total of burned BEP2 RUNE + #[serde(rename = "burned_bep_2_rune")] + pub burned_bep_2_rune: String, + /// total of burned ERC20 RUNE + #[serde(rename = "burned_erc_20_rune")] + pub burned_erc_20_rune: String, + /// total bonded RUNE + #[serde(rename = "total_bond_units")] + pub total_bond_units: String, + /// effective security bond used to determine maximum pooled RUNE + #[serde(rename = "effective_security_bond")] + pub effective_security_bond: String, + /// total reserve RUNE + #[serde(rename = "total_reserve")] + pub total_reserve: String, + /// Returns true if there exist RetiringVaults which have not finished migrating funds to new ActiveVaults + #[serde(rename = "vaults_migrating")] + pub vaults_migrating: bool, + /// Sum of the gas the network has spent to send outbounds + #[serde(rename = "gas_spent_rune")] + pub gas_spent_rune: String, + /// Sum of the gas withheld from users to cover outbound gas + #[serde(rename = "gas_withheld_rune")] + pub gas_withheld_rune: String, + /// Current outbound fee multiplier, in basis points + #[serde(rename = "outbound_fee_multiplier", skip_serializing_if = "Option::is_none")] + pub outbound_fee_multiplier: Option, + /// the outbound transaction fee in rune, converted from the NativeOutboundFeeUSD mimir + #[serde(rename = "native_outbound_fee_rune")] + pub native_outbound_fee_rune: String, + /// the native transaction fee in rune, converted from the NativeTransactionFeeUSD mimir + #[serde(rename = "native_tx_fee_rune")] + pub native_tx_fee_rune: String, + /// the thorname register fee in rune, converted from the TNSRegisterFeeUSD mimir + #[serde(rename = "tns_register_fee_rune")] + pub tns_register_fee_rune: String, + /// the thorname fee per block in rune, converted from the TNSFeePerBlockUSD mimir + #[serde(rename = "tns_fee_per_block_rune")] + pub tns_fee_per_block_rune: String, +} + +impl NetworkResponse { + pub fn new(bond_reward_rune: String, burned_bep_2_rune: String, burned_erc_20_rune: String, total_bond_units: String, effective_security_bond: String, total_reserve: String, vaults_migrating: bool, gas_spent_rune: String, gas_withheld_rune: String, native_outbound_fee_rune: String, native_tx_fee_rune: String, tns_register_fee_rune: String, tns_fee_per_block_rune: String) -> NetworkResponse { + NetworkResponse { + bond_reward_rune, + burned_bep_2_rune, + burned_erc_20_rune, + total_bond_units, + effective_security_bond, + total_reserve, + vaults_migrating, + gas_spent_rune, + gas_withheld_rune, + outbound_fee_multiplier: None, + native_outbound_fee_rune, + native_tx_fee_rune, + tns_register_fee_rune, + tns_fee_per_block_rune, + } + } +} + + diff --git a/thorchain-rs/src/models/node.rs b/thorchain-rs/src/models/node.rs new file mode 100644 index 0000000..2f122a3 --- /dev/null +++ b/thorchain-rs/src/models/node.rs @@ -0,0 +1,116 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct Node { + #[serde(rename = "node_address")] + pub node_address: String, + #[serde(rename = "status")] + pub status: Status, + #[serde(rename = "pub_key_set")] + pub pub_key_set: Box, + /// the consensus pub key for the node + #[serde(rename = "validator_cons_pub_key")] + pub validator_cons_pub_key: String, + /// the P2PID (:6040/p2pid endpoint) of the node + #[serde(rename = "peer_id")] + pub peer_id: String, + /// the block height at which the node became active + #[serde(rename = "active_block_height")] + pub active_block_height: i64, + /// the block height of the current provided information for the node + #[serde(rename = "status_since")] + pub status_since: i64, + #[serde(rename = "node_operator_address")] + pub node_operator_address: String, + /// current node bond + #[serde(rename = "total_bond")] + pub total_bond: String, + #[serde(rename = "bond_providers")] + pub bond_providers: Box, + /// the set of vault public keys of which the node is a member + #[serde(rename = "signer_membership")] + pub signer_membership: Vec, + #[serde(rename = "requested_to_leave")] + pub requested_to_leave: bool, + /// indicates whether the node has been forced to leave by the network, typically via ban + #[serde(rename = "forced_to_leave")] + pub forced_to_leave: bool, + #[serde(rename = "leave_height")] + pub leave_height: i64, + #[serde(rename = "ip_address")] + pub ip_address: String, + /// the currently set version of the node + #[serde(rename = "version")] + pub version: String, + /// the accumlated slash points, reset at churn but excessive slash points may carry over + #[serde(rename = "slash_points")] + pub slash_points: i64, + #[serde(rename = "jail")] + pub jail: Box, + #[serde(rename = "current_award")] + pub current_award: String, + /// the last observed heights for all chain by the node + #[serde(rename = "observe_chains")] + pub observe_chains: Vec, + #[serde(rename = "preflight_status")] + pub preflight_status: Box, +} + +impl Node { + pub fn new(node_address: String, status: Status, pub_key_set: crate::models::NodePubKeySet, validator_cons_pub_key: String, peer_id: String, active_block_height: i64, status_since: i64, node_operator_address: String, total_bond: String, bond_providers: crate::models::NodeBondProviders, signer_membership: Vec, requested_to_leave: bool, forced_to_leave: bool, leave_height: i64, ip_address: String, version: String, slash_points: i64, jail: crate::models::NodeJail, current_award: String, observe_chains: Vec, preflight_status: crate::models::NodePreflightStatus) -> Node { + Node { + node_address, + status, + pub_key_set: Box::new(pub_key_set), + validator_cons_pub_key, + peer_id, + active_block_height, + status_since, + node_operator_address, + total_bond, + bond_providers: Box::new(bond_providers), + signer_membership, + requested_to_leave, + forced_to_leave, + leave_height, + ip_address, + version, + slash_points, + jail: Box::new(jail), + current_award, + observe_chains, + preflight_status: Box::new(preflight_status), + } + } +} + +/// +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum Status { + #[serde(rename = "Active")] + Active, + #[serde(rename = "Whitelisted")] + Whitelisted, + #[serde(rename = "Standby")] + Standby, + #[serde(rename = "Disabled")] + Disabled, +} + +impl Default for Status { + fn default() -> Status { + Self::Active + } +} + diff --git a/thorchain-rs/src/models/node_bond_provider.rs b/thorchain-rs/src/models/node_bond_provider.rs new file mode 100644 index 0000000..1968f15 --- /dev/null +++ b/thorchain-rs/src/models/node_bond_provider.rs @@ -0,0 +1,31 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct NodeBondProvider { + #[serde(rename = "bond_address", skip_serializing_if = "Option::is_none")] + pub bond_address: Option, + #[serde(rename = "bond", skip_serializing_if = "Option::is_none")] + pub bond: Option, +} + +impl NodeBondProvider { + pub fn new() -> NodeBondProvider { + NodeBondProvider { + bond_address: None, + bond: None, + } + } +} + + diff --git a/thorchain-rs/src/models/node_bond_providers.rs b/thorchain-rs/src/models/node_bond_providers.rs new file mode 100644 index 0000000..ea63882 --- /dev/null +++ b/thorchain-rs/src/models/node_bond_providers.rs @@ -0,0 +1,32 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct NodeBondProviders { + /// node operator fee in basis points + #[serde(rename = "node_operator_fee", skip_serializing_if = "Option::is_none")] + pub node_operator_fee: Option, + #[serde(rename = "providers", skip_serializing_if = "Option::is_none")] + pub providers: Option>, +} + +impl NodeBondProviders { + pub fn new() -> NodeBondProviders { + NodeBondProviders { + node_operator_fee: None, + providers: None, + } + } +} + + diff --git a/thorchain-rs/src/models/node_jail.rs b/thorchain-rs/src/models/node_jail.rs new file mode 100644 index 0000000..e217e39 --- /dev/null +++ b/thorchain-rs/src/models/node_jail.rs @@ -0,0 +1,31 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct NodeJail { + #[serde(rename = "release_height", skip_serializing_if = "Option::is_none")] + pub release_height: Option, + #[serde(rename = "reason", skip_serializing_if = "Option::is_none")] + pub reason: Option, +} + +impl NodeJail { + pub fn new() -> NodeJail { + NodeJail { + release_height: None, + reason: None, + } + } +} + + diff --git a/thorchain-rs/src/models/node_keygen_metric.rs b/thorchain-rs/src/models/node_keygen_metric.rs new file mode 100644 index 0000000..53a33c8 --- /dev/null +++ b/thorchain-rs/src/models/node_keygen_metric.rs @@ -0,0 +1,31 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct NodeKeygenMetric { + #[serde(rename = "address", skip_serializing_if = "Option::is_none")] + pub address: Option, + #[serde(rename = "tss_time", skip_serializing_if = "Option::is_none")] + pub tss_time: Option, +} + +impl NodeKeygenMetric { + pub fn new() -> NodeKeygenMetric { + NodeKeygenMetric { + address: None, + tss_time: None, + } + } +} + + diff --git a/thorchain-rs/src/models/node_preflight_status.rs b/thorchain-rs/src/models/node_preflight_status.rs new file mode 100644 index 0000000..7640a64 --- /dev/null +++ b/thorchain-rs/src/models/node_preflight_status.rs @@ -0,0 +1,36 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct NodePreflightStatus { + /// the next status of the node + #[serde(rename = "status")] + pub status: String, + /// the reason for the transition to the next status + #[serde(rename = "reason")] + pub reason: String, + #[serde(rename = "code")] + pub code: i64, +} + +impl NodePreflightStatus { + pub fn new(status: String, reason: String, code: i64) -> NodePreflightStatus { + NodePreflightStatus { + status, + reason, + code, + } + } +} + + diff --git a/thorchain-rs/src/models/node_pub_key_set.rs b/thorchain-rs/src/models/node_pub_key_set.rs new file mode 100644 index 0000000..6c9c99e --- /dev/null +++ b/thorchain-rs/src/models/node_pub_key_set.rs @@ -0,0 +1,31 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct NodePubKeySet { + #[serde(rename = "secp256k1", skip_serializing_if = "Option::is_none")] + pub secp256k1: Option, + #[serde(rename = "ed25519", skip_serializing_if = "Option::is_none")] + pub ed25519: Option, +} + +impl NodePubKeySet { + pub fn new() -> NodePubKeySet { + NodePubKeySet { + secp256k1: None, + ed25519: None, + } + } +} + + diff --git a/thorchain-rs/src/models/observed_tx.rs b/thorchain-rs/src/models/observed_tx.rs new file mode 100644 index 0000000..f8462ad --- /dev/null +++ b/thorchain-rs/src/models/observed_tx.rs @@ -0,0 +1,85 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct ObservedTx { + #[serde(rename = "tx")] + pub tx: Box, + #[serde(rename = "status", skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "out_hashes", skip_serializing_if = "Option::is_none")] + pub out_hashes: Option>, + /// same as external_observed_height, to be deprecated in favour of external_observed_height + #[serde(rename = "block_height", skip_serializing_if = "Option::is_none")] + pub block_height: Option, + /// the block height on the external source chain when the transaction was observed, not provided if chain is THOR + #[serde(rename = "external_observed_height", skip_serializing_if = "Option::is_none")] + pub external_observed_height: Option, + #[serde(rename = "signers", skip_serializing_if = "Option::is_none")] + pub signers: Option>, + #[serde(rename = "observed_pub_key", skip_serializing_if = "Option::is_none")] + pub observed_pub_key: Option, + #[serde(rename = "keysign_ms", skip_serializing_if = "Option::is_none")] + pub keysign_ms: Option, + /// same as external_confirmation_delay_height, to be deprecated in favour of external_confirmation_delay_height + #[serde(rename = "finalise_height", skip_serializing_if = "Option::is_none")] + pub finalise_height: Option, + /// the block height on the external source chain when confirmation counting will be complete, not provided if chain is THOR + #[serde(rename = "external_confirmation_delay_height", skip_serializing_if = "Option::is_none")] + pub external_confirmation_delay_height: Option, + /// the outbound aggregator to use, will also match a suffix + #[serde(rename = "aggregator", skip_serializing_if = "Option::is_none")] + pub aggregator: Option, + /// the aggregator target asset provided to transferOutAndCall + #[serde(rename = "aggregator_target", skip_serializing_if = "Option::is_none")] + pub aggregator_target: Option, + /// the aggregator target asset limit provided to transferOutAndCall + #[serde(rename = "aggregator_target_limit", skip_serializing_if = "Option::is_none")] + pub aggregator_target_limit: Option, +} + +impl ObservedTx { + pub fn new(tx: crate::models::Tx) -> ObservedTx { + ObservedTx { + tx: Box::new(tx), + status: None, + out_hashes: None, + block_height: None, + external_observed_height: None, + signers: None, + observed_pub_key: None, + keysign_ms: None, + finalise_height: None, + external_confirmation_delay_height: None, + aggregator: None, + aggregator_target: None, + aggregator_target_limit: None, + } + } +} + +/// +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum Status { + #[serde(rename = "done")] + Done, + #[serde(rename = "incomplete")] + Incomplete, +} + +impl Default for Status { + fn default() -> Status { + Self::Done + } +} + diff --git a/thorchain-rs/src/models/ping.rs b/thorchain-rs/src/models/ping.rs new file mode 100644 index 0000000..7751a63 --- /dev/null +++ b/thorchain-rs/src/models/ping.rs @@ -0,0 +1,28 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct Ping { + #[serde(rename = "ping", skip_serializing_if = "Option::is_none")] + pub ping: Option, +} + +impl Ping { + pub fn new() -> Ping { + Ping { + ping: None, + } + } +} + + diff --git a/thorchain-rs/src/models/pol_response.rs b/thorchain-rs/src/models/pol_response.rs new file mode 100644 index 0000000..3e0abc9 --- /dev/null +++ b/thorchain-rs/src/models/pol_response.rs @@ -0,0 +1,45 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct PolResponse { + /// total amount of RUNE deposited into the pools + #[serde(rename = "rune_deposited")] + pub rune_deposited: String, + /// total amount of RUNE withdrawn from the pools + #[serde(rename = "rune_withdrawn")] + pub rune_withdrawn: String, + /// total value of protocol's LP position in RUNE value + #[serde(rename = "value")] + pub value: String, + /// profit and loss of protocol owned liquidity + #[serde(rename = "pnl")] + pub pnl: String, + /// current amount of rune deposited + #[serde(rename = "current_deposit")] + pub current_deposit: String, +} + +impl PolResponse { + pub fn new(rune_deposited: String, rune_withdrawn: String, value: String, pnl: String, current_deposit: String) -> PolResponse { + PolResponse { + rune_deposited, + rune_withdrawn, + value, + pnl, + current_deposit, + } + } +} + + diff --git a/thorchain-rs/src/models/pool.rs b/thorchain-rs/src/models/pool.rs new file mode 100644 index 0000000..46af96c --- /dev/null +++ b/thorchain-rs/src/models/pool.rs @@ -0,0 +1,86 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct Pool { + #[serde(rename = "asset")] + pub asset: String, + #[serde(rename = "status")] + pub status: String, + #[serde(rename = "decimals", skip_serializing_if = "Option::is_none")] + pub decimals: Option, + #[serde(rename = "pending_inbound_asset")] + pub pending_inbound_asset: String, + #[serde(rename = "pending_inbound_rune")] + pub pending_inbound_rune: String, + #[serde(rename = "balance_asset")] + pub balance_asset: String, + #[serde(rename = "balance_rune")] + pub balance_rune: String, + /// the total pool units, this is the sum of LP and synth units + #[serde(rename = "pool_units")] + pub pool_units: String, + /// the total pool liquidity provider units + #[serde(rename = "LP_units")] + pub lp_units: String, + /// the total synth units in the pool + #[serde(rename = "synth_units")] + pub synth_units: String, + /// the total supply of synths for the asset + #[serde(rename = "synth_supply")] + pub synth_supply: String, + /// the balance of L1 asset deposited into the Savers Vault + #[serde(rename = "savers_depth")] + pub savers_depth: String, + /// the number of units owned by Savers + #[serde(rename = "savers_units")] + pub savers_units: String, + /// whether additional synths cannot be minted + #[serde(rename = "synth_mint_paused")] + pub synth_mint_paused: bool, + /// the amount of synth supply remaining before the current max supply is reached + #[serde(rename = "synth_supply_remaining")] + pub synth_supply_remaining: String, + /// the amount of collateral collects for loans + #[serde(rename = "loan_collateral")] + pub loan_collateral: String, + /// the current loan collateralization ratio + #[serde(rename = "loan_cr")] + pub loan_cr: String, +} + +impl Pool { + pub fn new(asset: String, status: String, pending_inbound_asset: String, pending_inbound_rune: String, balance_asset: String, balance_rune: String, pool_units: String, lp_units: String, synth_units: String, synth_supply: String, savers_depth: String, savers_units: String, synth_mint_paused: bool, synth_supply_remaining: String, loan_collateral: String, loan_cr: String) -> Pool { + Pool { + asset, + status, + decimals: None, + pending_inbound_asset, + pending_inbound_rune, + balance_asset, + balance_rune, + pool_units, + lp_units, + synth_units, + synth_supply, + savers_depth, + savers_units, + synth_mint_paused, + synth_supply_remaining, + loan_collateral, + loan_cr, + } + } +} + + diff --git a/thorchain-rs/src/models/queue_response.rs b/thorchain-rs/src/models/queue_response.rs new file mode 100644 index 0000000..57357f9 --- /dev/null +++ b/thorchain-rs/src/models/queue_response.rs @@ -0,0 +1,39 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct QueueResponse { + #[serde(rename = "swap")] + pub swap: i64, + /// number of signed outbound tx in the queue + #[serde(rename = "outbound")] + pub outbound: i64, + #[serde(rename = "internal")] + pub internal: i64, + /// scheduled outbound value in RUNE + #[serde(rename = "scheduled_outbound_value")] + pub scheduled_outbound_value: String, +} + +impl QueueResponse { + pub fn new(swap: i64, outbound: i64, internal: i64, scheduled_outbound_value: String) -> QueueResponse { + QueueResponse { + swap, + outbound, + internal, + scheduled_outbound_value, + } + } +} + + diff --git a/thorchain-rs/src/models/quote_fees.rs b/thorchain-rs/src/models/quote_fees.rs new file mode 100644 index 0000000..757bd55 --- /dev/null +++ b/thorchain-rs/src/models/quote_fees.rs @@ -0,0 +1,42 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct QuoteFees { + #[serde(rename = "asset")] + pub asset: String, + #[serde(rename = "affiliate", skip_serializing_if = "Option::is_none")] + pub affiliate: Option, + #[serde(rename = "outbound")] + pub outbound: String, + /// liquidity fees paid to pools + #[serde(rename = "liquidity", skip_serializing_if = "Option::is_none")] + pub liquidity: Option, + /// total basis points in fees relative to amount out + #[serde(rename = "total_bps", skip_serializing_if = "Option::is_none")] + pub total_bps: Option, +} + +impl QuoteFees { + pub fn new(asset: String, outbound: String) -> QuoteFees { + QuoteFees { + asset, + affiliate: None, + outbound, + liquidity: None, + total_bps: None, + } + } +} + + diff --git a/thorchain-rs/src/models/quote_loan_close_response.rs b/thorchain-rs/src/models/quote_loan_close_response.rs new file mode 100644 index 0000000..a98ac84 --- /dev/null +++ b/thorchain-rs/src/models/quote_loan_close_response.rs @@ -0,0 +1,96 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct QuoteLoanCloseResponse { + /// the inbound address for the transaction on the source chain + #[serde(rename = "inbound_address", skip_serializing_if = "Option::is_none")] + pub inbound_address: Option, + /// the approximate number of source chain blocks required before processing + #[serde(rename = "inbound_confirmation_blocks", skip_serializing_if = "Option::is_none")] + pub inbound_confirmation_blocks: Option, + /// the approximate seconds for block confirmations required before processing + #[serde(rename = "inbound_confirmation_seconds", skip_serializing_if = "Option::is_none")] + pub inbound_confirmation_seconds: Option, + /// the number of thorchain blocks the outbound will be delayed + #[serde(rename = "outbound_delay_blocks")] + pub outbound_delay_blocks: i64, + /// the approximate seconds for the outbound delay before it will be sent + #[serde(rename = "outbound_delay_seconds")] + pub outbound_delay_seconds: i64, + #[serde(rename = "fees")] + pub fees: Box, + /// the total swap slippage in basis points + #[serde(rename = "slippage_bps", skip_serializing_if = "Option::is_none")] + pub slippage_bps: Option, + /// the total streaming swap slippage in basis points + #[serde(rename = "streaming_slippage_bps", skip_serializing_if = "Option::is_none")] + pub streaming_slippage_bps: Option, + /// the EVM chain router contract address + #[serde(rename = "router", skip_serializing_if = "Option::is_none")] + pub router: Option, + /// expiration timestamp in unix seconds + #[serde(rename = "expiry")] + pub expiry: i64, + /// static warning message + #[serde(rename = "warning")] + pub warning: String, + /// chain specific quote notes + #[serde(rename = "notes")] + pub notes: String, + /// Defines the minimum transaction size for the chain in base units (sats, wei, uatom). Transctions with asset amounts lower than the dust_threshold are ignored. + #[serde(rename = "dust_threshold", skip_serializing_if = "Option::is_none")] + pub dust_threshold: Option, + /// The recommended minimum inbound amount for this transaction type & inbound asset. Sending less than this amount could result in failed refunds. + #[serde(rename = "recommended_min_amount_in", skip_serializing_if = "Option::is_none")] + pub recommended_min_amount_in: Option, + /// generated memo for the loan close + #[serde(rename = "memo")] + pub memo: String, + /// the amount of collateral asset the user can expect to receive after fees in 1e8 decimals + #[serde(rename = "expected_amount_out")] + pub expected_amount_out: String, + /// the expected amount of collateral decrease on the loan + #[serde(rename = "expected_collateral_withdrawn")] + pub expected_collateral_withdrawn: String, + /// the expected amount of TOR debt decrease on the loan + #[serde(rename = "expected_debt_repaid")] + pub expected_debt_repaid: String, +} + +impl QuoteLoanCloseResponse { + pub fn new(outbound_delay_blocks: i64, outbound_delay_seconds: i64, fees: crate::models::QuoteFees, expiry: i64, warning: String, notes: String, memo: String, expected_amount_out: String, expected_collateral_withdrawn: String, expected_debt_repaid: String) -> QuoteLoanCloseResponse { + QuoteLoanCloseResponse { + inbound_address: None, + inbound_confirmation_blocks: None, + inbound_confirmation_seconds: None, + outbound_delay_blocks, + outbound_delay_seconds, + fees: Box::new(fees), + slippage_bps: None, + streaming_slippage_bps: None, + router: None, + expiry, + warning, + notes, + dust_threshold: None, + recommended_min_amount_in: None, + memo, + expected_amount_out, + expected_collateral_withdrawn, + expected_debt_repaid, + } + } +} + + diff --git a/thorchain-rs/src/models/quote_loan_open_response.rs b/thorchain-rs/src/models/quote_loan_open_response.rs new file mode 100644 index 0000000..f666be7 --- /dev/null +++ b/thorchain-rs/src/models/quote_loan_open_response.rs @@ -0,0 +1,100 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct QuoteLoanOpenResponse { + /// the inbound address for the transaction on the source chain + #[serde(rename = "inbound_address", skip_serializing_if = "Option::is_none")] + pub inbound_address: Option, + /// the approximate number of source chain blocks required before processing + #[serde(rename = "inbound_confirmation_blocks", skip_serializing_if = "Option::is_none")] + pub inbound_confirmation_blocks: Option, + /// the approximate seconds for block confirmations required before processing + #[serde(rename = "inbound_confirmation_seconds", skip_serializing_if = "Option::is_none")] + pub inbound_confirmation_seconds: Option, + /// the number of thorchain blocks the outbound will be delayed + #[serde(rename = "outbound_delay_blocks")] + pub outbound_delay_blocks: i64, + /// the approximate seconds for the outbound delay before it will be sent + #[serde(rename = "outbound_delay_seconds")] + pub outbound_delay_seconds: i64, + #[serde(rename = "fees")] + pub fees: Box, + /// the total swap slippage in basis points + #[serde(rename = "slippage_bps", skip_serializing_if = "Option::is_none")] + pub slippage_bps: Option, + /// the total streaming swap slippage in basis points + #[serde(rename = "streaming_slippage_bps", skip_serializing_if = "Option::is_none")] + pub streaming_slippage_bps: Option, + /// the EVM chain router contract address + #[serde(rename = "router", skip_serializing_if = "Option::is_none")] + pub router: Option, + /// expiration timestamp in unix seconds + #[serde(rename = "expiry")] + pub expiry: i64, + /// static warning message + #[serde(rename = "warning")] + pub warning: String, + /// chain specific quote notes + #[serde(rename = "notes")] + pub notes: String, + /// Defines the minimum transaction size for the chain in base units (sats, wei, uatom). Transctions with asset amounts lower than the dust_threshold are ignored. + #[serde(rename = "dust_threshold", skip_serializing_if = "Option::is_none")] + pub dust_threshold: Option, + /// The recommended minimum inbound amount for this transaction type & inbound asset. Sending less than this amount could result in failed refunds. + #[serde(rename = "recommended_min_amount_in", skip_serializing_if = "Option::is_none")] + pub recommended_min_amount_in: Option, + /// generated memo for the loan open + #[serde(rename = "memo", skip_serializing_if = "Option::is_none")] + pub memo: Option, + /// the amount of the target asset the user can expect to receive after fees in 1e8 decimals + #[serde(rename = "expected_amount_out")] + pub expected_amount_out: String, + /// the expected collateralization ratio in basis points + #[serde(rename = "expected_collateralization_ratio")] + pub expected_collateralization_ratio: String, + /// the expected amount of collateral increase on the loan + #[serde(rename = "expected_collateral_deposited")] + pub expected_collateral_deposited: String, + /// the expected amount of TOR debt increase on the loan + #[serde(rename = "expected_debt_issued")] + pub expected_debt_issued: String, +} + +impl QuoteLoanOpenResponse { + pub fn new(outbound_delay_blocks: i64, outbound_delay_seconds: i64, fees: crate::models::QuoteFees, expiry: i64, warning: String, notes: String, expected_amount_out: String, expected_collateralization_ratio: String, expected_collateral_deposited: String, expected_debt_issued: String) -> QuoteLoanOpenResponse { + QuoteLoanOpenResponse { + inbound_address: None, + inbound_confirmation_blocks: None, + inbound_confirmation_seconds: None, + outbound_delay_blocks, + outbound_delay_seconds, + fees: Box::new(fees), + slippage_bps: None, + streaming_slippage_bps: None, + router: None, + expiry, + warning, + notes, + dust_threshold: None, + recommended_min_amount_in: None, + memo: None, + expected_amount_out, + expected_collateralization_ratio, + expected_collateral_deposited, + expected_debt_issued, + } + } +} + + diff --git a/thorchain-rs/src/models/quote_saver_deposit_response.rs b/thorchain-rs/src/models/quote_saver_deposit_response.rs new file mode 100644 index 0000000..6953f32 --- /dev/null +++ b/thorchain-rs/src/models/quote_saver_deposit_response.rs @@ -0,0 +1,92 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct QuoteSaverDepositResponse { + /// the inbound address for the transaction on the source chain + #[serde(rename = "inbound_address")] + pub inbound_address: String, + /// the approximate number of source chain blocks required before processing + #[serde(rename = "inbound_confirmation_blocks", skip_serializing_if = "Option::is_none")] + pub inbound_confirmation_blocks: Option, + /// the approximate seconds for block confirmations required before processing + #[serde(rename = "inbound_confirmation_seconds", skip_serializing_if = "Option::is_none")] + pub inbound_confirmation_seconds: Option, + /// the number of thorchain blocks the outbound will be delayed + #[serde(rename = "outbound_delay_blocks", skip_serializing_if = "Option::is_none")] + pub outbound_delay_blocks: Option, + /// the approximate seconds for the outbound delay before it will be sent + #[serde(rename = "outbound_delay_seconds", skip_serializing_if = "Option::is_none")] + pub outbound_delay_seconds: Option, + #[serde(rename = "fees")] + pub fees: Box, + /// the total swap slippage in basis points + #[serde(rename = "slippage_bps")] + pub slippage_bps: i64, + /// the total streaming swap slippage in basis points + #[serde(rename = "streaming_slippage_bps", skip_serializing_if = "Option::is_none")] + pub streaming_slippage_bps: Option, + /// the EVM chain router contract address + #[serde(rename = "router", skip_serializing_if = "Option::is_none")] + pub router: Option, + /// expiration timestamp in unix seconds + #[serde(rename = "expiry")] + pub expiry: i64, + /// static warning message + #[serde(rename = "warning")] + pub warning: String, + /// chain specific quote notes + #[serde(rename = "notes")] + pub notes: String, + /// Defines the minimum transaction size for the chain in base units (sats, wei, uatom). Transctions with asset amounts lower than the dust_threshold are ignored. + #[serde(rename = "dust_threshold", skip_serializing_if = "Option::is_none")] + pub dust_threshold: Option, + /// The recommended minimum inbound amount for this transaction type & inbound asset. Sending less than this amount could result in failed refunds. + #[serde(rename = "recommended_min_amount_in", skip_serializing_if = "Option::is_none")] + pub recommended_min_amount_in: Option, + /// generated memo for the deposit + #[serde(rename = "memo")] + pub memo: String, + /// same as expected_amount_deposit, to be deprecated in favour of expected_amount_deposit + #[serde(rename = "expected_amount_out", skip_serializing_if = "Option::is_none")] + pub expected_amount_out: Option, + /// the amount of the target asset the user can expect to deposit after fees + #[serde(rename = "expected_amount_deposit")] + pub expected_amount_deposit: String, +} + +impl QuoteSaverDepositResponse { + pub fn new(inbound_address: String, fees: crate::models::QuoteFees, slippage_bps: i64, expiry: i64, warning: String, notes: String, memo: String, expected_amount_deposit: String) -> QuoteSaverDepositResponse { + QuoteSaverDepositResponse { + inbound_address, + inbound_confirmation_blocks: None, + inbound_confirmation_seconds: None, + outbound_delay_blocks: None, + outbound_delay_seconds: None, + fees: Box::new(fees), + slippage_bps, + streaming_slippage_bps: None, + router: None, + expiry, + warning, + notes, + dust_threshold: None, + recommended_min_amount_in: None, + memo, + expected_amount_out: None, + expected_amount_deposit, + } + } +} + + diff --git a/thorchain-rs/src/models/quote_saver_withdraw_response.rs b/thorchain-rs/src/models/quote_saver_withdraw_response.rs new file mode 100644 index 0000000..1427ceb --- /dev/null +++ b/thorchain-rs/src/models/quote_saver_withdraw_response.rs @@ -0,0 +1,92 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct QuoteSaverWithdrawResponse { + /// the inbound address for the transaction on the source chain + #[serde(rename = "inbound_address")] + pub inbound_address: String, + /// the approximate number of source chain blocks required before processing + #[serde(rename = "inbound_confirmation_blocks", skip_serializing_if = "Option::is_none")] + pub inbound_confirmation_blocks: Option, + /// the approximate seconds for block confirmations required before processing + #[serde(rename = "inbound_confirmation_seconds", skip_serializing_if = "Option::is_none")] + pub inbound_confirmation_seconds: Option, + /// the number of thorchain blocks the outbound will be delayed + #[serde(rename = "outbound_delay_blocks")] + pub outbound_delay_blocks: i64, + /// the approximate seconds for the outbound delay before it will be sent + #[serde(rename = "outbound_delay_seconds")] + pub outbound_delay_seconds: i64, + #[serde(rename = "fees")] + pub fees: Box, + /// the total swap slippage in basis points + #[serde(rename = "slippage_bps")] + pub slippage_bps: i64, + /// the total streaming swap slippage in basis points + #[serde(rename = "streaming_slippage_bps", skip_serializing_if = "Option::is_none")] + pub streaming_slippage_bps: Option, + /// the EVM chain router contract address + #[serde(rename = "router", skip_serializing_if = "Option::is_none")] + pub router: Option, + /// expiration timestamp in unix seconds + #[serde(rename = "expiry")] + pub expiry: i64, + /// static warning message + #[serde(rename = "warning")] + pub warning: String, + /// chain specific quote notes + #[serde(rename = "notes")] + pub notes: String, + /// Defines the minimum transaction size for the chain in base units (sats, wei, uatom). Transctions with asset amounts lower than the dust_threshold are ignored. + #[serde(rename = "dust_threshold", skip_serializing_if = "Option::is_none")] + pub dust_threshold: Option, + /// The recommended minimum inbound amount for this transaction type & inbound asset. Sending less than this amount could result in failed refunds. + #[serde(rename = "recommended_min_amount_in", skip_serializing_if = "Option::is_none")] + pub recommended_min_amount_in: Option, + /// generated memo for the withdraw, the client can use this OR send the dust amount + #[serde(rename = "memo")] + pub memo: String, + /// the dust amount of the target asset the user should send to initialize the withdraw, the client can send this OR provide the memo + #[serde(rename = "dust_amount")] + pub dust_amount: String, + /// the amount of the target asset the user can expect to withdraw after fees in 1e8 decimals + #[serde(rename = "expected_amount_out")] + pub expected_amount_out: String, +} + +impl QuoteSaverWithdrawResponse { + pub fn new(inbound_address: String, outbound_delay_blocks: i64, outbound_delay_seconds: i64, fees: crate::models::QuoteFees, slippage_bps: i64, expiry: i64, warning: String, notes: String, memo: String, dust_amount: String, expected_amount_out: String) -> QuoteSaverWithdrawResponse { + QuoteSaverWithdrawResponse { + inbound_address, + inbound_confirmation_blocks: None, + inbound_confirmation_seconds: None, + outbound_delay_blocks, + outbound_delay_seconds, + fees: Box::new(fees), + slippage_bps, + streaming_slippage_bps: None, + router: None, + expiry, + warning, + notes, + dust_threshold: None, + recommended_min_amount_in: None, + memo, + dust_amount, + expected_amount_out, + } + } +} + + diff --git a/thorchain-rs/src/models/quote_swap_response.rs b/thorchain-rs/src/models/quote_swap_response.rs new file mode 100644 index 0000000..43c2b06 --- /dev/null +++ b/thorchain-rs/src/models/quote_swap_response.rs @@ -0,0 +1,108 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct QuoteSwapResponse { + /// the inbound address for the transaction on the source chain + #[serde(rename = "inbound_address", skip_serializing_if = "Option::is_none")] + pub inbound_address: Option, + /// the approximate number of source chain blocks required before processing + #[serde(rename = "inbound_confirmation_blocks", skip_serializing_if = "Option::is_none")] + pub inbound_confirmation_blocks: Option, + /// the approximate seconds for block confirmations required before processing + #[serde(rename = "inbound_confirmation_seconds", skip_serializing_if = "Option::is_none")] + pub inbound_confirmation_seconds: Option, + /// the number of thorchain blocks the outbound will be delayed + #[serde(rename = "outbound_delay_blocks")] + pub outbound_delay_blocks: i64, + /// the approximate seconds for the outbound delay before it will be sent + #[serde(rename = "outbound_delay_seconds")] + pub outbound_delay_seconds: i64, + #[serde(rename = "fees")] + pub fees: Box, + /// the total swap slippage in basis points + #[serde(rename = "slippage_bps")] + pub slippage_bps: i64, + /// the total streaming swap slippage in basis points + #[serde(rename = "streaming_slippage_bps")] + pub streaming_slippage_bps: i64, + /// the EVM chain router contract address + #[serde(rename = "router", skip_serializing_if = "Option::is_none")] + pub router: Option, + /// expiration timestamp in unix seconds + #[serde(rename = "expiry")] + pub expiry: i64, + /// static warning message + #[serde(rename = "warning")] + pub warning: String, + /// chain specific quote notes + #[serde(rename = "notes")] + pub notes: String, + /// Defines the minimum transaction size for the chain in base units (sats, wei, uatom). Transctions with asset amounts lower than the dust_threshold are ignored. + #[serde(rename = "dust_threshold", skip_serializing_if = "Option::is_none")] + pub dust_threshold: Option, + /// The recommended minimum inbound amount for this transaction type & inbound asset. Sending less than this amount could result in failed refunds. + #[serde(rename = "recommended_min_amount_in", skip_serializing_if = "Option::is_none")] + pub recommended_min_amount_in: Option, + /// generated memo for the swap + #[serde(rename = "memo", skip_serializing_if = "Option::is_none")] + pub memo: Option, + /// the amount of the target asset the user can expect to receive after fees + #[serde(rename = "expected_amount_out")] + pub expected_amount_out: String, + /// the amount of the target asset the user can expect to receive after fees for a streaming swap + #[serde(rename = "expected_amount_out_streaming")] + pub expected_amount_out_streaming: String, + /// the maxiumum amount of trades a streaming swap can do for a trade + #[serde(rename = "max_streaming_quantity", skip_serializing_if = "Option::is_none")] + pub max_streaming_quantity: Option, + /// the number of blocks the streaming swap will execute over + #[serde(rename = "streaming_swap_blocks", skip_serializing_if = "Option::is_none")] + pub streaming_swap_blocks: Option, + /// approx the number of seconds the streaming swap will execute over + #[serde(rename = "streaming_swap_seconds", skip_serializing_if = "Option::is_none")] + pub streaming_swap_seconds: Option, + /// total number of seconds a swap is expected to take (inbound conf + streaming swap + outbound delay) + #[serde(rename = "total_swap_seconds", skip_serializing_if = "Option::is_none")] + pub total_swap_seconds: Option, +} + +impl QuoteSwapResponse { + pub fn new(outbound_delay_blocks: i64, outbound_delay_seconds: i64, fees: crate::models::QuoteFees, slippage_bps: i64, streaming_slippage_bps: i64, expiry: i64, warning: String, notes: String, expected_amount_out: String, expected_amount_out_streaming: String) -> QuoteSwapResponse { + QuoteSwapResponse { + inbound_address: None, + inbound_confirmation_blocks: None, + inbound_confirmation_seconds: None, + outbound_delay_blocks, + outbound_delay_seconds, + fees: Box::new(fees), + slippage_bps, + streaming_slippage_bps, + router: None, + expiry, + warning, + notes, + dust_threshold: None, + recommended_min_amount_in: None, + memo: None, + expected_amount_out, + expected_amount_out_streaming, + max_streaming_quantity: None, + streaming_swap_blocks: None, + streaming_swap_seconds: None, + total_swap_seconds: None, + } + } +} + + diff --git a/thorchain-rs/src/models/saver.rs b/thorchain-rs/src/models/saver.rs new file mode 100644 index 0000000..f08bb11 --- /dev/null +++ b/thorchain-rs/src/models/saver.rs @@ -0,0 +1,49 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct Saver { + #[serde(rename = "asset")] + pub asset: String, + #[serde(rename = "asset_address")] + pub asset_address: String, + #[serde(rename = "last_add_height", skip_serializing_if = "Option::is_none")] + pub last_add_height: Option, + #[serde(rename = "last_withdraw_height", skip_serializing_if = "Option::is_none")] + pub last_withdraw_height: Option, + #[serde(rename = "units")] + pub units: String, + #[serde(rename = "asset_deposit_value")] + pub asset_deposit_value: String, + #[serde(rename = "asset_redeem_value")] + pub asset_redeem_value: String, + #[serde(rename = "growth_pct")] + pub growth_pct: String, +} + +impl Saver { + pub fn new(asset: String, asset_address: String, units: String, asset_deposit_value: String, asset_redeem_value: String, growth_pct: String) -> Saver { + Saver { + asset, + asset_address, + last_add_height: None, + last_withdraw_height: None, + units, + asset_deposit_value, + asset_redeem_value, + growth_pct, + } + } +} + + diff --git a/thorchain-rs/src/models/streaming_swap.rs b/thorchain-rs/src/models/streaming_swap.rs new file mode 100644 index 0000000..b54163a --- /dev/null +++ b/thorchain-rs/src/models/streaming_swap.rs @@ -0,0 +1,69 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct StreamingSwap { + /// the hash of a transaction + #[serde(rename = "tx_id", skip_serializing_if = "Option::is_none")] + pub tx_id: Option, + /// how often each swap is made, in blocks + #[serde(rename = "interval", skip_serializing_if = "Option::is_none")] + pub interval: Option, + /// the total number of swaps in a streaming swaps + #[serde(rename = "quantity", skip_serializing_if = "Option::is_none")] + pub quantity: Option, + /// the amount of swap attempts so far + #[serde(rename = "count", skip_serializing_if = "Option::is_none")] + pub count: Option, + /// the block height of the latest swap + #[serde(rename = "last_height", skip_serializing_if = "Option::is_none")] + pub last_height: Option, + /// the total number of tokens the swapper wants to receive of the output asset + #[serde(rename = "trade_target", skip_serializing_if = "Option::is_none")] + pub trade_target: Option, + /// the number of input tokens the swapper has deposited + #[serde(rename = "deposit", skip_serializing_if = "Option::is_none")] + pub deposit: Option, + /// the amount of input tokens that have been swapped so far + #[serde(rename = "in", skip_serializing_if = "Option::is_none")] + pub r#in: Option, + /// the amount of output tokens that have been swapped so far + #[serde(rename = "out", skip_serializing_if = "Option::is_none")] + pub out: Option, + /// the list of swap indexes that failed + #[serde(rename = "failed_swaps", skip_serializing_if = "Option::is_none")] + pub failed_swaps: Option>, + /// the list of reasons that sub-swaps have failed + #[serde(rename = "failed_swap_reasons", skip_serializing_if = "Option::is_none")] + pub failed_swap_reasons: Option>, +} + +impl StreamingSwap { + pub fn new() -> StreamingSwap { + StreamingSwap { + tx_id: None, + interval: None, + quantity: None, + count: None, + last_height: None, + trade_target: None, + deposit: None, + r#in: None, + out: None, + failed_swaps: None, + failed_swap_reasons: None, + } + } +} + + diff --git a/thorchain-rs/src/models/thorname.rs b/thorchain-rs/src/models/thorname.rs new file mode 100644 index 0000000..cba33ee --- /dev/null +++ b/thorchain-rs/src/models/thorname.rs @@ -0,0 +1,44 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct Thorname { + #[serde(rename = "name", skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "expire_block_height", skip_serializing_if = "Option::is_none")] + pub expire_block_height: Option, + #[serde(rename = "owner", skip_serializing_if = "Option::is_none")] + pub owner: Option, + #[serde(rename = "preferred_asset")] + pub preferred_asset: String, + /// Amount of RUNE currently accrued by this thorname in affiliate fees waiting to be swapped to preferred asset. + #[serde(rename = "affiliate_collector_rune", skip_serializing_if = "Option::is_none")] + pub affiliate_collector_rune: Option, + #[serde(rename = "aliases")] + pub aliases: Vec, +} + +impl Thorname { + pub fn new(preferred_asset: String, aliases: Vec) -> Thorname { + Thorname { + name: None, + expire_block_height: None, + owner: None, + preferred_asset, + affiliate_collector_rune: None, + aliases, + } + } +} + + diff --git a/thorchain-rs/src/models/thorname_alias.rs b/thorchain-rs/src/models/thorname_alias.rs new file mode 100644 index 0000000..7884692 --- /dev/null +++ b/thorchain-rs/src/models/thorname_alias.rs @@ -0,0 +1,31 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct ThornameAlias { + #[serde(rename = "chain", skip_serializing_if = "Option::is_none")] + pub chain: Option, + #[serde(rename = "address", skip_serializing_if = "Option::is_none")] + pub address: Option, +} + +impl ThornameAlias { + pub fn new() -> ThornameAlias { + ThornameAlias { + chain: None, + address: None, + } + } +} + + diff --git a/thorchain-rs/src/models/tss_keysign_metric.rs b/thorchain-rs/src/models/tss_keysign_metric.rs new file mode 100644 index 0000000..534e3b7 --- /dev/null +++ b/thorchain-rs/src/models/tss_keysign_metric.rs @@ -0,0 +1,31 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct TssKeysignMetric { + #[serde(rename = "tx_id", skip_serializing_if = "Option::is_none")] + pub tx_id: Option, + #[serde(rename = "node_tss_times")] + pub node_tss_times: Vec, +} + +impl TssKeysignMetric { + pub fn new(node_tss_times: Vec) -> TssKeysignMetric { + TssKeysignMetric { + tx_id: None, + node_tss_times, + } + } +} + + diff --git a/thorchain-rs/src/models/tss_metric.rs b/thorchain-rs/src/models/tss_metric.rs new file mode 100644 index 0000000..5b98f6e --- /dev/null +++ b/thorchain-rs/src/models/tss_metric.rs @@ -0,0 +1,31 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct TssMetric { + #[serde(rename = "address", skip_serializing_if = "Option::is_none")] + pub address: Option, + #[serde(rename = "tss_time", skip_serializing_if = "Option::is_none")] + pub tss_time: Option, +} + +impl TssMetric { + pub fn new() -> TssMetric { + TssMetric { + address: None, + tss_time: None, + } + } +} + + diff --git a/thorchain-rs/src/models/tx.rs b/thorchain-rs/src/models/tx.rs new file mode 100644 index 0000000..4c219a3 --- /dev/null +++ b/thorchain-rs/src/models/tx.rs @@ -0,0 +1,46 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct Tx { + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(rename = "chain", skip_serializing_if = "Option::is_none")] + pub chain: Option, + #[serde(rename = "from_address", skip_serializing_if = "Option::is_none")] + pub from_address: Option, + #[serde(rename = "to_address", skip_serializing_if = "Option::is_none")] + pub to_address: Option, + #[serde(rename = "coins")] + pub coins: Vec, + #[serde(rename = "gas")] + pub gas: Vec, + #[serde(rename = "memo", skip_serializing_if = "Option::is_none")] + pub memo: Option, +} + +impl Tx { + pub fn new(coins: Vec, gas: Vec) -> Tx { + Tx { + id: None, + chain: None, + from_address: None, + to_address: None, + coins, + gas, + memo: None, + } + } +} + + diff --git a/thorchain-rs/src/models/tx_details_response.rs b/thorchain-rs/src/models/tx_details_response.rs new file mode 100644 index 0000000..32ea363 --- /dev/null +++ b/thorchain-rs/src/models/tx_details_response.rs @@ -0,0 +1,58 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct TxDetailsResponse { + #[serde(rename = "tx_id", skip_serializing_if = "Option::is_none")] + pub tx_id: Option, + #[serde(rename = "tx")] + pub tx: Box, + #[serde(rename = "txs")] + pub txs: Vec, + #[serde(rename = "actions")] + pub actions: Vec, + #[serde(rename = "out_txs")] + pub out_txs: Vec, + /// the thorchain height at which the inbound reached consensus + #[serde(rename = "consensus_height", skip_serializing_if = "Option::is_none")] + pub consensus_height: Option, + /// the thorchain height at which the outbound was finalised + #[serde(rename = "finalised_height", skip_serializing_if = "Option::is_none")] + pub finalised_height: Option, + #[serde(rename = "updated_vault", skip_serializing_if = "Option::is_none")] + pub updated_vault: Option, + #[serde(rename = "reverted", skip_serializing_if = "Option::is_none")] + pub reverted: Option, + /// the thorchain height for which the outbound was scheduled + #[serde(rename = "outbound_height", skip_serializing_if = "Option::is_none")] + pub outbound_height: Option, +} + +impl TxDetailsResponse { + pub fn new(tx: crate::models::ObservedTx, txs: Vec, actions: Vec, out_txs: Vec) -> TxDetailsResponse { + TxDetailsResponse { + tx_id: None, + tx: Box::new(tx), + txs, + actions, + out_txs, + consensus_height: None, + finalised_height: None, + updated_vault: None, + reverted: None, + outbound_height: None, + } + } +} + + diff --git a/thorchain-rs/src/models/tx_out_item.rs b/thorchain-rs/src/models/tx_out_item.rs new file mode 100644 index 0000000..d14db4e --- /dev/null +++ b/thorchain-rs/src/models/tx_out_item.rs @@ -0,0 +1,55 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct TxOutItem { + #[serde(rename = "chain")] + pub chain: String, + #[serde(rename = "to_address")] + pub to_address: String, + #[serde(rename = "vault_pub_key", skip_serializing_if = "Option::is_none")] + pub vault_pub_key: Option, + #[serde(rename = "coin")] + pub coin: Box, + #[serde(rename = "memo", skip_serializing_if = "Option::is_none")] + pub memo: Option, + #[serde(rename = "max_gas")] + pub max_gas: Vec, + #[serde(rename = "gas_rate", skip_serializing_if = "Option::is_none")] + pub gas_rate: Option, + #[serde(rename = "in_hash", skip_serializing_if = "Option::is_none")] + pub in_hash: Option, + #[serde(rename = "out_hash", skip_serializing_if = "Option::is_none")] + pub out_hash: Option, + #[serde(rename = "height")] + pub height: i64, +} + +impl TxOutItem { + pub fn new(chain: String, to_address: String, coin: crate::models::Coin, max_gas: Vec, height: i64) -> TxOutItem { + TxOutItem { + chain, + to_address, + vault_pub_key: None, + coin: Box::new(coin), + memo: None, + max_gas, + gas_rate: None, + in_hash: None, + out_hash: None, + height, + } + } +} + + diff --git a/thorchain-rs/src/models/tx_response.rs b/thorchain-rs/src/models/tx_response.rs new file mode 100644 index 0000000..e737b56 --- /dev/null +++ b/thorchain-rs/src/models/tx_response.rs @@ -0,0 +1,43 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct TxResponse { + #[serde(rename = "observed_tx", skip_serializing_if = "Option::is_none")] + pub observed_tx: Option>, + /// the thorchain height at which the inbound reached consensus + #[serde(rename = "consensus_height", skip_serializing_if = "Option::is_none")] + pub consensus_height: Option, + /// the thorchain height at which the outbound was finalised + #[serde(rename = "finalised_height", skip_serializing_if = "Option::is_none")] + pub finalised_height: Option, + /// the thorchain height for which the outbound was scheduled + #[serde(rename = "outbound_height", skip_serializing_if = "Option::is_none")] + pub outbound_height: Option, + #[serde(rename = "keysign_metric", skip_serializing_if = "Option::is_none")] + pub keysign_metric: Option>, +} + +impl TxResponse { + pub fn new() -> TxResponse { + TxResponse { + observed_tx: None, + consensus_height: None, + finalised_height: None, + outbound_height: None, + keysign_metric: None, + } + } +} + + diff --git a/thorchain-rs/src/models/tx_signers_response.rs b/thorchain-rs/src/models/tx_signers_response.rs new file mode 100644 index 0000000..8eb15e1 --- /dev/null +++ b/thorchain-rs/src/models/tx_signers_response.rs @@ -0,0 +1,58 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct TxSignersResponse { + #[serde(rename = "tx_id", skip_serializing_if = "Option::is_none")] + pub tx_id: Option, + #[serde(rename = "tx")] + pub tx: Box, + #[serde(rename = "txs")] + pub txs: Vec, + #[serde(rename = "actions")] + pub actions: Vec, + #[serde(rename = "out_txs")] + pub out_txs: Vec, + /// the thorchain height at which the inbound reached consensus + #[serde(rename = "consensus_height", skip_serializing_if = "Option::is_none")] + pub consensus_height: Option, + /// the thorchain height at which the outbound was finalised + #[serde(rename = "finalised_height", skip_serializing_if = "Option::is_none")] + pub finalised_height: Option, + #[serde(rename = "updated_vault", skip_serializing_if = "Option::is_none")] + pub updated_vault: Option, + #[serde(rename = "reverted", skip_serializing_if = "Option::is_none")] + pub reverted: Option, + /// the thorchain height for which the outbound was scheduled + #[serde(rename = "outbound_height", skip_serializing_if = "Option::is_none")] + pub outbound_height: Option, +} + +impl TxSignersResponse { + pub fn new(tx: crate::models::ObservedTx, txs: Vec, actions: Vec, out_txs: Vec) -> TxSignersResponse { + TxSignersResponse { + tx_id: None, + tx: Box::new(tx), + txs, + actions, + out_txs, + consensus_height: None, + finalised_height: None, + updated_vault: None, + reverted: None, + outbound_height: None, + } + } +} + + diff --git a/thorchain-rs/src/models/tx_stages_response.rs b/thorchain-rs/src/models/tx_stages_response.rs new file mode 100644 index 0000000..1ec394e --- /dev/null +++ b/thorchain-rs/src/models/tx_stages_response.rs @@ -0,0 +1,46 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct TxStagesResponse { + #[serde(rename = "inbound_observed")] + pub inbound_observed: Box, + #[serde(rename = "inbound_confirmation_counted", skip_serializing_if = "Option::is_none")] + pub inbound_confirmation_counted: Option>, + #[serde(rename = "inbound_finalised", skip_serializing_if = "Option::is_none")] + pub inbound_finalised: Option>, + #[serde(rename = "swap_status", skip_serializing_if = "Option::is_none")] + pub swap_status: Option>, + #[serde(rename = "swap_finalised", skip_serializing_if = "Option::is_none")] + pub swap_finalised: Option>, + #[serde(rename = "outbound_delay", skip_serializing_if = "Option::is_none")] + pub outbound_delay: Option>, + #[serde(rename = "outbound_signed", skip_serializing_if = "Option::is_none")] + pub outbound_signed: Option>, +} + +impl TxStagesResponse { + pub fn new(inbound_observed: crate::models::TxStagesResponseInboundObserved) -> TxStagesResponse { + TxStagesResponse { + inbound_observed: Box::new(inbound_observed), + inbound_confirmation_counted: None, + inbound_finalised: None, + swap_status: None, + swap_finalised: None, + outbound_delay: None, + outbound_signed: None, + } + } +} + + diff --git a/thorchain-rs/src/models/tx_stages_response_inbound_confirmation_counted.rs b/thorchain-rs/src/models/tx_stages_response_inbound_confirmation_counted.rs new file mode 100644 index 0000000..dee8f19 --- /dev/null +++ b/thorchain-rs/src/models/tx_stages_response_inbound_confirmation_counted.rs @@ -0,0 +1,49 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct TxStagesResponseInboundConfirmationCounted { + /// the THORChain block height when confirmation counting began + #[serde(rename = "counting_start_height", skip_serializing_if = "Option::is_none")] + pub counting_start_height: Option, + /// the external source chain for which confirmation counting takes place + #[serde(rename = "chain", skip_serializing_if = "Option::is_none")] + pub chain: Option, + /// the block height on the external source chain when the transaction was observed + #[serde(rename = "external_observed_height", skip_serializing_if = "Option::is_none")] + pub external_observed_height: Option, + /// the block height on the external source chain when confirmation counting will be complete + #[serde(rename = "external_confirmation_delay_height", skip_serializing_if = "Option::is_none")] + pub external_confirmation_delay_height: Option, + /// the estimated remaining seconds before confirmation counting completes + #[serde(rename = "remaining_confirmation_seconds", skip_serializing_if = "Option::is_none")] + pub remaining_confirmation_seconds: Option, + /// returns true if no transaction confirmation counting remains to be done + #[serde(rename = "completed")] + pub completed: bool, +} + +impl TxStagesResponseInboundConfirmationCounted { + pub fn new(completed: bool) -> TxStagesResponseInboundConfirmationCounted { + TxStagesResponseInboundConfirmationCounted { + counting_start_height: None, + chain: None, + external_observed_height: None, + external_confirmation_delay_height: None, + remaining_confirmation_seconds: None, + completed, + } + } +} + + diff --git a/thorchain-rs/src/models/tx_stages_response_inbound_finalised.rs b/thorchain-rs/src/models/tx_stages_response_inbound_finalised.rs new file mode 100644 index 0000000..ed5ff27 --- /dev/null +++ b/thorchain-rs/src/models/tx_stages_response_inbound_finalised.rs @@ -0,0 +1,29 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct TxStagesResponseInboundFinalised { + /// returns true if the inbound transaction has been finalised (THORChain agreeing it exists) + #[serde(rename = "completed")] + pub completed: bool, +} + +impl TxStagesResponseInboundFinalised { + pub fn new(completed: bool) -> TxStagesResponseInboundFinalised { + TxStagesResponseInboundFinalised { + completed, + } + } +} + + diff --git a/thorchain-rs/src/models/tx_stages_response_inbound_observed.rs b/thorchain-rs/src/models/tx_stages_response_inbound_observed.rs new file mode 100644 index 0000000..6ed030a --- /dev/null +++ b/thorchain-rs/src/models/tx_stages_response_inbound_observed.rs @@ -0,0 +1,41 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct TxStagesResponseInboundObserved { + /// returns true if any nodes have observed the transaction (to be deprecated in favour of counts) + #[serde(rename = "started", skip_serializing_if = "Option::is_none")] + pub started: Option, + /// number of signers for pre-confirmation-counting observations + #[serde(rename = "pre_confirmation_count", skip_serializing_if = "Option::is_none")] + pub pre_confirmation_count: Option, + /// number of signers for final observations, after any confirmation counting complete + #[serde(rename = "final_count", skip_serializing_if = "Option::is_none")] + pub final_count: Option, + /// returns true if no transaction observation remains to be done + #[serde(rename = "completed")] + pub completed: bool, +} + +impl TxStagesResponseInboundObserved { + pub fn new(completed: bool) -> TxStagesResponseInboundObserved { + TxStagesResponseInboundObserved { + started: None, + pre_confirmation_count: None, + final_count: None, + completed, + } + } +} + + diff --git a/thorchain-rs/src/models/tx_stages_response_outbound_delay.rs b/thorchain-rs/src/models/tx_stages_response_outbound_delay.rs new file mode 100644 index 0000000..1ca45e2 --- /dev/null +++ b/thorchain-rs/src/models/tx_stages_response_outbound_delay.rs @@ -0,0 +1,37 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct TxStagesResponseOutboundDelay { + /// the number of remaining THORChain blocks the outbound will be delayed + #[serde(rename = "remaining_delay_blocks", skip_serializing_if = "Option::is_none")] + pub remaining_delay_blocks: Option, + /// the estimated remaining seconds of the outbound delay before it will be sent + #[serde(rename = "remaining_delay_seconds", skip_serializing_if = "Option::is_none")] + pub remaining_delay_seconds: Option, + /// returns true if no transaction outbound delay remains + #[serde(rename = "completed")] + pub completed: bool, +} + +impl TxStagesResponseOutboundDelay { + pub fn new(completed: bool) -> TxStagesResponseOutboundDelay { + TxStagesResponseOutboundDelay { + remaining_delay_blocks: None, + remaining_delay_seconds: None, + completed, + } + } +} + + diff --git a/thorchain-rs/src/models/tx_stages_response_outbound_signed.rs b/thorchain-rs/src/models/tx_stages_response_outbound_signed.rs new file mode 100644 index 0000000..76acb58 --- /dev/null +++ b/thorchain-rs/src/models/tx_stages_response_outbound_signed.rs @@ -0,0 +1,37 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct TxStagesResponseOutboundSigned { + /// THORChain height for which the external outbound is scheduled + #[serde(rename = "scheduled_outbound_height", skip_serializing_if = "Option::is_none")] + pub scheduled_outbound_height: Option, + /// THORChain blocks since the scheduled outbound height + #[serde(rename = "blocks_since_scheduled", skip_serializing_if = "Option::is_none")] + pub blocks_since_scheduled: Option, + /// returns true if an external transaction has been signed and broadcast (and observed in its mempool) + #[serde(rename = "completed")] + pub completed: bool, +} + +impl TxStagesResponseOutboundSigned { + pub fn new(completed: bool) -> TxStagesResponseOutboundSigned { + TxStagesResponseOutboundSigned { + scheduled_outbound_height: None, + blocks_since_scheduled: None, + completed, + } + } +} + + diff --git a/thorchain-rs/src/models/tx_stages_response_swap_finalised.rs b/thorchain-rs/src/models/tx_stages_response_swap_finalised.rs new file mode 100644 index 0000000..a08a79f --- /dev/null +++ b/thorchain-rs/src/models/tx_stages_response_swap_finalised.rs @@ -0,0 +1,29 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct TxStagesResponseSwapFinalised { + /// (to be deprecated in favor of swap_status) returns true if an inbound transaction's swap (successful or refunded) is no longer pending + #[serde(rename = "completed")] + pub completed: bool, +} + +impl TxStagesResponseSwapFinalised { + pub fn new(completed: bool) -> TxStagesResponseSwapFinalised { + TxStagesResponseSwapFinalised { + completed, + } + } +} + + diff --git a/thorchain-rs/src/models/tx_stages_response_swap_status.rs b/thorchain-rs/src/models/tx_stages_response_swap_status.rs new file mode 100644 index 0000000..9b0abc0 --- /dev/null +++ b/thorchain-rs/src/models/tx_stages_response_swap_status.rs @@ -0,0 +1,32 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct TxStagesResponseSwapStatus { + /// true when awaiting a swap + #[serde(rename = "pending")] + pub pending: bool, + #[serde(rename = "streaming", skip_serializing_if = "Option::is_none")] + pub streaming: Option>, +} + +impl TxStagesResponseSwapStatus { + pub fn new(pending: bool) -> TxStagesResponseSwapStatus { + TxStagesResponseSwapStatus { + pending, + streaming: None, + } + } +} + + diff --git a/thorchain-rs/src/models/tx_stages_response_swap_status_streaming.rs b/thorchain-rs/src/models/tx_stages_response_swap_status_streaming.rs new file mode 100644 index 0000000..4d0d89a --- /dev/null +++ b/thorchain-rs/src/models/tx_stages_response_swap_status_streaming.rs @@ -0,0 +1,37 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct TxStagesResponseSwapStatusStreaming { + /// how often each swap is made, in blocks + #[serde(rename = "interval")] + pub interval: i32, + /// the total number of swaps in a streaming swaps + #[serde(rename = "quantity")] + pub quantity: i32, + /// the amount of swap attempts so far + #[serde(rename = "count")] + pub count: i32, +} + +impl TxStagesResponseSwapStatusStreaming { + pub fn new(interval: i32, quantity: i32, count: i32) -> TxStagesResponseSwapStatusStreaming { + TxStagesResponseSwapStatusStreaming { + interval, + quantity, + count, + } + } +} + + diff --git a/thorchain-rs/src/models/tx_status_response.rs b/thorchain-rs/src/models/tx_status_response.rs new file mode 100644 index 0000000..d78fb6f --- /dev/null +++ b/thorchain-rs/src/models/tx_status_response.rs @@ -0,0 +1,37 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct TxStatusResponse { + #[serde(rename = "tx", skip_serializing_if = "Option::is_none")] + pub tx: Option>, + #[serde(rename = "planned_out_txs", skip_serializing_if = "Option::is_none")] + pub planned_out_txs: Option>, + #[serde(rename = "out_txs", skip_serializing_if = "Option::is_none")] + pub out_txs: Option>, + #[serde(rename = "stages")] + pub stages: Box, +} + +impl TxStatusResponse { + pub fn new(stages: crate::models::TxStagesResponse) -> TxStatusResponse { + TxStatusResponse { + tx: None, + planned_out_txs: None, + out_txs: None, + stages: Box::new(stages), + } + } +} + + diff --git a/thorchain-rs/src/models/tx_status_response_planned_out_txs_inner.rs b/thorchain-rs/src/models/tx_status_response_planned_out_txs_inner.rs new file mode 100644 index 0000000..31a89fa --- /dev/null +++ b/thorchain-rs/src/models/tx_status_response_planned_out_txs_inner.rs @@ -0,0 +1,38 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct TxStatusResponsePlannedOutTxsInner { + #[serde(rename = "chain")] + pub chain: String, + #[serde(rename = "to_address")] + pub to_address: String, + #[serde(rename = "coin")] + pub coin: Box, + /// returns true if the planned transaction has a refund memo + #[serde(rename = "refund")] + pub refund: bool, +} + +impl TxStatusResponsePlannedOutTxsInner { + pub fn new(chain: String, to_address: String, coin: crate::models::Coin, refund: bool) -> TxStatusResponsePlannedOutTxsInner { + TxStatusResponsePlannedOutTxsInner { + chain, + to_address, + coin: Box::new(coin), + refund, + } + } +} + + diff --git a/thorchain-rs/src/models/vault.rs b/thorchain-rs/src/models/vault.rs new file mode 100644 index 0000000..0f51b5a --- /dev/null +++ b/thorchain-rs/src/models/vault.rs @@ -0,0 +1,82 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct Vault { + #[serde(rename = "block_height", skip_serializing_if = "Option::is_none")] + pub block_height: Option, + #[serde(rename = "pub_key", skip_serializing_if = "Option::is_none")] + pub pub_key: Option, + #[serde(rename = "coins")] + pub coins: Vec, + #[serde(rename = "type", skip_serializing_if = "Option::is_none")] + pub r#type: Option, + #[serde(rename = "status", skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "status_since", skip_serializing_if = "Option::is_none")] + pub status_since: Option, + /// the list of node public keys which are members of the vault + #[serde(rename = "membership", skip_serializing_if = "Option::is_none")] + pub membership: Option>, + #[serde(rename = "chains", skip_serializing_if = "Option::is_none")] + pub chains: Option>, + #[serde(rename = "inbound_tx_count", skip_serializing_if = "Option::is_none")] + pub inbound_tx_count: Option, + #[serde(rename = "outbound_tx_count", skip_serializing_if = "Option::is_none")] + pub outbound_tx_count: Option, + #[serde(rename = "pending_tx_block_heights", skip_serializing_if = "Option::is_none")] + pub pending_tx_block_heights: Option>, + #[serde(rename = "routers")] + pub routers: Vec, + #[serde(rename = "addresses")] + pub addresses: Vec, + #[serde(rename = "frozen", skip_serializing_if = "Option::is_none")] + pub frozen: Option>, +} + +impl Vault { + pub fn new(coins: Vec, routers: Vec, addresses: Vec) -> Vault { + Vault { + block_height: None, + pub_key: None, + coins, + r#type: None, + status: None, + status_since: None, + membership: None, + chains: None, + inbound_tx_count: None, + outbound_tx_count: None, + pending_tx_block_heights: None, + routers, + addresses, + frozen: None, + } + } +} + +/// +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum RHashType { + #[serde(rename = "AsgardVault")] + AsgardVault, + #[serde(rename = "YggdrasilVault")] + YggdrasilVault, +} + +impl Default for RHashType { + fn default() -> RHashType { + Self::AsgardVault + } +} + diff --git a/thorchain-rs/src/models/vault_address.rs b/thorchain-rs/src/models/vault_address.rs new file mode 100644 index 0000000..62ea953 --- /dev/null +++ b/thorchain-rs/src/models/vault_address.rs @@ -0,0 +1,31 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct VaultAddress { + #[serde(rename = "chain", skip_serializing_if = "Option::is_none")] + pub chain: Option, + #[serde(rename = "address", skip_serializing_if = "Option::is_none")] + pub address: Option, +} + +impl VaultAddress { + pub fn new() -> VaultAddress { + VaultAddress { + chain: None, + address: None, + } + } +} + + diff --git a/thorchain-rs/src/models/vault_info.rs b/thorchain-rs/src/models/vault_info.rs new file mode 100644 index 0000000..fbc3179 --- /dev/null +++ b/thorchain-rs/src/models/vault_info.rs @@ -0,0 +1,31 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct VaultInfo { + #[serde(rename = "pub_key")] + pub pub_key: String, + #[serde(rename = "routers")] + pub routers: Vec, +} + +impl VaultInfo { + pub fn new(pub_key: String, routers: Vec) -> VaultInfo { + VaultInfo { + pub_key, + routers, + } + } +} + + diff --git a/thorchain-rs/src/models/vault_pubkeys_response.rs b/thorchain-rs/src/models/vault_pubkeys_response.rs new file mode 100644 index 0000000..902be72 --- /dev/null +++ b/thorchain-rs/src/models/vault_pubkeys_response.rs @@ -0,0 +1,34 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct VaultPubkeysResponse { + #[serde(rename = "asgard")] + pub asgard: Vec, + #[serde(rename = "yggdrasil")] + pub yggdrasil: Vec, + #[serde(rename = "inactive")] + pub inactive: Vec, +} + +impl VaultPubkeysResponse { + pub fn new(asgard: Vec, yggdrasil: Vec, inactive: Vec) -> VaultPubkeysResponse { + VaultPubkeysResponse { + asgard, + yggdrasil, + inactive, + } + } +} + + diff --git a/thorchain-rs/src/models/vault_router.rs b/thorchain-rs/src/models/vault_router.rs new file mode 100644 index 0000000..8b0ab23 --- /dev/null +++ b/thorchain-rs/src/models/vault_router.rs @@ -0,0 +1,31 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct VaultRouter { + #[serde(rename = "chain", skip_serializing_if = "Option::is_none")] + pub chain: Option, + #[serde(rename = "router", skip_serializing_if = "Option::is_none")] + pub router: Option, +} + +impl VaultRouter { + pub fn new() -> VaultRouter { + VaultRouter { + chain: None, + router: None, + } + } +} + + diff --git a/thorchain-rs/src/models/version_response.rs b/thorchain-rs/src/models/version_response.rs new file mode 100644 index 0000000..eb571ef --- /dev/null +++ b/thorchain-rs/src/models/version_response.rs @@ -0,0 +1,41 @@ +/* + * Thornode API + * + * Thornode REST API. + * + * The version of the OpenAPI document: 1.119.0 + * Contact: devs@thorchain.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct VersionResponse { + /// current version + #[serde(rename = "current")] + pub current: String, + /// next version (minimum version for a node to become Active) + #[serde(rename = "next")] + pub next: String, + /// height at which the minimum joining version last changed + #[serde(rename = "next_since_height", skip_serializing_if = "Option::is_none")] + pub next_since_height: Option, + /// querier version + #[serde(rename = "querier")] + pub querier: String, +} + +impl VersionResponse { + pub fn new(current: String, next: String, querier: String) -> VersionResponse { + VersionResponse { + current, + next, + next_since_height: None, + querier, + } + } +} + +