diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/Algorand-Rust-FFIs.iml b/.idea/Algorand-Rust-FFIs.iml new file mode 100644 index 0000000..2ab1474 --- /dev/null +++ b/.idea/Algorand-Rust-FFIs.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml new file mode 100644 index 0000000..d23208f --- /dev/null +++ b/.idea/jsLibraryMappings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..fffdc02 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index d792f94..52d66e4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "addr2line" @@ -28,6 +28,19 @@ dependencies = [ "cpufeatures", ] +[[package]] +name = "algo_fetch" +version = "0.0.1" +dependencies = [ + "reqwest", + "serde", + "serde_json", + "serde_repr", + "serde_with", + "url", + "uuid", +] + [[package]] name = "algo_models" version = "0.1.0" @@ -164,6 +177,12 @@ dependencies = [ "nom", ] +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + [[package]] name = "autocfg" version = "1.4.0" @@ -340,6 +359,7 @@ dependencies = [ "iana-time-zone", "js-sys", "num-traits", + "serde", "wasm-bindgen", "windows-targets 0.52.6", ] @@ -419,6 +439,16 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6" +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -474,6 +504,41 @@ dependencies = [ "typenum", ] +[[package]] +name = "darling" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim 0.11.1", + "syn", +] + +[[package]] +name = "darling_macro" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +dependencies = [ + "darling_core", + "quote", + "syn", +] + [[package]] name = "deflate64" version = "0.1.9" @@ -487,6 +552,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ "powerfmt", + "serde", ] [[package]] @@ -567,6 +633,15 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0" +[[package]] +name = "encoding_rs" +version = "0.8.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" +dependencies = [ + "cfg-if", +] + [[package]] name = "env_logger" version = "0.10.2" @@ -620,6 +695,27 @@ dependencies = [ "miniz_oxide", ] +[[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.1" @@ -648,6 +744,45 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "futures-channel" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-core", + "futures-task", + "pin-project-lite", + "pin-utils", +] + [[package]] name = "generic-array" version = "0.14.7" @@ -705,6 +840,31 @@ dependencies = [ "scroll", ] +[[package]] +name = "h2" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccae279728d634d083c00f6099cb58f01cc99c145b84b8be2f6c74618d79922e" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http", + "indexmap 2.7.0", + "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 = "hashbrown" version = "0.15.2" @@ -741,6 +901,46 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "http" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f16ca2af56261c99fba8bac40a10251ce8188205a4c448fbb745a2e4daa76fea" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" +dependencies = [ + "bytes", + "futures-util", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" + [[package]] name = "human-panic" version = "1.2.3" @@ -757,6 +957,78 @@ dependencies = [ "uuid", ] +[[package]] +name = "hyper" +version = "1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "256fb8d4bd6413123cc9d91832d78325c48ff41677595be797d90f42969beae0" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6884a48c6826ec44f524c7456b163cebe9e55a18d7b5e307cb4f100371cc767" +dependencies = [ + "futures-util", + "http", + "hyper", + "hyper-util", + "rustls", + "rustls-pki-types", + "tokio", + "tokio-rustls", + "tower-service", +] + +[[package]] +name = "hyper-tls" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" +dependencies = [ + "bytes", + "http-body-util", + "hyper", + "hyper-util", + "native-tls", + "tokio", + "tokio-native-tls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df2dcfbe0677734ab2f3ffa7fa7bfd4706bfdc1ef393f2ee30184aed67e631b4" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "hyper", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", +] + [[package]] name = "iana-time-zone" version = "0.1.61" @@ -898,6 +1170,12 @@ dependencies = [ "syn", ] +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "idna" version = "1.0.3" @@ -919,6 +1197,17 @@ dependencies = [ "icu_properties", ] +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", + "serde", +] + [[package]] name = "indexmap" version = "2.7.0" @@ -926,7 +1215,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" dependencies = [ "equivalent", - "hashbrown", + "hashbrown 0.15.2", + "serde", ] [[package]] @@ -938,6 +1228,12 @@ dependencies = [ "generic-array", ] +[[package]] +name = "ipnet" +version = "2.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" + [[package]] name = "is_executable" version = "0.1.2" @@ -1076,6 +1372,34 @@ dependencies = [ "adler2", ] +[[package]] +name = "mio" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.52.0", +] + +[[package]] +name = "native-tls" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466" +dependencies = [ + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + [[package]] name = "nom" version = "7.1.3" @@ -1116,6 +1440,50 @@ version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +[[package]] +name = "openssl" +version = "0.10.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6174bc48f102d208783c2c84bf931bb75927a617866870de8a4ea85597f871f5" +dependencies = [ + "bitflags", + "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.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + [[package]] name = "os_info" version = "3.9.0" @@ -1178,6 +1546,18 @@ version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" +[[package]] +name = "pin-project-lite" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" + +[[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.31" @@ -1273,6 +1653,50 @@ dependencies = [ "thiserror 1.0.69", ] +[[package]] +name = "reqwest" +version = "0.12.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a77c62af46e79de0a562e1a9849205ffcb7fc1238876e9bd743357570e04046f" +dependencies = [ + "base64", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-tls", + "hyper-util", + "ipnet", + "js-sys", + "log", + "mime", + "mime_guess", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls-pemfile", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "system-configuration", + "tokio", + "tokio-native-tls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "windows-registry", +] + [[package]] name = "ring" version = "0.17.8" @@ -1322,6 +1746,15 @@ dependencies = [ "serde_bytes", ] +[[package]] +name = "rust-native" +version = "0.1.0" +dependencies = [ + "algo_fetch", + "algo_models", + "tokio", +] + [[package]] name = "rustc-demangle" version = "0.1.24" @@ -1356,6 +1789,15 @@ dependencies = [ "zeroize", ] +[[package]] +name = "rustls-pemfile" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" +dependencies = [ + "rustls-pki-types", +] + [[package]] name = "rustls-pki-types" version = "1.10.1" @@ -1388,6 +1830,15 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "schannel" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d" +dependencies = [ + "windows-sys 0.59.0", +] + [[package]] name = "scopeguard" version = "1.2.0" @@ -1414,6 +1865,29 @@ dependencies = [ "syn", ] +[[package]] +name = "security-framework" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1863fd3768cd83c56a7f60faa4dc0d403f1b6df0a38c3c25f44b7894e45370d5" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "semver" version = "1.0.24" @@ -1495,6 +1969,17 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_repr" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "serde_spanned" version = "0.6.8" @@ -1504,6 +1989,48 @@ dependencies = [ "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 = "serde_with" +version = "3.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e28bdad6db2b8340e449f7108f020b3b092e8583a9e3fb82713e1d4e71fe817" +dependencies = [ + "base64", + "chrono", + "hex", + "indexmap 1.9.3", + "indexmap 2.7.0", + "serde", + "serde_derive", + "serde_json", + "serde_with_macros", + "time", +] + +[[package]] +name = "serde_with_macros" +version = "3.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d846214a9854ef724f3da161b426242d8de7c1fc7de2f89bb1efcb154dca79d" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "sha1" version = "0.10.6" @@ -1539,6 +2066,15 @@ version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + [[package]] name = "smallvec" version = "1.13.2" @@ -1551,6 +2087,16 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c" +[[package]] +name = "socket2" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c970269d99b64e60ec3bd6ad27270092a5394c4e309314b18ae3fe575695fbe8" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + [[package]] name = "socks" version = "0.3.4" @@ -1609,6 +2155,15 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + [[package]] name = "synstructure" version = "0.13.1" @@ -1620,6 +2175,27 @@ dependencies = [ "syn", ] +[[package]] +name = "system-configuration" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" +dependencies = [ + "bitflags", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "tar" version = "0.4.43" @@ -1700,10 +2276,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35e7868883861bd0e56d9ac6efcaaca0d6d5d82a2a7ec8209ff492c07cf37b21" dependencies = [ "deranged", + "itoa", "num-conv", "powerfmt", "serde", "time-core", + "time-macros", ] [[package]] @@ -1712,6 +2290,16 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" +[[package]] +name = "time-macros" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2834e6017e3e5e4b9834939793b282bc03b37a3336245fa820e35e233e2a85de" +dependencies = [ + "num-conv", + "time-core", +] + [[package]] name = "tinystr" version = "0.7.6" @@ -1722,6 +2310,66 @@ dependencies = [ "zerovec", ] +[[package]] +name = "tokio" +version = "1.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cec9b21b0450273377fc97bd4c33a8acffc8c996c987a7c5b319a0083707551" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "pin-project-lite", + "socket2", + "tokio-macros", + "windows-sys 0.52.0", +] + +[[package]] +name = "tokio-macros" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" +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-rustls" +version = "0.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f6d0975eaace0cf0fcadee4e4aaa5da15b5c079146f2cffb67c113be122bf37" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7fcaa8d55a2bdd6b83ace262b016eca0d79ee02818c5c1bcdf0305114081078" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + [[package]] name = "toml" version = "0.5.11" @@ -1770,7 +2418,7 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap", + "indexmap 2.7.0", "serde", "serde_spanned", "toml_datetime", @@ -1783,12 +2431,43 @@ version = "0.22.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ - "indexmap", + "indexmap 2.7.0", "serde", "serde_spanned", "toml_datetime", ] +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" +dependencies = [ + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + [[package]] name = "tsify-next" version = "0.5.4" @@ -2038,8 +2717,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" dependencies = [ "getrandom", + "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.5" @@ -2056,6 +2742,15 @@ dependencies = [ "winapi-util", ] +[[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" @@ -2087,6 +2782,19 @@ dependencies = [ "wasm-bindgen-shared", ] +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.49" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38176d9b44ea84e9184eff0bc34cc167ed044f816accfe5922e54d84cf48eca2" +dependencies = [ + "cfg-if", + "js-sys", + "once_cell", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "wasm-bindgen-macro" version = "0.2.99" @@ -2228,6 +2936,36 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-registry" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0" +dependencies = [ + "windows-result", + "windows-strings", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-result" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-strings" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" +dependencies = [ + "windows-result", + "windows-targets 0.52.6", +] + [[package]] name = "windows-sys" version = "0.48.0" @@ -2532,7 +3270,7 @@ dependencies = [ "displaydoc", "flate2", "hmac", - "indexmap", + "indexmap 2.7.0", "lzma-rs", "memchr", "pbkdf2", diff --git a/Cargo.toml b/Cargo.toml index 34834b6..c2a99a9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,3 @@ [workspace] resolver = "2" -members = ["crates/algo_models", "crates/uniffi-bindgen"] +members = [ "crates/algo_fetch","crates/algo_models", "crates/uniffi-bindgen", "examples/rust-native"] diff --git a/crates/algo_fetch/.gitignore b/crates/algo_fetch/.gitignore new file mode 100644 index 0000000..6aa1064 --- /dev/null +++ b/crates/algo_fetch/.gitignore @@ -0,0 +1,3 @@ +/target/ +**/*.rs.bk +Cargo.lock diff --git a/crates/algo_fetch/.openapi-generator-ignore b/crates/algo_fetch/.openapi-generator-ignore new file mode 100644 index 0000000..7484ee5 --- /dev/null +++ b/crates/algo_fetch/.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/crates/algo_fetch/.openapi-generator/FILES b/crates/algo_fetch/.openapi-generator/FILES new file mode 100644 index 0000000..7f9f0ff --- /dev/null +++ b/crates/algo_fetch/.openapi-generator/FILES @@ -0,0 +1,175 @@ +.gitignore +.travis.yml +Cargo.toml +README.md +docs/AbortCatchup200Response.md +docs/Account.md +docs/AccountApplicationInformation200Response.md +docs/AccountAssetHolding.md +docs/AccountAssetInformation200Response.md +docs/AccountAssetsInformation200Response.md +docs/AccountParticipation.md +docs/AccountStateDelta.md +docs/AddParticipationKey200Response.md +docs/AppCallLogs.md +docs/Application.md +docs/ApplicationInitialStates.md +docs/ApplicationKvStorage.md +docs/ApplicationLocalReference.md +docs/ApplicationLocalState.md +docs/ApplicationParams.md +docs/ApplicationStateOperation.md +docs/ApplicationStateSchema.md +docs/Asset.md +docs/AssetHolding.md +docs/AssetHoldingReference.md +docs/AssetParams.md +docs/AvmKeyValue.md +docs/AvmValue.md +docs/Box.md +docs/BoxDescriptor.md +docs/BoxReference.md +docs/BuildVersion.md +docs/CommonApi.md +docs/DataApi.md +docs/DebugSettingsProf.md +docs/DryrunRequest.md +docs/DryrunSource.md +docs/DryrunState.md +docs/DryrunTxnResult.md +docs/ErrorResponse.md +docs/EvalDelta.md +docs/EvalDeltaKeyValue.md +docs/ExperimentalApi.md +docs/GetApplicationBoxes200Response.md +docs/GetBlock200Response.md +docs/GetBlockHash200Response.md +docs/GetBlockLogs200Response.md +docs/GetBlockTimeStampOffset200Response.md +docs/GetBlockTxids200Response.md +docs/GetPendingTransactionsByAddress200Response.md +docs/GetStatus200Response.md +docs/GetSupply200Response.md +docs/GetSyncRound200Response.md +docs/GetTransactionGroupLedgerStateDeltasForRound200Response.md +docs/GetTransactionProof200Response.md +docs/KvDelta.md +docs/LedgerStateDeltaForTransactionGroup.md +docs/LightBlockHeaderProof.md +docs/NonparticipatingApi.md +docs/ParticipatingApi.md +docs/ParticipationKey.md +docs/PendingTransactionResponse.md +docs/PrivateApi.md +docs/PublicApi.md +docs/RawTransaction200Response.md +docs/ScratchChange.md +docs/SimulateInitialStates.md +docs/SimulateRequest.md +docs/SimulateRequestTransactionGroup.md +docs/SimulateTraceConfig.md +docs/SimulateTransaction200Response.md +docs/SimulateTransactionGroupResult.md +docs/SimulateTransactionResult.md +docs/SimulateUnnamedResourcesAccessed.md +docs/SimulationEvalOverrides.md +docs/SimulationOpcodeTraceUnit.md +docs/SimulationTransactionExecTrace.md +docs/StartCatchup200Response.md +docs/StateProof.md +docs/StateProofMessage.md +docs/TealCompile200Response.md +docs/TealDisassemble200Response.md +docs/TealDryrun200Response.md +docs/TealKeyValue.md +docs/TealValue.md +docs/TransactionParams200Response.md +docs/Version.md +git_push.sh +src/apis/common_api.rs +src/apis/configuration.rs +src/apis/data_api.rs +src/apis/experimental_api.rs +src/apis/mod.rs +src/apis/nonparticipating_api.rs +src/apis/participating_api.rs +src/apis/private_api.rs +src/apis/public_api.rs +src/lib.rs +src/models/abort_catchup_200_response.rs +src/models/account.rs +src/models/account_application_information_200_response.rs +src/models/account_asset_holding.rs +src/models/account_asset_information_200_response.rs +src/models/account_assets_information_200_response.rs +src/models/account_participation.rs +src/models/account_state_delta.rs +src/models/add_participation_key_200_response.rs +src/models/app_call_logs.rs +src/models/application.rs +src/models/application_initial_states.rs +src/models/application_kv_storage.rs +src/models/application_local_reference.rs +src/models/application_local_state.rs +src/models/application_params.rs +src/models/application_state_operation.rs +src/models/application_state_schema.rs +src/models/asset.rs +src/models/asset_holding.rs +src/models/asset_holding_reference.rs +src/models/asset_params.rs +src/models/avm_key_value.rs +src/models/avm_value.rs +src/models/box_descriptor.rs +src/models/box_reference.rs +src/models/build_version.rs +src/models/debug_settings_prof.rs +src/models/dryrun_request.rs +src/models/dryrun_source.rs +src/models/dryrun_state.rs +src/models/dryrun_txn_result.rs +src/models/error_response.rs +src/models/eval_delta.rs +src/models/eval_delta_key_value.rs +src/models/get_application_boxes_200_response.rs +src/models/get_block_200_response.rs +src/models/get_block_hash_200_response.rs +src/models/get_block_logs_200_response.rs +src/models/get_block_time_stamp_offset_200_response.rs +src/models/get_block_txids_200_response.rs +src/models/get_pending_transactions_by_address_200_response.rs +src/models/get_status_200_response.rs +src/models/get_supply_200_response.rs +src/models/get_sync_round_200_response.rs +src/models/get_transaction_group_ledger_state_deltas_for_round_200_response.rs +src/models/get_transaction_proof_200_response.rs +src/models/kv_delta.rs +src/models/ledger_state_delta_for_transaction_group.rs +src/models/light_block_header_proof.rs +src/models/mod.rs +src/models/model_box.rs +src/models/participation_key.rs +src/models/pending_transaction_response.rs +src/models/raw_transaction_200_response.rs +src/models/scratch_change.rs +src/models/simulate_initial_states.rs +src/models/simulate_request.rs +src/models/simulate_request_transaction_group.rs +src/models/simulate_trace_config.rs +src/models/simulate_transaction_200_response.rs +src/models/simulate_transaction_group_result.rs +src/models/simulate_transaction_result.rs +src/models/simulate_unnamed_resources_accessed.rs +src/models/simulation_eval_overrides.rs +src/models/simulation_opcode_trace_unit.rs +src/models/simulation_transaction_exec_trace.rs +src/models/start_catchup_200_response.rs +src/models/state_proof.rs +src/models/state_proof_message.rs +src/models/teal_compile_200_response.rs +src/models/teal_disassemble_200_response.rs +src/models/teal_dryrun_200_response.rs +src/models/teal_key_value.rs +src/models/teal_value.rs +src/models/transaction_params_200_response.rs +src/models/version.rs diff --git a/crates/algo_fetch/.openapi-generator/VERSION b/crates/algo_fetch/.openapi-generator/VERSION new file mode 100644 index 0000000..758bb9c --- /dev/null +++ b/crates/algo_fetch/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.10.0 diff --git a/crates/algo_fetch/.travis.yml b/crates/algo_fetch/.travis.yml new file mode 100644 index 0000000..22761ba --- /dev/null +++ b/crates/algo_fetch/.travis.yml @@ -0,0 +1 @@ +language: rust diff --git a/crates/algo_fetch/Cargo.toml b/crates/algo_fetch/Cargo.toml new file mode 100644 index 0000000..9a90d69 --- /dev/null +++ b/crates/algo_fetch/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "algo_fetch" +version = "0.0.1" +authors = ["contact@algorand.com"] +description = "API endpoint for algod operations." +# Override this license by providing a License Object in the OpenAPI. +license = "Unlicense" +edition = "2021" + +[dependencies] +serde = { version = "^1.0", features = ["derive"] } +serde_with = { version = "^3.8", default-features = false, features = ["base64", "std", "macros"] } +serde_json = "^1.0" +serde_repr = "^0.1" +url = "^2.5" +uuid = { version = "^1.8", features = ["serde", "v4"] } +reqwest = { version = "^0.12", features = ["json", "multipart"] } diff --git a/crates/algo_fetch/README.md b/crates/algo_fetch/README.md new file mode 100644 index 0000000..6cb4b90 --- /dev/null +++ b/crates/algo_fetch/README.md @@ -0,0 +1,228 @@ +# Rust API client for algo_fetch + +API endpoint for algod operations. + +For more information, please visit [https://www.algorand.com/get-in-touch/contact](https://www.algorand.com/get-in-touch/contact) + +## 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: 0.0.1 +- Package version: 0.0.1 +- Generator version: 7.10.0 +- Build package: `org.openapitools.codegen.languages.RustClientCodegen` + +## Installation + +Put the package under your project folder in a directory named `algo_fetch` and add the following to `Cargo.toml` under `[dependencies]`: + +``` +algo_fetch = { path = "./algo_fetch" } +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://localhost* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*CommonApi* | [**get_genesis**](docs/CommonApi.md#get_genesis) | **GET** /genesis | Gets the genesis information. +*CommonApi* | [**get_ready**](docs/CommonApi.md#get_ready) | **GET** /ready | Returns OK if healthy and fully caught up. +*CommonApi* | [**get_version**](docs/CommonApi.md#get_version) | **GET** /versions | +*CommonApi* | [**health_check**](docs/CommonApi.md#health_check) | **GET** /health | Returns OK if healthy. +*CommonApi* | [**metrics**](docs/CommonApi.md#metrics) | **GET** /metrics | Return metrics about algod functioning. +*CommonApi* | [**swagger_json**](docs/CommonApi.md#swagger_json) | **GET** /swagger.json | Gets the current swagger spec. +*DataApi* | [**get_sync_round**](docs/DataApi.md#get_sync_round) | **GET** /v2/ledger/sync | Returns the minimum sync round the ledger is keeping in cache. +*DataApi* | [**set_sync_round**](docs/DataApi.md#set_sync_round) | **POST** /v2/ledger/sync/{round} | Given a round, tells the ledger to keep that round in its cache. +*DataApi* | [**unset_sync_round**](docs/DataApi.md#unset_sync_round) | **DELETE** /v2/ledger/sync | Removes minimum sync round restriction from the ledger. +*ExperimentalApi* | [**account_assets_information**](docs/ExperimentalApi.md#account_assets_information) | **GET** /v2/accounts/{address}/assets | Get a list of assets held by an account, inclusive of asset params. +*ExperimentalApi* | [**experimental_check**](docs/ExperimentalApi.md#experimental_check) | **GET** /v2/experimental | Returns OK if experimental API is enabled. +*ExperimentalApi* | [**raw_transaction_async**](docs/ExperimentalApi.md#raw_transaction_async) | **POST** /v2/transactions/async | Fast track for broadcasting a raw transaction or transaction group to the network through the tx handler without performing most of the checks and reporting detailed errors. Should be only used for development and performance testing. +*NonparticipatingApi* | [**abort_catchup**](docs/NonparticipatingApi.md#abort_catchup) | **DELETE** /v2/catchup/{catchpoint} | Aborts a catchpoint catchup. +*NonparticipatingApi* | [**account_application_information**](docs/NonparticipatingApi.md#account_application_information) | **GET** /v2/accounts/{address}/applications/{application-id} | Get account information about a given app. +*NonparticipatingApi* | [**account_asset_information**](docs/NonparticipatingApi.md#account_asset_information) | **GET** /v2/accounts/{address}/assets/{asset-id} | Get account information about a given asset. +*NonparticipatingApi* | [**account_information**](docs/NonparticipatingApi.md#account_information) | **GET** /v2/accounts/{address} | Get account information. +*NonparticipatingApi* | [**get_application_box_by_name**](docs/NonparticipatingApi.md#get_application_box_by_name) | **GET** /v2/applications/{application-id}/box | Get box information for a given application. +*NonparticipatingApi* | [**get_application_boxes**](docs/NonparticipatingApi.md#get_application_boxes) | **GET** /v2/applications/{application-id}/boxes | Get all box names for a given application. +*NonparticipatingApi* | [**get_application_by_id**](docs/NonparticipatingApi.md#get_application_by_id) | **GET** /v2/applications/{application-id} | Get application information. +*NonparticipatingApi* | [**get_asset_by_id**](docs/NonparticipatingApi.md#get_asset_by_id) | **GET** /v2/assets/{asset-id} | Get asset information. +*NonparticipatingApi* | [**get_block**](docs/NonparticipatingApi.md#get_block) | **GET** /v2/blocks/{round} | Get the block for the given round. +*NonparticipatingApi* | [**get_block_hash**](docs/NonparticipatingApi.md#get_block_hash) | **GET** /v2/blocks/{round}/hash | Get the block hash for the block on the given round. +*NonparticipatingApi* | [**get_block_logs**](docs/NonparticipatingApi.md#get_block_logs) | **GET** /v2/blocks/{round}/logs | Get all of the logs from outer and inner app calls in the given round +*NonparticipatingApi* | [**get_block_time_stamp_offset**](docs/NonparticipatingApi.md#get_block_time_stamp_offset) | **GET** /v2/devmode/blocks/offset | Returns the timestamp offset. Timestamp offsets can only be set in dev mode. +*NonparticipatingApi* | [**get_block_txids**](docs/NonparticipatingApi.md#get_block_txids) | **GET** /v2/blocks/{round}/txids | Get the top level transaction IDs for the block on the given round. +*NonparticipatingApi* | [**get_ledger_state_delta**](docs/NonparticipatingApi.md#get_ledger_state_delta) | **GET** /v2/deltas/{round} | Get a LedgerStateDelta object for a given round +*NonparticipatingApi* | [**get_ledger_state_delta_for_transaction_group**](docs/NonparticipatingApi.md#get_ledger_state_delta_for_transaction_group) | **GET** /v2/deltas/txn/group/{id} | Get a LedgerStateDelta object for a given transaction group +*NonparticipatingApi* | [**get_light_block_header_proof**](docs/NonparticipatingApi.md#get_light_block_header_proof) | **GET** /v2/blocks/{round}/lightheader/proof | Gets a proof for a given light block header inside a state proof commitment +*NonparticipatingApi* | [**get_state_proof**](docs/NonparticipatingApi.md#get_state_proof) | **GET** /v2/stateproofs/{round} | Get a state proof that covers a given round +*NonparticipatingApi* | [**get_status**](docs/NonparticipatingApi.md#get_status) | **GET** /v2/status | Gets the current node status. +*NonparticipatingApi* | [**get_supply**](docs/NonparticipatingApi.md#get_supply) | **GET** /v2/ledger/supply | Get the current supply reported by the ledger. +*NonparticipatingApi* | [**get_transaction_group_ledger_state_deltas_for_round**](docs/NonparticipatingApi.md#get_transaction_group_ledger_state_deltas_for_round) | **GET** /v2/deltas/{round}/txn/group | Get LedgerStateDelta objects for all transaction groups in a given round +*NonparticipatingApi* | [**get_transaction_proof**](docs/NonparticipatingApi.md#get_transaction_proof) | **GET** /v2/blocks/{round}/transactions/{txid}/proof | Get a proof for a transaction in a block. +*NonparticipatingApi* | [**set_block_time_stamp_offset**](docs/NonparticipatingApi.md#set_block_time_stamp_offset) | **POST** /v2/devmode/blocks/offset/{offset} | Given a timestamp offset in seconds, adds the offset to every subsequent block header's timestamp. +*NonparticipatingApi* | [**shutdown_node**](docs/NonparticipatingApi.md#shutdown_node) | **POST** /v2/shutdown | +*NonparticipatingApi* | [**simulate_transaction**](docs/NonparticipatingApi.md#simulate_transaction) | **POST** /v2/transactions/simulate | Simulates a raw transaction or transaction group as it would be evaluated on the network. The simulation will use blockchain state from the latest committed round. +*NonparticipatingApi* | [**start_catchup**](docs/NonparticipatingApi.md#start_catchup) | **POST** /v2/catchup/{catchpoint} | Starts a catchpoint catchup. +*NonparticipatingApi* | [**teal_compile**](docs/NonparticipatingApi.md#teal_compile) | **POST** /v2/teal/compile | Compile TEAL source code to binary, produce its hash +*NonparticipatingApi* | [**teal_disassemble**](docs/NonparticipatingApi.md#teal_disassemble) | **POST** /v2/teal/disassemble | Disassemble program bytes into the TEAL source code. +*NonparticipatingApi* | [**teal_dryrun**](docs/NonparticipatingApi.md#teal_dryrun) | **POST** /v2/teal/dryrun | Provide debugging information for a transaction (or group). +*NonparticipatingApi* | [**transaction_params**](docs/NonparticipatingApi.md#transaction_params) | **GET** /v2/transactions/params | Get parameters for constructing a new transaction +*NonparticipatingApi* | [**wait_for_block**](docs/NonparticipatingApi.md#wait_for_block) | **GET** /v2/status/wait-for-block-after/{round} | Gets the node status after waiting for a round after the given round. +*ParticipatingApi* | [**add_participation_key**](docs/ParticipatingApi.md#add_participation_key) | **POST** /v2/participation | Add a participation key to the node +*ParticipatingApi* | [**append_keys**](docs/ParticipatingApi.md#append_keys) | **POST** /v2/participation/{participation-id} | Append state proof keys to a participation key +*ParticipatingApi* | [**delete_participation_key_by_id**](docs/ParticipatingApi.md#delete_participation_key_by_id) | **DELETE** /v2/participation/{participation-id} | Delete a given participation key by ID +*ParticipatingApi* | [**generate_participation_keys**](docs/ParticipatingApi.md#generate_participation_keys) | **POST** /v2/participation/generate/{address} | Generate and install participation keys to the node. +*ParticipatingApi* | [**get_participation_key_by_id**](docs/ParticipatingApi.md#get_participation_key_by_id) | **GET** /v2/participation/{participation-id} | Get participation key info given a participation ID +*ParticipatingApi* | [**get_participation_keys**](docs/ParticipatingApi.md#get_participation_keys) | **GET** /v2/participation | Return a list of participation keys +*ParticipatingApi* | [**get_pending_transactions**](docs/ParticipatingApi.md#get_pending_transactions) | **GET** /v2/transactions/pending | Get a list of unconfirmed transactions currently in the transaction pool. +*ParticipatingApi* | [**get_pending_transactions_by_address**](docs/ParticipatingApi.md#get_pending_transactions_by_address) | **GET** /v2/accounts/{address}/transactions/pending | Get a list of unconfirmed transactions currently in the transaction pool by address. +*ParticipatingApi* | [**pending_transaction_information**](docs/ParticipatingApi.md#pending_transaction_information) | **GET** /v2/transactions/pending/{txid} | Get a specific pending transaction. +*ParticipatingApi* | [**raw_transaction**](docs/ParticipatingApi.md#raw_transaction) | **POST** /v2/transactions | Broadcasts a raw transaction or transaction group to the network. +*PrivateApi* | [**abort_catchup**](docs/PrivateApi.md#abort_catchup) | **DELETE** /v2/catchup/{catchpoint} | Aborts a catchpoint catchup. +*PrivateApi* | [**add_participation_key**](docs/PrivateApi.md#add_participation_key) | **POST** /v2/participation | Add a participation key to the node +*PrivateApi* | [**append_keys**](docs/PrivateApi.md#append_keys) | **POST** /v2/participation/{participation-id} | Append state proof keys to a participation key +*PrivateApi* | [**delete_participation_key_by_id**](docs/PrivateApi.md#delete_participation_key_by_id) | **DELETE** /v2/participation/{participation-id} | Delete a given participation key by ID +*PrivateApi* | [**generate_participation_keys**](docs/PrivateApi.md#generate_participation_keys) | **POST** /v2/participation/generate/{address} | Generate and install participation keys to the node. +*PrivateApi* | [**get_config**](docs/PrivateApi.md#get_config) | **GET** /debug/settings/config | Gets the merged config file. +*PrivateApi* | [**get_debug_settings_prof**](docs/PrivateApi.md#get_debug_settings_prof) | **GET** /debug/settings/pprof | +*PrivateApi* | [**get_participation_key_by_id**](docs/PrivateApi.md#get_participation_key_by_id) | **GET** /v2/participation/{participation-id} | Get participation key info given a participation ID +*PrivateApi* | [**get_participation_keys**](docs/PrivateApi.md#get_participation_keys) | **GET** /v2/participation | Return a list of participation keys +*PrivateApi* | [**put_debug_settings_prof**](docs/PrivateApi.md#put_debug_settings_prof) | **PUT** /debug/settings/pprof | +*PrivateApi* | [**shutdown_node**](docs/PrivateApi.md#shutdown_node) | **POST** /v2/shutdown | +*PrivateApi* | [**start_catchup**](docs/PrivateApi.md#start_catchup) | **POST** /v2/catchup/{catchpoint} | Starts a catchpoint catchup. +*PublicApi* | [**account_application_information**](docs/PublicApi.md#account_application_information) | **GET** /v2/accounts/{address}/applications/{application-id} | Get account information about a given app. +*PublicApi* | [**account_asset_information**](docs/PublicApi.md#account_asset_information) | **GET** /v2/accounts/{address}/assets/{asset-id} | Get account information about a given asset. +*PublicApi* | [**account_assets_information**](docs/PublicApi.md#account_assets_information) | **GET** /v2/accounts/{address}/assets | Get a list of assets held by an account, inclusive of asset params. +*PublicApi* | [**account_information**](docs/PublicApi.md#account_information) | **GET** /v2/accounts/{address} | Get account information. +*PublicApi* | [**experimental_check**](docs/PublicApi.md#experimental_check) | **GET** /v2/experimental | Returns OK if experimental API is enabled. +*PublicApi* | [**get_application_box_by_name**](docs/PublicApi.md#get_application_box_by_name) | **GET** /v2/applications/{application-id}/box | Get box information for a given application. +*PublicApi* | [**get_application_boxes**](docs/PublicApi.md#get_application_boxes) | **GET** /v2/applications/{application-id}/boxes | Get all box names for a given application. +*PublicApi* | [**get_application_by_id**](docs/PublicApi.md#get_application_by_id) | **GET** /v2/applications/{application-id} | Get application information. +*PublicApi* | [**get_asset_by_id**](docs/PublicApi.md#get_asset_by_id) | **GET** /v2/assets/{asset-id} | Get asset information. +*PublicApi* | [**get_block**](docs/PublicApi.md#get_block) | **GET** /v2/blocks/{round} | Get the block for the given round. +*PublicApi* | [**get_block_hash**](docs/PublicApi.md#get_block_hash) | **GET** /v2/blocks/{round}/hash | Get the block hash for the block on the given round. +*PublicApi* | [**get_block_logs**](docs/PublicApi.md#get_block_logs) | **GET** /v2/blocks/{round}/logs | Get all of the logs from outer and inner app calls in the given round +*PublicApi* | [**get_block_time_stamp_offset**](docs/PublicApi.md#get_block_time_stamp_offset) | **GET** /v2/devmode/blocks/offset | Returns the timestamp offset. Timestamp offsets can only be set in dev mode. +*PublicApi* | [**get_block_txids**](docs/PublicApi.md#get_block_txids) | **GET** /v2/blocks/{round}/txids | Get the top level transaction IDs for the block on the given round. +*PublicApi* | [**get_genesis**](docs/PublicApi.md#get_genesis) | **GET** /genesis | Gets the genesis information. +*PublicApi* | [**get_ledger_state_delta**](docs/PublicApi.md#get_ledger_state_delta) | **GET** /v2/deltas/{round} | Get a LedgerStateDelta object for a given round +*PublicApi* | [**get_ledger_state_delta_for_transaction_group**](docs/PublicApi.md#get_ledger_state_delta_for_transaction_group) | **GET** /v2/deltas/txn/group/{id} | Get a LedgerStateDelta object for a given transaction group +*PublicApi* | [**get_light_block_header_proof**](docs/PublicApi.md#get_light_block_header_proof) | **GET** /v2/blocks/{round}/lightheader/proof | Gets a proof for a given light block header inside a state proof commitment +*PublicApi* | [**get_pending_transactions**](docs/PublicApi.md#get_pending_transactions) | **GET** /v2/transactions/pending | Get a list of unconfirmed transactions currently in the transaction pool. +*PublicApi* | [**get_pending_transactions_by_address**](docs/PublicApi.md#get_pending_transactions_by_address) | **GET** /v2/accounts/{address}/transactions/pending | Get a list of unconfirmed transactions currently in the transaction pool by address. +*PublicApi* | [**get_ready**](docs/PublicApi.md#get_ready) | **GET** /ready | Returns OK if healthy and fully caught up. +*PublicApi* | [**get_state_proof**](docs/PublicApi.md#get_state_proof) | **GET** /v2/stateproofs/{round} | Get a state proof that covers a given round +*PublicApi* | [**get_status**](docs/PublicApi.md#get_status) | **GET** /v2/status | Gets the current node status. +*PublicApi* | [**get_supply**](docs/PublicApi.md#get_supply) | **GET** /v2/ledger/supply | Get the current supply reported by the ledger. +*PublicApi* | [**get_sync_round**](docs/PublicApi.md#get_sync_round) | **GET** /v2/ledger/sync | Returns the minimum sync round the ledger is keeping in cache. +*PublicApi* | [**get_transaction_group_ledger_state_deltas_for_round**](docs/PublicApi.md#get_transaction_group_ledger_state_deltas_for_round) | **GET** /v2/deltas/{round}/txn/group | Get LedgerStateDelta objects for all transaction groups in a given round +*PublicApi* | [**get_transaction_proof**](docs/PublicApi.md#get_transaction_proof) | **GET** /v2/blocks/{round}/transactions/{txid}/proof | Get a proof for a transaction in a block. +*PublicApi* | [**get_version**](docs/PublicApi.md#get_version) | **GET** /versions | +*PublicApi* | [**health_check**](docs/PublicApi.md#health_check) | **GET** /health | Returns OK if healthy. +*PublicApi* | [**metrics**](docs/PublicApi.md#metrics) | **GET** /metrics | Return metrics about algod functioning. +*PublicApi* | [**pending_transaction_information**](docs/PublicApi.md#pending_transaction_information) | **GET** /v2/transactions/pending/{txid} | Get a specific pending transaction. +*PublicApi* | [**raw_transaction**](docs/PublicApi.md#raw_transaction) | **POST** /v2/transactions | Broadcasts a raw transaction or transaction group to the network. +*PublicApi* | [**raw_transaction_async**](docs/PublicApi.md#raw_transaction_async) | **POST** /v2/transactions/async | Fast track for broadcasting a raw transaction or transaction group to the network through the tx handler without performing most of the checks and reporting detailed errors. Should be only used for development and performance testing. +*PublicApi* | [**set_block_time_stamp_offset**](docs/PublicApi.md#set_block_time_stamp_offset) | **POST** /v2/devmode/blocks/offset/{offset} | Given a timestamp offset in seconds, adds the offset to every subsequent block header's timestamp. +*PublicApi* | [**set_sync_round**](docs/PublicApi.md#set_sync_round) | **POST** /v2/ledger/sync/{round} | Given a round, tells the ledger to keep that round in its cache. +*PublicApi* | [**simulate_transaction**](docs/PublicApi.md#simulate_transaction) | **POST** /v2/transactions/simulate | Simulates a raw transaction or transaction group as it would be evaluated on the network. The simulation will use blockchain state from the latest committed round. +*PublicApi* | [**swagger_json**](docs/PublicApi.md#swagger_json) | **GET** /swagger.json | Gets the current swagger spec. +*PublicApi* | [**teal_compile**](docs/PublicApi.md#teal_compile) | **POST** /v2/teal/compile | Compile TEAL source code to binary, produce its hash +*PublicApi* | [**teal_disassemble**](docs/PublicApi.md#teal_disassemble) | **POST** /v2/teal/disassemble | Disassemble program bytes into the TEAL source code. +*PublicApi* | [**teal_dryrun**](docs/PublicApi.md#teal_dryrun) | **POST** /v2/teal/dryrun | Provide debugging information for a transaction (or group). +*PublicApi* | [**transaction_params**](docs/PublicApi.md#transaction_params) | **GET** /v2/transactions/params | Get parameters for constructing a new transaction +*PublicApi* | [**unset_sync_round**](docs/PublicApi.md#unset_sync_round) | **DELETE** /v2/ledger/sync | Removes minimum sync round restriction from the ledger. +*PublicApi* | [**wait_for_block**](docs/PublicApi.md#wait_for_block) | **GET** /v2/status/wait-for-block-after/{round} | Gets the node status after waiting for a round after the given round. + + +## Documentation For Models + + - [AbortCatchup200Response](docs/AbortCatchup200Response.md) + - [Account](docs/Account.md) + - [AccountApplicationInformation200Response](docs/AccountApplicationInformation200Response.md) + - [AccountAssetHolding](docs/AccountAssetHolding.md) + - [AccountAssetInformation200Response](docs/AccountAssetInformation200Response.md) + - [AccountAssetsInformation200Response](docs/AccountAssetsInformation200Response.md) + - [AccountParticipation](docs/AccountParticipation.md) + - [AccountStateDelta](docs/AccountStateDelta.md) + - [AddParticipationKey200Response](docs/AddParticipationKey200Response.md) + - [AppCallLogs](docs/AppCallLogs.md) + - [Application](docs/Application.md) + - [ApplicationInitialStates](docs/ApplicationInitialStates.md) + - [ApplicationKvStorage](docs/ApplicationKvStorage.md) + - [ApplicationLocalReference](docs/ApplicationLocalReference.md) + - [ApplicationLocalState](docs/ApplicationLocalState.md) + - [ApplicationParams](docs/ApplicationParams.md) + - [ApplicationStateOperation](docs/ApplicationStateOperation.md) + - [ApplicationStateSchema](docs/ApplicationStateSchema.md) + - [Asset](docs/Asset.md) + - [AssetHolding](docs/AssetHolding.md) + - [AssetHoldingReference](docs/AssetHoldingReference.md) + - [AssetParams](docs/AssetParams.md) + - [AvmKeyValue](docs/AvmKeyValue.md) + - [AvmValue](docs/AvmValue.md) + - [Box](docs/Box.md) + - [BoxDescriptor](docs/BoxDescriptor.md) + - [BoxReference](docs/BoxReference.md) + - [BuildVersion](docs/BuildVersion.md) + - [DebugSettingsProf](docs/DebugSettingsProf.md) + - [DryrunRequest](docs/DryrunRequest.md) + - [DryrunSource](docs/DryrunSource.md) + - [DryrunState](docs/DryrunState.md) + - [DryrunTxnResult](docs/DryrunTxnResult.md) + - [ErrorResponse](docs/ErrorResponse.md) + - [EvalDelta](docs/EvalDelta.md) + - [EvalDeltaKeyValue](docs/EvalDeltaKeyValue.md) + - [GetApplicationBoxes200Response](docs/GetApplicationBoxes200Response.md) + - [GetBlock200Response](docs/GetBlock200Response.md) + - [GetBlockHash200Response](docs/GetBlockHash200Response.md) + - [GetBlockLogs200Response](docs/GetBlockLogs200Response.md) + - [GetBlockTimeStampOffset200Response](docs/GetBlockTimeStampOffset200Response.md) + - [GetBlockTxids200Response](docs/GetBlockTxids200Response.md) + - [GetPendingTransactionsByAddress200Response](docs/GetPendingTransactionsByAddress200Response.md) + - [GetStatus200Response](docs/GetStatus200Response.md) + - [GetSupply200Response](docs/GetSupply200Response.md) + - [GetSyncRound200Response](docs/GetSyncRound200Response.md) + - [GetTransactionGroupLedgerStateDeltasForRound200Response](docs/GetTransactionGroupLedgerStateDeltasForRound200Response.md) + - [GetTransactionProof200Response](docs/GetTransactionProof200Response.md) + - [KvDelta](docs/KvDelta.md) + - [LedgerStateDeltaForTransactionGroup](docs/LedgerStateDeltaForTransactionGroup.md) + - [LightBlockHeaderProof](docs/LightBlockHeaderProof.md) + - [ParticipationKey](docs/ParticipationKey.md) + - [PendingTransactionResponse](docs/PendingTransactionResponse.md) + - [RawTransaction200Response](docs/RawTransaction200Response.md) + - [ScratchChange](docs/ScratchChange.md) + - [SimulateInitialStates](docs/SimulateInitialStates.md) + - [SimulateRequest](docs/SimulateRequest.md) + - [SimulateRequestTransactionGroup](docs/SimulateRequestTransactionGroup.md) + - [SimulateTraceConfig](docs/SimulateTraceConfig.md) + - [SimulateTransaction200Response](docs/SimulateTransaction200Response.md) + - [SimulateTransactionGroupResult](docs/SimulateTransactionGroupResult.md) + - [SimulateTransactionResult](docs/SimulateTransactionResult.md) + - [SimulateUnnamedResourcesAccessed](docs/SimulateUnnamedResourcesAccessed.md) + - [SimulationEvalOverrides](docs/SimulationEvalOverrides.md) + - [SimulationOpcodeTraceUnit](docs/SimulationOpcodeTraceUnit.md) + - [SimulationTransactionExecTrace](docs/SimulationTransactionExecTrace.md) + - [StartCatchup200Response](docs/StartCatchup200Response.md) + - [StateProof](docs/StateProof.md) + - [StateProofMessage](docs/StateProofMessage.md) + - [TealCompile200Response](docs/TealCompile200Response.md) + - [TealDisassemble200Response](docs/TealDisassemble200Response.md) + - [TealDryrun200Response](docs/TealDryrun200Response.md) + - [TealKeyValue](docs/TealKeyValue.md) + - [TealValue](docs/TealValue.md) + - [TransactionParams200Response](docs/TransactionParams200Response.md) + - [Version](docs/Version.md) + + +To get access to the crate's generated documentation, use: + +``` +cargo doc --open +``` + +## Author + +contact@algorand.com + diff --git a/crates/algo_fetch/docs/AbortCatchup200Response.md b/crates/algo_fetch/docs/AbortCatchup200Response.md new file mode 100644 index 0000000..cbdef16 --- /dev/null +++ b/crates/algo_fetch/docs/AbortCatchup200Response.md @@ -0,0 +1,11 @@ +# AbortCatchup200Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**catchup_message** | **String** | Catchup abort response 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/crates/algo_fetch/docs/Account.md b/crates/algo_fetch/docs/Account.md new file mode 100644 index 0000000..8a4a8bc --- /dev/null +++ b/crates/algo_fetch/docs/Account.md @@ -0,0 +1,37 @@ +# Account + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**address** | **String** | the account public key | +**amount** | **i32** | \\[algo\\] total number of MicroAlgos in the account | +**amount_without_pending_rewards** | **i32** | specifies the amount of MicroAlgos in the account, without the pending rewards. | +**apps_local_state** | Option<[**Vec**](ApplicationLocalState.md)> | \\[appl\\] applications local data stored in this account. Note the raw object uses `map[int] -> AppLocalState` for this type. | [optional] +**apps_total_extra_pages** | Option<**i32**> | \\[teap\\] the sum of all extra application program pages for this account. | [optional] +**apps_total_schema** | Option<[**models::ApplicationStateSchema**](ApplicationStateSchema.md)> | | [optional] +**assets** | Option<[**Vec**](AssetHolding.md)> | \\[asset\\] assets held by this account. Note the raw object uses `map[int] -> AssetHolding` for this type. | [optional] +**auth_addr** | Option<**String**> | \\[spend\\] the address against which signing should be checked. If empty, the address of the current account is used. This field can be updated in any transaction by setting the RekeyTo field. | [optional] +**created_apps** | Option<[**Vec**](Application.md)> | \\[appp\\] parameters of applications created by this account including app global data. Note: the raw account uses `map[int] -> AppParams` for this type. | [optional] +**created_assets** | Option<[**Vec**](Asset.md)> | \\[apar\\] parameters of assets created by this account. Note: the raw account uses `map[int] -> Asset` for this type. | [optional] +**incentive_eligible** | Option<**bool**> | Whether or not the account can receive block incentives if its balance is in range at proposal time. | [optional] +**last_heartbeat** | Option<**i32**> | The round in which this account last went online, or explicitly renewed their online status. | [optional] +**last_proposed** | Option<**i32**> | The round in which this account last proposed the block. | [optional] +**min_balance** | **i32** | MicroAlgo balance required by the account. The requirement grows based on asset and application usage. | +**participation** | Option<[**models::AccountParticipation**](AccountParticipation.md)> | | [optional] +**pending_rewards** | **i32** | amount of MicroAlgos of pending rewards in this account. | +**reward_base** | Option<**i32**> | \\[ebase\\] used as part of the rewards computation. Only applicable to accounts which are participating. | [optional] +**rewards** | **i32** | \\[ern\\] total rewards of MicroAlgos the account has received, including pending rewards. | +**round** | **i32** | The round for which this information is relevant. | +**sig_type** | Option<**String**> | Indicates what type of signature is used by this account, must be one of: * sig * msig * lsig | [optional] +**status** | **String** | \\[onl\\] delegation status of the account's MicroAlgos * Offline - indicates that the associated account is delegated. * Online - indicates that the associated account used as part of the delegation pool. * NotParticipating - indicates that the associated account is neither a delegator nor a delegate. | +**total_apps_opted_in** | **i32** | The count of all applications that have been opted in, equivalent to the count of application local data (AppLocalState objects) stored in this account. | +**total_assets_opted_in** | **i32** | The count of all assets that have been opted in, equivalent to the count of AssetHolding objects held by this account. | +**total_box_bytes** | Option<**i32**> | \\[tbxb\\] The total number of bytes used by this account's app's box keys and values. | [optional] +**total_boxes** | Option<**i32**> | \\[tbx\\] The number of existing boxes created by this account's app. | [optional] +**total_created_apps** | **i32** | The count of all apps (AppParams objects) created by this account. | +**total_created_assets** | **i32** | The count of all assets (AssetParams objects) created by this account. | + +[[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/crates/algo_fetch/docs/AccountApplicationInformation200Response.md b/crates/algo_fetch/docs/AccountApplicationInformation200Response.md new file mode 100644 index 0000000..b3ebda5 --- /dev/null +++ b/crates/algo_fetch/docs/AccountApplicationInformation200Response.md @@ -0,0 +1,13 @@ +# AccountApplicationInformation200Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**app_local_state** | Option<[**models::ApplicationLocalState**](ApplicationLocalState.md)> | | [optional] +**created_app** | Option<[**models::ApplicationParams**](ApplicationParams.md)> | | [optional] +**round** | **i32** | The round for which this information is relevant. | + +[[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/crates/algo_fetch/docs/AccountAssetHolding.md b/crates/algo_fetch/docs/AccountAssetHolding.md new file mode 100644 index 0000000..5300ac5 --- /dev/null +++ b/crates/algo_fetch/docs/AccountAssetHolding.md @@ -0,0 +1,12 @@ +# AccountAssetHolding + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**asset_holding** | [**models::AssetHolding**](AssetHolding.md) | | +**asset_params** | Option<[**models::AssetParams**](AssetParams.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/crates/algo_fetch/docs/AccountAssetInformation200Response.md b/crates/algo_fetch/docs/AccountAssetInformation200Response.md new file mode 100644 index 0000000..3bf7911 --- /dev/null +++ b/crates/algo_fetch/docs/AccountAssetInformation200Response.md @@ -0,0 +1,13 @@ +# AccountAssetInformation200Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**asset_holding** | Option<[**models::AssetHolding**](AssetHolding.md)> | | [optional] +**created_asset** | Option<[**models::AssetParams**](AssetParams.md)> | | [optional] +**round** | **i32** | The round for which this information is relevant. | + +[[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/crates/algo_fetch/docs/AccountAssetsInformation200Response.md b/crates/algo_fetch/docs/AccountAssetsInformation200Response.md new file mode 100644 index 0000000..a339833 --- /dev/null +++ b/crates/algo_fetch/docs/AccountAssetsInformation200Response.md @@ -0,0 +1,13 @@ +# AccountAssetsInformation200Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**asset_holdings** | Option<[**Vec**](AccountAssetHolding.md)> | | [optional] +**next_token** | Option<**String**> | Used for pagination, when making another request provide this token with the next parameter. | [optional] +**round** | **i32** | The round for which this information is relevant. | + +[[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/crates/algo_fetch/docs/AccountParticipation.md b/crates/algo_fetch/docs/AccountParticipation.md new file mode 100644 index 0000000..46985b8 --- /dev/null +++ b/crates/algo_fetch/docs/AccountParticipation.md @@ -0,0 +1,16 @@ +# AccountParticipation + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**selection_participation_key** | **String** | \\[sel\\] Selection public key (if any) currently registered for this round. | +**state_proof_key** | Option<**String**> | \\[stprf\\] Root of the state proof key (if any) | [optional] +**vote_first_valid** | **i32** | \\[voteFst\\] First round for which this participation is valid. | +**vote_key_dilution** | **i32** | \\[voteKD\\] Number of subkeys in each batch of participation keys. | +**vote_last_valid** | **i32** | \\[voteLst\\] Last round for which this participation is valid. | +**vote_participation_key** | **String** | \\[vote\\] root participation public key (if any) currently registered for this round. | + +[[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/crates/algo_fetch/docs/AccountStateDelta.md b/crates/algo_fetch/docs/AccountStateDelta.md new file mode 100644 index 0000000..0b475f2 --- /dev/null +++ b/crates/algo_fetch/docs/AccountStateDelta.md @@ -0,0 +1,12 @@ +# AccountStateDelta + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**address** | **String** | | +**delta** | [**Vec**](EvalDeltaKeyValue.md) | Application state delta. | + +[[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/crates/algo_fetch/docs/AddParticipationKey200Response.md b/crates/algo_fetch/docs/AddParticipationKey200Response.md new file mode 100644 index 0000000..8607c35 --- /dev/null +++ b/crates/algo_fetch/docs/AddParticipationKey200Response.md @@ -0,0 +1,11 @@ +# AddParticipationKey200Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**part_id** | **String** | encoding of the participation ID. | + +[[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/crates/algo_fetch/docs/AppCallLogs.md b/crates/algo_fetch/docs/AppCallLogs.md new file mode 100644 index 0000000..84fc450 --- /dev/null +++ b/crates/algo_fetch/docs/AppCallLogs.md @@ -0,0 +1,13 @@ +# AppCallLogs + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**application_index** | **i32** | The application from which the logs were generated | +**logs** | **Vec** | An array of logs | +**tx_id** | **String** | The transaction ID of the outer app call that lead to these logs | + +[[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/crates/algo_fetch/docs/Application.md b/crates/algo_fetch/docs/Application.md new file mode 100644 index 0000000..935b9f0 --- /dev/null +++ b/crates/algo_fetch/docs/Application.md @@ -0,0 +1,12 @@ +# Application + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **i32** | \\[appidx\\] application index. | +**params** | [**models::ApplicationParams**](ApplicationParams.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/crates/algo_fetch/docs/ApplicationInitialStates.md b/crates/algo_fetch/docs/ApplicationInitialStates.md new file mode 100644 index 0000000..ffdba1b --- /dev/null +++ b/crates/algo_fetch/docs/ApplicationInitialStates.md @@ -0,0 +1,14 @@ +# ApplicationInitialStates + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**app_boxes** | Option<[**models::ApplicationKvStorage**](ApplicationKVStorage.md)> | | [optional] +**app_globals** | Option<[**models::ApplicationKvStorage**](ApplicationKVStorage.md)> | | [optional] +**app_locals** | Option<[**Vec**](ApplicationKVStorage.md)> | An application's initial local states tied to different accounts. | [optional] +**id** | **i32** | Application index. | + +[[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/crates/algo_fetch/docs/ApplicationKvStorage.md b/crates/algo_fetch/docs/ApplicationKvStorage.md new file mode 100644 index 0000000..0c7668b --- /dev/null +++ b/crates/algo_fetch/docs/ApplicationKvStorage.md @@ -0,0 +1,12 @@ +# ApplicationKvStorage + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**account** | Option<**String**> | The address of the account associated with the local state. | [optional] +**kvs** | [**Vec**](AvmKeyValue.md) | Key-Value pairs representing application states. | + +[[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/crates/algo_fetch/docs/ApplicationLocalReference.md b/crates/algo_fetch/docs/ApplicationLocalReference.md new file mode 100644 index 0000000..d8bc9ff --- /dev/null +++ b/crates/algo_fetch/docs/ApplicationLocalReference.md @@ -0,0 +1,12 @@ +# ApplicationLocalReference + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**account** | **String** | Address of the account with the local state. | +**app** | **i32** | Application ID of the local state application. | + +[[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/crates/algo_fetch/docs/ApplicationLocalState.md b/crates/algo_fetch/docs/ApplicationLocalState.md new file mode 100644 index 0000000..cebc020 --- /dev/null +++ b/crates/algo_fetch/docs/ApplicationLocalState.md @@ -0,0 +1,13 @@ +# ApplicationLocalState + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **i32** | The application which this local state is for. | +**key_value** | Option<[**Vec**](TealKeyValue.md)> | Represents a key-value store for use in an application. | [optional] +**schema** | [**models::ApplicationStateSchema**](ApplicationStateSchema.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/crates/algo_fetch/docs/ApplicationParams.md b/crates/algo_fetch/docs/ApplicationParams.md new file mode 100644 index 0000000..2297d0e --- /dev/null +++ b/crates/algo_fetch/docs/ApplicationParams.md @@ -0,0 +1,17 @@ +# ApplicationParams + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**approval_program** | **String** | \\[approv\\] approval program. | +**clear_state_program** | **String** | \\[clearp\\] approval program. | +**creator** | **String** | The address that created this application. This is the address where the parameters and global state for this application can be found. | +**extra_program_pages** | Option<**i32**> | \\[epp\\] the amount of extra program pages available to this app. | [optional] +**global_state** | Option<[**Vec**](TealKeyValue.md)> | Represents a key-value store for use in an application. | [optional] +**global_state_schema** | Option<[**models::ApplicationStateSchema**](ApplicationStateSchema.md)> | | [optional] +**local_state_schema** | Option<[**models::ApplicationStateSchema**](ApplicationStateSchema.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/crates/algo_fetch/docs/ApplicationStateOperation.md b/crates/algo_fetch/docs/ApplicationStateOperation.md new file mode 100644 index 0000000..c196ee3 --- /dev/null +++ b/crates/algo_fetch/docs/ApplicationStateOperation.md @@ -0,0 +1,15 @@ +# ApplicationStateOperation + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**account** | Option<**String**> | For local state changes, the address of the account associated with the local state. | [optional] +**app_state_type** | **String** | Type of application state. Value `g` is **global state**, `l` is **local state**, `b` is **boxes**. | +**key** | **String** | The key (name) of the global/local/box state. | +**new_value** | Option<[**models::AvmValue**](AvmValue.md)> | | [optional] +**operation** | **String** | Operation type. Value `w` is **write**, `d` is **delete**. | + +[[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/crates/algo_fetch/docs/ApplicationStateSchema.md b/crates/algo_fetch/docs/ApplicationStateSchema.md new file mode 100644 index 0000000..7d71069 --- /dev/null +++ b/crates/algo_fetch/docs/ApplicationStateSchema.md @@ -0,0 +1,12 @@ +# ApplicationStateSchema + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**num_byte_slice** | **i32** | \\[nbs\\] num of byte slices. | +**num_uint** | **i32** | \\[nui\\] num of uints. | + +[[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/crates/algo_fetch/docs/Asset.md b/crates/algo_fetch/docs/Asset.md new file mode 100644 index 0000000..df6d8cb --- /dev/null +++ b/crates/algo_fetch/docs/Asset.md @@ -0,0 +1,12 @@ +# Asset + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**index** | **i32** | unique asset identifier | +**params** | [**models::AssetParams**](AssetParams.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/crates/algo_fetch/docs/AssetHolding.md b/crates/algo_fetch/docs/AssetHolding.md new file mode 100644 index 0000000..91bf25f --- /dev/null +++ b/crates/algo_fetch/docs/AssetHolding.md @@ -0,0 +1,13 @@ +# AssetHolding + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **i32** | \\[a\\] number of units held. | +**asset_id** | **i32** | Asset ID of the holding. | +**is_frozen** | **bool** | \\[f\\] whether or not the holding is frozen. | + +[[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/crates/algo_fetch/docs/AssetHoldingReference.md b/crates/algo_fetch/docs/AssetHoldingReference.md new file mode 100644 index 0000000..8ee01e6 --- /dev/null +++ b/crates/algo_fetch/docs/AssetHoldingReference.md @@ -0,0 +1,12 @@ +# AssetHoldingReference + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**account** | **String** | Address of the account holding the asset. | +**asset** | **i32** | Asset ID of the holding. | + +[[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/crates/algo_fetch/docs/AssetParams.md b/crates/algo_fetch/docs/AssetParams.md new file mode 100644 index 0000000..e320a62 --- /dev/null +++ b/crates/algo_fetch/docs/AssetParams.md @@ -0,0 +1,25 @@ +# AssetParams + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**clawback** | Option<**String**> | \\[c\\] Address of account used to clawback holdings of this asset. If empty, clawback is not permitted. | [optional] +**creator** | **String** | The address that created this asset. This is the address where the parameters for this asset can be found, and also the address where unwanted asset units can be sent in the worst case. | +**decimals** | **i32** | \\[dc\\] The number of digits to use after the decimal point when displaying this asset. If 0, the asset is not divisible. If 1, the base unit of the asset is in tenths. If 2, the base unit of the asset is in hundredths, and so on. This value must be between 0 and 19 (inclusive). | +**default_frozen** | Option<**bool**> | \\[df\\] Whether holdings of this asset are frozen by default. | [optional] +**freeze** | Option<**String**> | \\[f\\] Address of account used to freeze holdings of this asset. If empty, freezing is not permitted. | [optional] +**manager** | Option<**String**> | \\[m\\] Address of account used to manage the keys of this asset and to destroy it. | [optional] +**metadata_hash** | Option<**String**> | \\[am\\] A commitment to some unspecified asset metadata. The format of this metadata is up to the application. | [optional] +**name** | Option<**String**> | \\[an\\] Name of this asset, as supplied by the creator. Included only when the asset name is composed of printable utf-8 characters. | [optional] +**name_b64** | Option<**String**> | Base64 encoded name of this asset, as supplied by the creator. | [optional] +**reserve** | Option<**String**> | \\[r\\] Address of account holding reserve (non-minted) units of this asset. | [optional] +**total** | **i32** | \\[t\\] The total number of units of this asset. | +**unit_name** | Option<**String**> | \\[un\\] Name of a unit of this asset, as supplied by the creator. Included only when the name of a unit of this asset is composed of printable utf-8 characters. | [optional] +**unit_name_b64** | Option<**String**> | Base64 encoded name of a unit of this asset, as supplied by the creator. | [optional] +**url** | Option<**String**> | \\[au\\] URL where more information about the asset can be retrieved. Included only when the URL is composed of printable utf-8 characters. | [optional] +**url_b64** | Option<**String**> | Base64 encoded URL where more information about the asset can be retrieved. | [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/crates/algo_fetch/docs/AvmKeyValue.md b/crates/algo_fetch/docs/AvmKeyValue.md new file mode 100644 index 0000000..e983eaf --- /dev/null +++ b/crates/algo_fetch/docs/AvmKeyValue.md @@ -0,0 +1,12 @@ +# AvmKeyValue + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**key** | **String** | | +**value** | [**models::AvmValue**](AvmValue.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/crates/algo_fetch/docs/AvmValue.md b/crates/algo_fetch/docs/AvmValue.md new file mode 100644 index 0000000..74922b8 --- /dev/null +++ b/crates/algo_fetch/docs/AvmValue.md @@ -0,0 +1,13 @@ +# AvmValue + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bytes** | Option<**String**> | bytes value. | [optional] +**r#type** | **i32** | value type. Value `1` refers to **bytes**, value `2` refers to **uint64** | +**uint** | Option<**i32**> | uint value. | [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/crates/algo_fetch/docs/Box.md b/crates/algo_fetch/docs/Box.md new file mode 100644 index 0000000..b5592f8 --- /dev/null +++ b/crates/algo_fetch/docs/Box.md @@ -0,0 +1,13 @@ +# Box + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | \\[name\\] box name, base64 encoded | +**round** | **i32** | The round for which this information is relevant | +**value** | **String** | \\[value\\] box value, base64 encoded. | + +[[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/crates/algo_fetch/docs/BoxDescriptor.md b/crates/algo_fetch/docs/BoxDescriptor.md new file mode 100644 index 0000000..268598f --- /dev/null +++ b/crates/algo_fetch/docs/BoxDescriptor.md @@ -0,0 +1,11 @@ +# BoxDescriptor + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | Base64 encoded box name | + +[[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/crates/algo_fetch/docs/BoxReference.md b/crates/algo_fetch/docs/BoxReference.md new file mode 100644 index 0000000..4d2c3f1 --- /dev/null +++ b/crates/algo_fetch/docs/BoxReference.md @@ -0,0 +1,12 @@ +# BoxReference + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**app** | **i32** | Application ID which this box belongs to | +**name** | **String** | Base64 encoded box name | + +[[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/crates/algo_fetch/docs/BuildVersion.md b/crates/algo_fetch/docs/BuildVersion.md new file mode 100644 index 0000000..53cd897 --- /dev/null +++ b/crates/algo_fetch/docs/BuildVersion.md @@ -0,0 +1,16 @@ +# BuildVersion + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | | +**build_number** | **i64** | | +**channel** | **String** | | +**commit_hash** | **String** | | +**major** | **i64** | | +**minor** | **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/crates/algo_fetch/docs/CommonApi.md b/crates/algo_fetch/docs/CommonApi.md new file mode 100644 index 0000000..56af72c --- /dev/null +++ b/crates/algo_fetch/docs/CommonApi.md @@ -0,0 +1,170 @@ +# \CommonApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_genesis**](CommonApi.md#get_genesis) | **GET** /genesis | Gets the genesis information. +[**get_ready**](CommonApi.md#get_ready) | **GET** /ready | Returns OK if healthy and fully caught up. +[**get_version**](CommonApi.md#get_version) | **GET** /versions | +[**health_check**](CommonApi.md#health_check) | **GET** /health | Returns OK if healthy. +[**metrics**](CommonApi.md#metrics) | **GET** /metrics | Return metrics about algod functioning. +[**swagger_json**](CommonApi.md#swagger_json) | **GET** /swagger.json | Gets the current swagger spec. + + + +## get_genesis + +> String get_genesis() +Gets the genesis information. + +Returns the entire genesis file in json. + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +**String** + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## get_ready + +> get_ready() +Returns OK if healthy and fully caught up. + +### Parameters + +This endpoint does not need any parameter. + +### Return type + + (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[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) + + +## get_version + +> models::Version get_version() + + +Retrieves the supported API versions, binary build versions, and genesis information. + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**models::Version**](Version.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## health_check + +> health_check() +Returns OK if healthy. + +### Parameters + +This endpoint does not need any parameter. + +### Return type + + (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[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 + +> metrics() +Return metrics about algod functioning. + +### Parameters + +This endpoint does not need any parameter. + +### Return type + + (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[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) + + +## swagger_json + +> String swagger_json() +Gets the current swagger spec. + +Returns the entire swagger spec in json. + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +**String** + +### Authorization + +[api_key](../README.md#api_key) + +### 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/crates/algo_fetch/docs/DataApi.md b/crates/algo_fetch/docs/DataApi.md new file mode 100644 index 0000000..55dfbfb --- /dev/null +++ b/crates/algo_fetch/docs/DataApi.md @@ -0,0 +1,95 @@ +# \DataApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_sync_round**](DataApi.md#get_sync_round) | **GET** /v2/ledger/sync | Returns the minimum sync round the ledger is keeping in cache. +[**set_sync_round**](DataApi.md#set_sync_round) | **POST** /v2/ledger/sync/{round} | Given a round, tells the ledger to keep that round in its cache. +[**unset_sync_round**](DataApi.md#unset_sync_round) | **DELETE** /v2/ledger/sync | Removes minimum sync round restriction from the ledger. + + + +## get_sync_round + +> models::GetSyncRound200Response get_sync_round() +Returns the minimum sync round the ledger is keeping in cache. + +Gets the minimum sync round for the ledger. + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**models::GetSyncRound200Response**](GetSyncRound_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## set_sync_round + +> set_sync_round(round) +Given a round, tells the ledger to keep that round in its cache. + +Sets the minimum sync round on the ledger. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**round** | **i32** | The round for which the deltas are desired. | [required] | + +### Return type + + (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## unset_sync_round + +> unset_sync_round() +Removes minimum sync round restriction from the ledger. + +Unset the ledger sync round. + +### Parameters + +This endpoint does not need any parameter. + +### Return type + + (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### 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/crates/algo_fetch/docs/DebugSettingsProf.md b/crates/algo_fetch/docs/DebugSettingsProf.md new file mode 100644 index 0000000..db4367b --- /dev/null +++ b/crates/algo_fetch/docs/DebugSettingsProf.md @@ -0,0 +1,12 @@ +# DebugSettingsProf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**block_rate** | Option<**i32**> | The rate of blocking events. The profiler aims to sample an average of one blocking event per rate nanoseconds spent blocked. To turn off profiling entirely, pass rate 0. | [optional] +**mutex_rate** | Option<**i32**> | The rate of mutex events. On average 1/rate events are reported. To turn off profiling entirely, pass rate 0 | [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/crates/algo_fetch/docs/DryrunRequest.md b/crates/algo_fetch/docs/DryrunRequest.md new file mode 100644 index 0000000..cf42231 --- /dev/null +++ b/crates/algo_fetch/docs/DryrunRequest.md @@ -0,0 +1,17 @@ +# DryrunRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**accounts** | [**Vec**](Account.md) | | +**apps** | [**Vec**](Application.md) | | +**latest_timestamp** | **i64** | LatestTimestamp is available to some TEAL scripts. Defaults to the latest confirmed timestamp this algod is attached to. | +**protocol_version** | **String** | ProtocolVersion specifies a specific version string to operate under, otherwise whatever the current protocol of the network this algod is running in. | +**round** | **i32** | Round is available to some TEAL scripts. Defaults to the current round on the network this algod is attached to. | +**sources** | [**Vec**](DryrunSource.md) | | +**txns** | **Vec** | | + +[[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/crates/algo_fetch/docs/DryrunSource.md b/crates/algo_fetch/docs/DryrunSource.md new file mode 100644 index 0000000..7b96af6 --- /dev/null +++ b/crates/algo_fetch/docs/DryrunSource.md @@ -0,0 +1,14 @@ +# DryrunSource + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**app_index** | **i32** | | +**field_name** | **String** | FieldName is what kind of sources this is. If lsig then it goes into the transactions[this.TxnIndex].LogicSig. If approv or clearp it goes into the Approval Program or Clear State Program of application[this.AppIndex]. | +**source** | **String** | | +**txn_index** | **i32** | | + +[[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/crates/algo_fetch/docs/DryrunState.md b/crates/algo_fetch/docs/DryrunState.md new file mode 100644 index 0000000..84f54ee --- /dev/null +++ b/crates/algo_fetch/docs/DryrunState.md @@ -0,0 +1,15 @@ +# DryrunState + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**error** | Option<**String**> | Evaluation error if any | [optional] +**line** | **i32** | Line number | +**pc** | **i32** | Program counter | +**scratch** | Option<[**Vec**](TealValue.md)> | | [optional] +**stack** | [**Vec**](TealValue.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/crates/algo_fetch/docs/DryrunTxnResult.md b/crates/algo_fetch/docs/DryrunTxnResult.md new file mode 100644 index 0000000..6ee7289 --- /dev/null +++ b/crates/algo_fetch/docs/DryrunTxnResult.md @@ -0,0 +1,21 @@ +# DryrunTxnResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**app_call_messages** | Option<**Vec**> | | [optional] +**app_call_trace** | Option<[**Vec**](DryrunState.md)> | | [optional] +**budget_added** | Option<**i32**> | Budget added during execution of app call transaction. | [optional] +**budget_consumed** | Option<**i32**> | Budget consumed during execution of app call transaction. | [optional] +**disassembly** | **Vec** | Disassembled program line by line. | +**global_delta** | Option<[**Vec**](EvalDeltaKeyValue.md)> | Application state delta. | [optional] +**local_deltas** | Option<[**Vec**](AccountStateDelta.md)> | | [optional] +**logic_sig_disassembly** | Option<**Vec**> | Disassembled lsig program line by line. | [optional] +**logic_sig_messages** | Option<**Vec**> | | [optional] +**logic_sig_trace** | Option<[**Vec**](DryrunState.md)> | | [optional] +**logs** | 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/crates/algo_fetch/docs/ErrorResponse.md b/crates/algo_fetch/docs/ErrorResponse.md new file mode 100644 index 0000000..de9614f --- /dev/null +++ b/crates/algo_fetch/docs/ErrorResponse.md @@ -0,0 +1,12 @@ +# ErrorResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**data** | Option<[**serde_json::Value**](.md)> | | [optional] +**message** | **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/crates/algo_fetch/docs/EvalDelta.md b/crates/algo_fetch/docs/EvalDelta.md new file mode 100644 index 0000000..e8eae4f --- /dev/null +++ b/crates/algo_fetch/docs/EvalDelta.md @@ -0,0 +1,13 @@ +# EvalDelta + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**action** | **i32** | \\[at\\] delta action. | +**bytes** | Option<**String**> | \\[bs\\] bytes value. | [optional] +**uint** | Option<**i32**> | \\[ui\\] uint value. | [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/crates/algo_fetch/docs/EvalDeltaKeyValue.md b/crates/algo_fetch/docs/EvalDeltaKeyValue.md new file mode 100644 index 0000000..b72d39e --- /dev/null +++ b/crates/algo_fetch/docs/EvalDeltaKeyValue.md @@ -0,0 +1,12 @@ +# EvalDeltaKeyValue + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**key** | **String** | | +**value** | [**models::EvalDelta**](EvalDelta.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/crates/algo_fetch/docs/ExperimentalApi.md b/crates/algo_fetch/docs/ExperimentalApi.md new file mode 100644 index 0000000..e92b61e --- /dev/null +++ b/crates/algo_fetch/docs/ExperimentalApi.md @@ -0,0 +1,96 @@ +# \ExperimentalApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**account_assets_information**](ExperimentalApi.md#account_assets_information) | **GET** /v2/accounts/{address}/assets | Get a list of assets held by an account, inclusive of asset params. +[**experimental_check**](ExperimentalApi.md#experimental_check) | **GET** /v2/experimental | Returns OK if experimental API is enabled. +[**raw_transaction_async**](ExperimentalApi.md#raw_transaction_async) | **POST** /v2/transactions/async | Fast track for broadcasting a raw transaction or transaction group to the network through the tx handler without performing most of the checks and reporting detailed errors. Should be only used for development and performance testing. + + + +## account_assets_information + +> models::AccountAssetsInformation200Response account_assets_information(address, limit, next) +Get a list of assets held by an account, inclusive of asset params. + +Lookup an account's asset holdings. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**address** | **String** | An account public key | [required] | +**limit** | Option<**i32**> | Maximum number of results to return. | | +**next** | Option<**String**> | The next page of results. Use the next token provided by the previous results. | | + +### Return type + +[**models::AccountAssetsInformation200Response**](AccountAssetsInformation_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## experimental_check + +> experimental_check() +Returns OK if experimental API is enabled. + +### Parameters + +This endpoint does not need any parameter. + +### Return type + + (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[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) + + +## raw_transaction_async + +> raw_transaction_async(rawtxn) +Fast track for broadcasting a raw transaction or transaction group to the network through the tx handler without performing most of the checks and reporting detailed errors. Should be only used for development and performance testing. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**rawtxn** | **std::path::PathBuf** | The byte encoded signed transaction to broadcast to network | [required] | + +### Return type + + (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/x-binary +- **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/crates/algo_fetch/docs/GetApplicationBoxes200Response.md b/crates/algo_fetch/docs/GetApplicationBoxes200Response.md new file mode 100644 index 0000000..fc98dea --- /dev/null +++ b/crates/algo_fetch/docs/GetApplicationBoxes200Response.md @@ -0,0 +1,11 @@ +# GetApplicationBoxes200Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**boxes** | [**Vec**](BoxDescriptor.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/crates/algo_fetch/docs/GetBlock200Response.md b/crates/algo_fetch/docs/GetBlock200Response.md new file mode 100644 index 0000000..8a73eb3 --- /dev/null +++ b/crates/algo_fetch/docs/GetBlock200Response.md @@ -0,0 +1,12 @@ +# GetBlock200Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**block** | [**serde_json::Value**](.md) | Block header data. | +**cert** | Option<[**serde_json::Value**](.md)> | Optional certificate object. This is only included when the format is set to message pack. | [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/crates/algo_fetch/docs/GetBlockHash200Response.md b/crates/algo_fetch/docs/GetBlockHash200Response.md new file mode 100644 index 0000000..11d7ffa --- /dev/null +++ b/crates/algo_fetch/docs/GetBlockHash200Response.md @@ -0,0 +1,11 @@ +# GetBlockHash200Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**block_hash** | **String** | Block header hash. | + +[[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/crates/algo_fetch/docs/GetBlockLogs200Response.md b/crates/algo_fetch/docs/GetBlockLogs200Response.md new file mode 100644 index 0000000..8f7dbd9 --- /dev/null +++ b/crates/algo_fetch/docs/GetBlockLogs200Response.md @@ -0,0 +1,11 @@ +# GetBlockLogs200Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**logs** | [**Vec**](AppCallLogs.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/crates/algo_fetch/docs/GetBlockTimeStampOffset200Response.md b/crates/algo_fetch/docs/GetBlockTimeStampOffset200Response.md new file mode 100644 index 0000000..89e9dd2 --- /dev/null +++ b/crates/algo_fetch/docs/GetBlockTimeStampOffset200Response.md @@ -0,0 +1,11 @@ +# GetBlockTimeStampOffset200Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**offset** | **i32** | Timestamp offset in seconds. | + +[[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/crates/algo_fetch/docs/GetBlockTxids200Response.md b/crates/algo_fetch/docs/GetBlockTxids200Response.md new file mode 100644 index 0000000..a6e12c2 --- /dev/null +++ b/crates/algo_fetch/docs/GetBlockTxids200Response.md @@ -0,0 +1,11 @@ +# GetBlockTxids200Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**block_txids** | **Vec** | Block transaction IDs. | + +[[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/crates/algo_fetch/docs/GetPendingTransactionsByAddress200Response.md b/crates/algo_fetch/docs/GetPendingTransactionsByAddress200Response.md new file mode 100644 index 0000000..33a7458 --- /dev/null +++ b/crates/algo_fetch/docs/GetPendingTransactionsByAddress200Response.md @@ -0,0 +1,12 @@ +# GetPendingTransactionsByAddress200Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**top_transactions** | [**Vec**](serde_json::Value.md) | An array of signed transaction objects. | +**total_transactions** | **i32** | Total number of transactions in the pool. | + +[[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/crates/algo_fetch/docs/GetStatus200Response.md b/crates/algo_fetch/docs/GetStatus200Response.md new file mode 100644 index 0000000..178bae9 --- /dev/null +++ b/crates/algo_fetch/docs/GetStatus200Response.md @@ -0,0 +1,36 @@ +# GetStatus200Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**catchpoint** | Option<**String**> | The current catchpoint that is being caught up to | [optional] +**catchpoint_acquired_blocks** | Option<**i32**> | The number of blocks that have already been obtained by the node as part of the catchup | [optional] +**catchpoint_processed_accounts** | Option<**i32**> | The number of accounts from the current catchpoint that have been processed so far as part of the catchup | [optional] +**catchpoint_processed_kvs** | Option<**i32**> | The number of key-values (KVs) from the current catchpoint that have been processed so far as part of the catchup | [optional] +**catchpoint_total_accounts** | Option<**i32**> | The total number of accounts included in the current catchpoint | [optional] +**catchpoint_total_blocks** | Option<**i32**> | The total number of blocks that are required to complete the current catchpoint catchup | [optional] +**catchpoint_total_kvs** | Option<**i32**> | The total number of key-values (KVs) included in the current catchpoint | [optional] +**catchpoint_verified_accounts** | Option<**i32**> | The number of accounts from the current catchpoint that have been verified so far as part of the catchup | [optional] +**catchpoint_verified_kvs** | Option<**i32**> | The number of key-values (KVs) from the current catchpoint that have been verified so far as part of the catchup | [optional] +**catchup_time** | **i32** | CatchupTime in nanoseconds | +**last_catchpoint** | Option<**String**> | The last catchpoint seen by the node | [optional] +**last_round** | **i32** | LastRound indicates the last round seen | +**last_version** | **String** | LastVersion indicates the last consensus version supported | +**next_version** | **String** | NextVersion of consensus protocol to use | +**next_version_round** | **i32** | NextVersionRound is the round at which the next consensus version will apply | +**next_version_supported** | **bool** | NextVersionSupported indicates whether the next consensus version is supported by this node | +**stopped_at_unsupported_round** | **bool** | StoppedAtUnsupportedRound indicates that the node does not support the new rounds and has stopped making progress | +**time_since_last_round** | **i32** | TimeSinceLastRound in nanoseconds | +**upgrade_delay** | Option<**i32**> | Upgrade delay | [optional] +**upgrade_next_protocol_vote_before** | Option<**i32**> | Next protocol round | [optional] +**upgrade_no_votes** | Option<**i32**> | No votes cast for consensus upgrade | [optional] +**upgrade_node_vote** | Option<**bool**> | This node's upgrade vote | [optional] +**upgrade_vote_rounds** | Option<**i32**> | Total voting rounds for current upgrade | [optional] +**upgrade_votes** | Option<**i32**> | Total votes cast for consensus upgrade | [optional] +**upgrade_votes_required** | Option<**i32**> | Yes votes required for consensus upgrade | [optional] +**upgrade_yes_votes** | Option<**i32**> | Yes votes cast for consensus upgrade | [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/crates/algo_fetch/docs/GetSupply200Response.md b/crates/algo_fetch/docs/GetSupply200Response.md new file mode 100644 index 0000000..f358106 --- /dev/null +++ b/crates/algo_fetch/docs/GetSupply200Response.md @@ -0,0 +1,13 @@ +# GetSupply200Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**current_round** | **i32** | Round | +**online_money** | **i32** | OnlineMoney | +**total_money** | **i32** | TotalMoney | + +[[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/crates/algo_fetch/docs/GetSyncRound200Response.md b/crates/algo_fetch/docs/GetSyncRound200Response.md new file mode 100644 index 0000000..37a4a8b --- /dev/null +++ b/crates/algo_fetch/docs/GetSyncRound200Response.md @@ -0,0 +1,11 @@ +# GetSyncRound200Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**round** | **i32** | The minimum sync round for the ledger. | + +[[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/crates/algo_fetch/docs/GetTransactionGroupLedgerStateDeltasForRound200Response.md b/crates/algo_fetch/docs/GetTransactionGroupLedgerStateDeltasForRound200Response.md new file mode 100644 index 0000000..6356e6e --- /dev/null +++ b/crates/algo_fetch/docs/GetTransactionGroupLedgerStateDeltasForRound200Response.md @@ -0,0 +1,11 @@ +# GetTransactionGroupLedgerStateDeltasForRound200Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**deltas** | [**Vec**](LedgerStateDeltaForTransactionGroup.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/crates/algo_fetch/docs/GetTransactionProof200Response.md b/crates/algo_fetch/docs/GetTransactionProof200Response.md new file mode 100644 index 0000000..ca373da --- /dev/null +++ b/crates/algo_fetch/docs/GetTransactionProof200Response.md @@ -0,0 +1,15 @@ +# GetTransactionProof200Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**hashtype** | **String** | The type of hash function used to create the proof, must be one of: * sha512_256 * sha256 | +**idx** | **i32** | Index of the transaction in the block's payset. | +**proof** | **String** | Proof of transaction membership. | +**stibhash** | **String** | Hash of SignedTxnInBlock for verifying proof. | +**treedepth** | **i32** | Represents the depth of the tree that is being proven, i.e. the number of edges from a leaf to the root. | + +[[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/crates/algo_fetch/docs/KvDelta.md b/crates/algo_fetch/docs/KvDelta.md new file mode 100644 index 0000000..60638a7 --- /dev/null +++ b/crates/algo_fetch/docs/KvDelta.md @@ -0,0 +1,12 @@ +# KvDelta + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**key** | Option<**String**> | The key, base64 encoded. | [optional] +**value** | Option<**String**> | The new value of the KV store entry, base64 encoded. | [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/crates/algo_fetch/docs/LedgerStateDeltaForTransactionGroup.md b/crates/algo_fetch/docs/LedgerStateDeltaForTransactionGroup.md new file mode 100644 index 0000000..0641b59 --- /dev/null +++ b/crates/algo_fetch/docs/LedgerStateDeltaForTransactionGroup.md @@ -0,0 +1,12 @@ +# LedgerStateDeltaForTransactionGroup + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**delta** | [**serde_json::Value**](.md) | Ledger StateDelta object | +**ids** | **Vec** | | + +[[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/crates/algo_fetch/docs/LightBlockHeaderProof.md b/crates/algo_fetch/docs/LightBlockHeaderProof.md new file mode 100644 index 0000000..c62fc24 --- /dev/null +++ b/crates/algo_fetch/docs/LightBlockHeaderProof.md @@ -0,0 +1,13 @@ +# LightBlockHeaderProof + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**index** | **i32** | The index of the light block header in the vector commitment tree | +**proof** | **String** | The encoded proof. | +**treedepth** | **i32** | Represents the depth of the tree that is being proven, i.e. the number of edges from a leaf to the root. | + +[[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/crates/algo_fetch/docs/NonparticipatingApi.md b/crates/algo_fetch/docs/NonparticipatingApi.md new file mode 100644 index 0000000..e2f26dd --- /dev/null +++ b/crates/algo_fetch/docs/NonparticipatingApi.md @@ -0,0 +1,924 @@ +# \NonparticipatingApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**abort_catchup**](NonparticipatingApi.md#abort_catchup) | **DELETE** /v2/catchup/{catchpoint} | Aborts a catchpoint catchup. +[**account_application_information**](NonparticipatingApi.md#account_application_information) | **GET** /v2/accounts/{address}/applications/{application-id} | Get account information about a given app. +[**account_asset_information**](NonparticipatingApi.md#account_asset_information) | **GET** /v2/accounts/{address}/assets/{asset-id} | Get account information about a given asset. +[**account_information**](NonparticipatingApi.md#account_information) | **GET** /v2/accounts/{address} | Get account information. +[**get_application_box_by_name**](NonparticipatingApi.md#get_application_box_by_name) | **GET** /v2/applications/{application-id}/box | Get box information for a given application. +[**get_application_boxes**](NonparticipatingApi.md#get_application_boxes) | **GET** /v2/applications/{application-id}/boxes | Get all box names for a given application. +[**get_application_by_id**](NonparticipatingApi.md#get_application_by_id) | **GET** /v2/applications/{application-id} | Get application information. +[**get_asset_by_id**](NonparticipatingApi.md#get_asset_by_id) | **GET** /v2/assets/{asset-id} | Get asset information. +[**get_block**](NonparticipatingApi.md#get_block) | **GET** /v2/blocks/{round} | Get the block for the given round. +[**get_block_hash**](NonparticipatingApi.md#get_block_hash) | **GET** /v2/blocks/{round}/hash | Get the block hash for the block on the given round. +[**get_block_logs**](NonparticipatingApi.md#get_block_logs) | **GET** /v2/blocks/{round}/logs | Get all of the logs from outer and inner app calls in the given round +[**get_block_time_stamp_offset**](NonparticipatingApi.md#get_block_time_stamp_offset) | **GET** /v2/devmode/blocks/offset | Returns the timestamp offset. Timestamp offsets can only be set in dev mode. +[**get_block_txids**](NonparticipatingApi.md#get_block_txids) | **GET** /v2/blocks/{round}/txids | Get the top level transaction IDs for the block on the given round. +[**get_ledger_state_delta**](NonparticipatingApi.md#get_ledger_state_delta) | **GET** /v2/deltas/{round} | Get a LedgerStateDelta object for a given round +[**get_ledger_state_delta_for_transaction_group**](NonparticipatingApi.md#get_ledger_state_delta_for_transaction_group) | **GET** /v2/deltas/txn/group/{id} | Get a LedgerStateDelta object for a given transaction group +[**get_light_block_header_proof**](NonparticipatingApi.md#get_light_block_header_proof) | **GET** /v2/blocks/{round}/lightheader/proof | Gets a proof for a given light block header inside a state proof commitment +[**get_state_proof**](NonparticipatingApi.md#get_state_proof) | **GET** /v2/stateproofs/{round} | Get a state proof that covers a given round +[**get_status**](NonparticipatingApi.md#get_status) | **GET** /v2/status | Gets the current node status. +[**get_supply**](NonparticipatingApi.md#get_supply) | **GET** /v2/ledger/supply | Get the current supply reported by the ledger. +[**get_transaction_group_ledger_state_deltas_for_round**](NonparticipatingApi.md#get_transaction_group_ledger_state_deltas_for_round) | **GET** /v2/deltas/{round}/txn/group | Get LedgerStateDelta objects for all transaction groups in a given round +[**get_transaction_proof**](NonparticipatingApi.md#get_transaction_proof) | **GET** /v2/blocks/{round}/transactions/{txid}/proof | Get a proof for a transaction in a block. +[**set_block_time_stamp_offset**](NonparticipatingApi.md#set_block_time_stamp_offset) | **POST** /v2/devmode/blocks/offset/{offset} | Given a timestamp offset in seconds, adds the offset to every subsequent block header's timestamp. +[**shutdown_node**](NonparticipatingApi.md#shutdown_node) | **POST** /v2/shutdown | +[**simulate_transaction**](NonparticipatingApi.md#simulate_transaction) | **POST** /v2/transactions/simulate | Simulates a raw transaction or transaction group as it would be evaluated on the network. The simulation will use blockchain state from the latest committed round. +[**start_catchup**](NonparticipatingApi.md#start_catchup) | **POST** /v2/catchup/{catchpoint} | Starts a catchpoint catchup. +[**teal_compile**](NonparticipatingApi.md#teal_compile) | **POST** /v2/teal/compile | Compile TEAL source code to binary, produce its hash +[**teal_disassemble**](NonparticipatingApi.md#teal_disassemble) | **POST** /v2/teal/disassemble | Disassemble program bytes into the TEAL source code. +[**teal_dryrun**](NonparticipatingApi.md#teal_dryrun) | **POST** /v2/teal/dryrun | Provide debugging information for a transaction (or group). +[**transaction_params**](NonparticipatingApi.md#transaction_params) | **GET** /v2/transactions/params | Get parameters for constructing a new transaction +[**wait_for_block**](NonparticipatingApi.md#wait_for_block) | **GET** /v2/status/wait-for-block-after/{round} | Gets the node status after waiting for a round after the given round. + + + +## abort_catchup + +> models::AbortCatchup200Response abort_catchup(catchpoint) +Aborts a catchpoint catchup. + +Given a catchpoint, it aborts catching up to this catchpoint + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**catchpoint** | **String** | A catch point | [required] | + +### Return type + +[**models::AbortCatchup200Response**](AbortCatchup_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## account_application_information + +> models::AccountApplicationInformation200Response account_application_information(address, application_id, format) +Get account information about a given app. + +Given a specific account public key and application ID, this call returns the account's application local state and global state (AppLocalState and AppParams, if either exists). Global state will only be returned if the provided address is the application's creator. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**address** | **String** | An account public key | [required] | +**application_id** | **i32** | An application identifier | [required] | +**format** | Option<**String**> | Configures whether the response object is JSON or MessagePack encoded. If not provided, defaults to JSON. | | + +### Return type + +[**models::AccountApplicationInformation200Response**](AccountApplicationInformation_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json, application/msgpack + +[[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) + + +## account_asset_information + +> models::AccountAssetInformation200Response account_asset_information(address, asset_id, format) +Get account information about a given asset. + +Given a specific account public key and asset ID, this call returns the account's asset holding and asset parameters (if either exist). Asset parameters will only be returned if the provided address is the asset's creator. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**address** | **String** | An account public key | [required] | +**asset_id** | **i32** | An asset identifier | [required] | +**format** | Option<**String**> | Configures whether the response object is JSON or MessagePack encoded. If not provided, defaults to JSON. | | + +### Return type + +[**models::AccountAssetInformation200Response**](AccountAssetInformation_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json, application/msgpack + +[[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) + + +## account_information + +> models::Account account_information(address, format, exclude) +Get account information. + +Given a specific account public key, this call returns the accounts status, balance and spendable amounts + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**address** | **String** | An account public key | [required] | +**format** | Option<**String**> | Configures whether the response object is JSON or MessagePack encoded. If not provided, defaults to JSON. | | +**exclude** | Option<**String**> | When set to `all` will exclude asset holdings, application local state, created asset parameters, any created application parameters. Defaults to `none`. | | + +### Return type + +[**models::Account**](Account.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json, application/msgpack + +[[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) + + +## get_application_box_by_name + +> models::Box get_application_box_by_name(application_id, name) +Get box information for a given application. + +Given an application ID and box name, it returns the round, box name, and value (each base64 encoded). Box names must be in the goal app call arg encoding form 'encoding:value'. For ints, use the form 'int:1234'. For raw bytes, use the form 'b64:A=='. For printable strings, use the form 'str:hello'. For addresses, use the form 'addr:XYZ...'. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**application_id** | **i32** | An application identifier | [required] | +**name** | **String** | A box name, in the goal app call arg form 'encoding:value'. For ints, use the form 'int:1234'. For raw bytes, use the form 'b64:A=='. For printable strings, use the form 'str:hello'. For addresses, use the form 'addr:XYZ...'. | [required] | + +### Return type + +[**models::Box**](Box.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## get_application_boxes + +> models::GetApplicationBoxes200Response get_application_boxes(application_id, max) +Get all box names for a given application. + +Given an application ID, return all Box names. No particular ordering is guaranteed. Request fails when client or server-side configured limits prevent returning all Box names. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**application_id** | **i32** | An application identifier | [required] | +**max** | Option<**i32**> | Max number of box names to return. If max is not set, or max == 0, returns all box-names. | | + +### Return type + +[**models::GetApplicationBoxes200Response**](GetApplicationBoxes_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## get_application_by_id + +> models::Application get_application_by_id(application_id) +Get application information. + +Given a application ID, it returns application information including creator, approval and clear programs, global and local schemas, and global state. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**application_id** | **i32** | An application identifier | [required] | + +### Return type + +[**models::Application**](Application.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## get_asset_by_id + +> models::Asset get_asset_by_id(asset_id) +Get asset information. + +Given a asset ID, it returns asset information including creator, name, total supply and special addresses. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**asset_id** | **i32** | An asset identifier | [required] | + +### Return type + +[**models::Asset**](Asset.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## get_block + +> models::GetBlock200Response get_block(round, format) +Get the block for the given round. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**round** | **i32** | The round from which to fetch block information. | [required] | +**format** | Option<**String**> | Configures whether the response object is JSON or MessagePack encoded. If not provided, defaults to JSON. | | + +### Return type + +[**models::GetBlock200Response**](GetBlock_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json, application/msgpack + +[[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) + + +## get_block_hash + +> models::GetBlockHash200Response get_block_hash(round) +Get the block hash for the block on the given round. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**round** | **i32** | The round from which to fetch block hash information. | [required] | + +### Return type + +[**models::GetBlockHash200Response**](GetBlockHash_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## get_block_logs + +> models::GetBlockLogs200Response get_block_logs(round) +Get all of the logs from outer and inner app calls in the given round + +Get all of the logs from outer and inner app calls in the given round + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**round** | **i32** | The round from which to fetch block log information. | [required] | + +### Return type + +[**models::GetBlockLogs200Response**](GetBlockLogs_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## get_block_time_stamp_offset + +> models::GetBlockTimeStampOffset200Response get_block_time_stamp_offset() +Returns the timestamp offset. Timestamp offsets can only be set in dev mode. + +Gets the current timestamp offset. + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**models::GetBlockTimeStampOffset200Response**](GetBlockTimeStampOffset_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## get_block_txids + +> models::GetBlockTxids200Response get_block_txids(round) +Get the top level transaction IDs for the block on the given round. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**round** | **i32** | The round from which to fetch block transaction IDs. | [required] | + +### Return type + +[**models::GetBlockTxids200Response**](GetBlockTxids_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## get_ledger_state_delta + +> serde_json::Value get_ledger_state_delta(round, format) +Get a LedgerStateDelta object for a given round + +Get ledger deltas for a round. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**round** | **i32** | The round for which the deltas are desired. | [required] | +**format** | Option<**String**> | Configures whether the response object is JSON or MessagePack encoded. If not provided, defaults to JSON. | | + +### Return type + +[**serde_json::Value**](serde_json::Value.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json, application/msgpack + +[[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) + + +## get_ledger_state_delta_for_transaction_group + +> serde_json::Value get_ledger_state_delta_for_transaction_group(id, format) +Get a LedgerStateDelta object for a given transaction group + +Get a ledger delta for a given transaction group. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**id** | **String** | A transaction ID, or transaction group ID | [required] | +**format** | Option<**String**> | Configures whether the response object is JSON or MessagePack encoded. If not provided, defaults to JSON. | | + +### Return type + +[**serde_json::Value**](serde_json::Value.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json, application/msgpack + +[[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) + + +## get_light_block_header_proof + +> models::LightBlockHeaderProof get_light_block_header_proof(round) +Gets a proof for a given light block header inside a state proof commitment + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**round** | **i32** | The round to which the light block header belongs. | [required] | + +### Return type + +[**models::LightBlockHeaderProof**](LightBlockHeaderProof.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## get_state_proof + +> models::StateProof get_state_proof(round) +Get a state proof that covers a given round + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**round** | **i32** | The round for which a state proof is desired. | [required] | + +### Return type + +[**models::StateProof**](StateProof.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## get_status + +> models::GetStatus200Response get_status() +Gets the current node status. + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**models::GetStatus200Response**](GetStatus_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## get_supply + +> models::GetSupply200Response get_supply() +Get the current supply reported by the ledger. + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**models::GetSupply200Response**](GetSupply_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## get_transaction_group_ledger_state_deltas_for_round + +> models::GetTransactionGroupLedgerStateDeltasForRound200Response get_transaction_group_ledger_state_deltas_for_round(round, format) +Get LedgerStateDelta objects for all transaction groups in a given round + +Get ledger deltas for transaction groups in a given round. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**round** | **i32** | The round for which the deltas are desired. | [required] | +**format** | Option<**String**> | Configures whether the response object is JSON or MessagePack encoded. If not provided, defaults to JSON. | | + +### Return type + +[**models::GetTransactionGroupLedgerStateDeltasForRound200Response**](GetTransactionGroupLedgerStateDeltasForRound_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json, application/msgpack + +[[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) + + +## get_transaction_proof + +> models::GetTransactionProof200Response get_transaction_proof(round, txid, hashtype, format) +Get a proof for a transaction in a block. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**round** | **i32** | The round in which the transaction appears. | [required] | +**txid** | **String** | The transaction ID for which to generate a proof. | [required] | +**hashtype** | Option<**String**> | The type of hash function used to create the proof, must be one of: * sha512_256 * sha256 | | +**format** | Option<**String**> | Configures whether the response object is JSON or MessagePack encoded. If not provided, defaults to JSON. | | + +### Return type + +[**models::GetTransactionProof200Response**](GetTransactionProof_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## set_block_time_stamp_offset + +> set_block_time_stamp_offset(offset) +Given a timestamp offset in seconds, adds the offset to every subsequent block header's timestamp. + +Sets the timestamp offset (seconds) for blocks in dev mode. Providing an offset of 0 will unset this value and try to use the real clock for the timestamp. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**offset** | **i32** | The timestamp offset for blocks in dev mode. | [required] | + +### Return type + + (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## shutdown_node + +> serde_json::Value shutdown_node(timeout) + + +Special management endpoint to shutdown the node. Optionally provide a timeout parameter to indicate that the node should begin shutting down after a number of seconds. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**timeout** | Option<**i32**> | | |[default to 0] + +### Return type + +[**serde_json::Value**](serde_json::Value.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## simulate_transaction + +> models::SimulateTransaction200Response simulate_transaction(request, format) +Simulates a raw transaction or transaction group as it would be evaluated on the network. The simulation will use blockchain state from the latest committed round. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**request** | [**SimulateRequest**](SimulateRequest.md) | The transactions to simulate, along with any other inputs. | [required] | +**format** | Option<**String**> | Configures whether the response object is JSON or MessagePack encoded. If not provided, defaults to JSON. | | + +### Return type + +[**models::SimulateTransaction200Response**](SimulateTransaction_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/json, application/msgpack +- **Accept**: application/json, application/msgpack + +[[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) + + +## start_catchup + +> models::StartCatchup200Response start_catchup(catchpoint, min) +Starts a catchpoint catchup. + +Given a catchpoint, it starts catching up to this catchpoint + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**catchpoint** | **String** | A catch point | [required] | +**min** | Option<**i32**> | Specify the minimum number of blocks which the ledger must be advanced by in order to start the catchup. This is useful for simplifying tools which support fast catchup, they can run the catchup unconditionally and the node will skip the catchup if it is not needed. | | + +### Return type + +[**models::StartCatchup200Response**](StartCatchup_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## teal_compile + +> models::TealCompile200Response teal_compile(source, sourcemap) +Compile TEAL source code to binary, produce its hash + +Given TEAL source code in plain text, return base64 encoded program bytes and base32 SHA512_256 hash of program bytes (Address style). This endpoint is only enabled when a node's configuration file sets EnableDeveloperAPI to true. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**source** | **std::path::PathBuf** | TEAL source code to be compiled | [required] | +**sourcemap** | Option<**bool**> | When set to `true`, returns the source map of the program as a JSON. Defaults to `false`. | | + +### Return type + +[**models::TealCompile200Response**](TealCompile_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: text/plain +- **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) + + +## teal_disassemble + +> models::TealDisassemble200Response teal_disassemble(source) +Disassemble program bytes into the TEAL source code. + +Given the program bytes, return the TEAL source code in plain text. This endpoint is only enabled when a node's configuration file sets EnableDeveloperAPI to true. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**source** | **String** | TEAL program binary to be disassembled | [required] | + +### Return type + +[**models::TealDisassemble200Response**](TealDisassemble_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/x-binary +- **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) + + +## teal_dryrun + +> models::TealDryrun200Response teal_dryrun(request) +Provide debugging information for a transaction (or group). + +Executes TEAL program(s) in context and returns debugging information about the execution. This endpoint is only enabled when a node's configuration file sets EnableDeveloperAPI to true. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**request** | Option<[**DryrunRequest**](DryrunRequest.md)> | Transaction (or group) and any accompanying state-simulation data. | | + +### Return type + +[**models::TealDryrun200Response**](TealDryrun_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/json, application/msgpack +- **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) + + +## transaction_params + +> models::TransactionParams200Response transaction_params() +Get parameters for constructing a new transaction + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**models::TransactionParams200Response**](TransactionParams_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## wait_for_block + +> models::GetStatus200Response wait_for_block(round) +Gets the node status after waiting for a round after the given round. + +Waits for a block to appear after round {round} and returns the node's status at the time. There is a 1 minute timeout, when reached the current status is returned regardless of whether or not it is the round after the given round. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**round** | **i32** | The round to wait until returning status | [required] | + +### Return type + +[**models::GetStatus200Response**](GetStatus_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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/crates/algo_fetch/docs/ParticipatingApi.md b/crates/algo_fetch/docs/ParticipatingApi.md new file mode 100644 index 0000000..ed1133b --- /dev/null +++ b/crates/algo_fetch/docs/ParticipatingApi.md @@ -0,0 +1,317 @@ +# \ParticipatingApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**add_participation_key**](ParticipatingApi.md#add_participation_key) | **POST** /v2/participation | Add a participation key to the node +[**append_keys**](ParticipatingApi.md#append_keys) | **POST** /v2/participation/{participation-id} | Append state proof keys to a participation key +[**delete_participation_key_by_id**](ParticipatingApi.md#delete_participation_key_by_id) | **DELETE** /v2/participation/{participation-id} | Delete a given participation key by ID +[**generate_participation_keys**](ParticipatingApi.md#generate_participation_keys) | **POST** /v2/participation/generate/{address} | Generate and install participation keys to the node. +[**get_participation_key_by_id**](ParticipatingApi.md#get_participation_key_by_id) | **GET** /v2/participation/{participation-id} | Get participation key info given a participation ID +[**get_participation_keys**](ParticipatingApi.md#get_participation_keys) | **GET** /v2/participation | Return a list of participation keys +[**get_pending_transactions**](ParticipatingApi.md#get_pending_transactions) | **GET** /v2/transactions/pending | Get a list of unconfirmed transactions currently in the transaction pool. +[**get_pending_transactions_by_address**](ParticipatingApi.md#get_pending_transactions_by_address) | **GET** /v2/accounts/{address}/transactions/pending | Get a list of unconfirmed transactions currently in the transaction pool by address. +[**pending_transaction_information**](ParticipatingApi.md#pending_transaction_information) | **GET** /v2/transactions/pending/{txid} | Get a specific pending transaction. +[**raw_transaction**](ParticipatingApi.md#raw_transaction) | **POST** /v2/transactions | Broadcasts a raw transaction or transaction group to the network. + + + +## add_participation_key + +> models::AddParticipationKey200Response add_participation_key(participationkey) +Add a participation key to the node + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**participationkey** | **std::path::PathBuf** | The participation key to add to the node | [required] | + +### Return type + +[**models::AddParticipationKey200Response**](AddParticipationKey_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/msgpack +- **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) + + +## append_keys + +> models::ParticipationKey append_keys(participation_id, keymap) +Append state proof keys to a participation key + +Given a participation ID, append state proof keys to a particular set of participation keys + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**participation_id** | **String** | | [required] | +**keymap** | **std::path::PathBuf** | The state proof keys to add to an existing participation ID | [required] | + +### Return type + +[**models::ParticipationKey**](ParticipationKey.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/msgpack +- **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) + + +## delete_participation_key_by_id + +> delete_participation_key_by_id(participation_id) +Delete a given participation key by ID + +Delete a given participation key by ID + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**participation_id** | **String** | | [required] | + +### Return type + + (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## generate_participation_keys + +> String generate_participation_keys(address, first, last, dilution) +Generate and install participation keys to the node. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**address** | **String** | An account public key | [required] | +**first** | **i32** | First round for participation key. | [required] | +**last** | **i32** | Last round for participation key. | [required] | +**dilution** | Option<**i32**> | Key dilution for two-level participation keys (defaults to sqrt of validity window). | | + +### Return type + +**String** + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## get_participation_key_by_id + +> models::ParticipationKey get_participation_key_by_id(participation_id) +Get participation key info given a participation ID + +Given a participation ID, return information about that participation key + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**participation_id** | **String** | | [required] | + +### Return type + +[**models::ParticipationKey**](ParticipationKey.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## get_participation_keys + +> Vec get_participation_keys() +Return a list of participation keys + +Return a list of participation keys + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**Vec**](ParticipationKey.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## get_pending_transactions + +> models::GetPendingTransactionsByAddress200Response get_pending_transactions(max, format) +Get a list of unconfirmed transactions currently in the transaction pool. + +Get the list of pending transactions, sorted by priority, in decreasing order, truncated at the end at MAX. If MAX = 0, returns all pending transactions. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**max** | Option<**i32**> | Truncated number of transactions to display. If max=0, returns all pending txns. | | +**format** | Option<**String**> | Configures whether the response object is JSON or MessagePack encoded. If not provided, defaults to JSON. | | + +### Return type + +[**models::GetPendingTransactionsByAddress200Response**](GetPendingTransactionsByAddress_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json, application/msgpack + +[[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) + + +## get_pending_transactions_by_address + +> models::GetPendingTransactionsByAddress200Response get_pending_transactions_by_address(address, max, format) +Get a list of unconfirmed transactions currently in the transaction pool by address. + +Get the list of pending transactions by address, sorted by priority, in decreasing order, truncated at the end at MAX. If MAX = 0, returns all pending transactions. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**address** | **String** | An account public key | [required] | +**max** | Option<**i32**> | Truncated number of transactions to display. If max=0, returns all pending txns. | | +**format** | Option<**String**> | Configures whether the response object is JSON or MessagePack encoded. If not provided, defaults to JSON. | | + +### Return type + +[**models::GetPendingTransactionsByAddress200Response**](GetPendingTransactionsByAddress_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json, application/msgpack + +[[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) + + +## pending_transaction_information + +> models::PendingTransactionResponse pending_transaction_information(txid, format) +Get a specific pending transaction. + +Given a transaction ID of a recently submitted transaction, it returns information about it. There are several cases when this might succeed: - transaction committed (committed round > 0) - transaction still in the pool (committed round = 0, pool error = \"\") - transaction removed from pool due to error (committed round = 0, pool error != \"\") Or the transaction may have happened sufficiently long ago that the node no longer remembers it, and this will return an error. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**txid** | **String** | A transaction ID | [required] | +**format** | Option<**String**> | Configures whether the response object is JSON or MessagePack encoded. If not provided, defaults to JSON. | | + +### Return type + +[**models::PendingTransactionResponse**](PendingTransactionResponse.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json, application/msgpack + +[[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) + + +## raw_transaction + +> models::RawTransaction200Response raw_transaction(rawtxn) +Broadcasts a raw transaction or transaction group to the network. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**rawtxn** | **std::path::PathBuf** | The byte encoded signed transaction to broadcast to network | [required] | + +### Return type + +[**models::RawTransaction200Response**](RawTransaction_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/x-binary +- **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/crates/algo_fetch/docs/ParticipationKey.md b/crates/algo_fetch/docs/ParticipationKey.md new file mode 100644 index 0000000..07038c8 --- /dev/null +++ b/crates/algo_fetch/docs/ParticipationKey.md @@ -0,0 +1,18 @@ +# ParticipationKey + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**address** | **String** | Address the key was generated for. | +**effective_first_valid** | Option<**i32**> | When registered, this is the first round it may be used. | [optional] +**effective_last_valid** | Option<**i32**> | When registered, this is the last round it may be used. | [optional] +**id** | **String** | The key's ParticipationID. | +**key** | [**models::AccountParticipation**](AccountParticipation.md) | | +**last_block_proposal** | Option<**i32**> | Round when this key was last used to propose a block. | [optional] +**last_state_proof** | Option<**i32**> | Round when this key was last used to generate a state proof. | [optional] +**last_vote** | Option<**i32**> | Round when this key was last used to vote. | [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/crates/algo_fetch/docs/PendingTransactionResponse.md b/crates/algo_fetch/docs/PendingTransactionResponse.md new file mode 100644 index 0000000..c67b150 --- /dev/null +++ b/crates/algo_fetch/docs/PendingTransactionResponse.md @@ -0,0 +1,24 @@ +# PendingTransactionResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**application_index** | Option<**i32**> | The application index if the transaction was found and it created an application. | [optional] +**asset_closing_amount** | Option<**i32**> | The number of the asset's unit that were transferred to the close-to address. | [optional] +**asset_index** | Option<**i32**> | The asset index if the transaction was found and it created an asset. | [optional] +**close_rewards** | Option<**i32**> | Rewards in microalgos applied to the close remainder to account. | [optional] +**closing_amount** | Option<**i32**> | Closing amount for the transaction. | [optional] +**confirmed_round** | Option<**i32**> | The round where this transaction was confirmed, if present. | [optional] +**global_state_delta** | Option<[**Vec**](EvalDeltaKeyValue.md)> | Application state delta. | [optional] +**inner_txns** | Option<[**Vec**](PendingTransactionResponse.md)> | Inner transactions produced by application execution. | [optional] +**local_state_delta** | Option<[**Vec**](AccountStateDelta.md)> | Local state key/value changes for the application being executed by this transaction. | [optional] +**logs** | Option<**Vec**> | Logs for the application being executed by this transaction. | [optional] +**pool_error** | **String** | Indicates that the transaction was kicked out of this node's transaction pool (and specifies why that happened). An empty string indicates the transaction wasn't kicked out of this node's txpool due to an error. | +**receiver_rewards** | Option<**i32**> | Rewards in microalgos applied to the receiver account. | [optional] +**sender_rewards** | Option<**i32**> | Rewards in microalgos applied to the sender account. | [optional] +**txn** | [**serde_json::Value**](.md) | The raw signed transaction. | + +[[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/crates/algo_fetch/docs/PrivateApi.md b/crates/algo_fetch/docs/PrivateApi.md new file mode 100644 index 0000000..ec38f9d --- /dev/null +++ b/crates/algo_fetch/docs/PrivateApi.md @@ -0,0 +1,369 @@ +# \PrivateApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**abort_catchup**](PrivateApi.md#abort_catchup) | **DELETE** /v2/catchup/{catchpoint} | Aborts a catchpoint catchup. +[**add_participation_key**](PrivateApi.md#add_participation_key) | **POST** /v2/participation | Add a participation key to the node +[**append_keys**](PrivateApi.md#append_keys) | **POST** /v2/participation/{participation-id} | Append state proof keys to a participation key +[**delete_participation_key_by_id**](PrivateApi.md#delete_participation_key_by_id) | **DELETE** /v2/participation/{participation-id} | Delete a given participation key by ID +[**generate_participation_keys**](PrivateApi.md#generate_participation_keys) | **POST** /v2/participation/generate/{address} | Generate and install participation keys to the node. +[**get_config**](PrivateApi.md#get_config) | **GET** /debug/settings/config | Gets the merged config file. +[**get_debug_settings_prof**](PrivateApi.md#get_debug_settings_prof) | **GET** /debug/settings/pprof | +[**get_participation_key_by_id**](PrivateApi.md#get_participation_key_by_id) | **GET** /v2/participation/{participation-id} | Get participation key info given a participation ID +[**get_participation_keys**](PrivateApi.md#get_participation_keys) | **GET** /v2/participation | Return a list of participation keys +[**put_debug_settings_prof**](PrivateApi.md#put_debug_settings_prof) | **PUT** /debug/settings/pprof | +[**shutdown_node**](PrivateApi.md#shutdown_node) | **POST** /v2/shutdown | +[**start_catchup**](PrivateApi.md#start_catchup) | **POST** /v2/catchup/{catchpoint} | Starts a catchpoint catchup. + + + +## abort_catchup + +> models::AbortCatchup200Response abort_catchup(catchpoint) +Aborts a catchpoint catchup. + +Given a catchpoint, it aborts catching up to this catchpoint + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**catchpoint** | **String** | A catch point | [required] | + +### Return type + +[**models::AbortCatchup200Response**](AbortCatchup_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## add_participation_key + +> models::AddParticipationKey200Response add_participation_key(participationkey) +Add a participation key to the node + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**participationkey** | **std::path::PathBuf** | The participation key to add to the node | [required] | + +### Return type + +[**models::AddParticipationKey200Response**](AddParticipationKey_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/msgpack +- **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) + + +## append_keys + +> models::ParticipationKey append_keys(participation_id, keymap) +Append state proof keys to a participation key + +Given a participation ID, append state proof keys to a particular set of participation keys + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**participation_id** | **String** | | [required] | +**keymap** | **std::path::PathBuf** | The state proof keys to add to an existing participation ID | [required] | + +### Return type + +[**models::ParticipationKey**](ParticipationKey.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/msgpack +- **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) + + +## delete_participation_key_by_id + +> delete_participation_key_by_id(participation_id) +Delete a given participation key by ID + +Delete a given participation key by ID + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**participation_id** | **String** | | [required] | + +### Return type + + (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## generate_participation_keys + +> String generate_participation_keys(address, first, last, dilution) +Generate and install participation keys to the node. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**address** | **String** | An account public key | [required] | +**first** | **i32** | First round for participation key. | [required] | +**last** | **i32** | Last round for participation key. | [required] | +**dilution** | Option<**i32**> | Key dilution for two-level participation keys (defaults to sqrt of validity window). | | + +### Return type + +**String** + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## get_config + +> String get_config() +Gets the merged config file. + +Returns the merged (defaults + overrides) config file in json. + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +**String** + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## get_debug_settings_prof + +> models::DebugSettingsProf get_debug_settings_prof() + + +Retrieves the current settings for blocking and mutex profiles + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**models::DebugSettingsProf**](DebugSettingsProf.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## get_participation_key_by_id + +> models::ParticipationKey get_participation_key_by_id(participation_id) +Get participation key info given a participation ID + +Given a participation ID, return information about that participation key + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**participation_id** | **String** | | [required] | + +### Return type + +[**models::ParticipationKey**](ParticipationKey.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## get_participation_keys + +> Vec get_participation_keys() +Return a list of participation keys + +Return a list of participation keys + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**Vec**](ParticipationKey.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## put_debug_settings_prof + +> models::DebugSettingsProf put_debug_settings_prof() + + +Enables blocking and mutex profiles, and returns the old settings + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**models::DebugSettingsProf**](DebugSettingsProf.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## shutdown_node + +> serde_json::Value shutdown_node(timeout) + + +Special management endpoint to shutdown the node. Optionally provide a timeout parameter to indicate that the node should begin shutting down after a number of seconds. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**timeout** | Option<**i32**> | | |[default to 0] + +### Return type + +[**serde_json::Value**](serde_json::Value.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## start_catchup + +> models::StartCatchup200Response start_catchup(catchpoint, min) +Starts a catchpoint catchup. + +Given a catchpoint, it starts catching up to this catchpoint + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**catchpoint** | **String** | A catch point | [required] | +**min** | Option<**i32**> | Specify the minimum number of blocks which the ledger must be advanced by in order to start the catchup. This is useful for simplifying tools which support fast catchup, they can run the catchup unconditionally and the node will skip the catchup if it is not needed. | | + +### Return type + +[**models::StartCatchup200Response**](StartCatchup_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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/crates/algo_fetch/docs/PublicApi.md b/crates/algo_fetch/docs/PublicApi.md new file mode 100644 index 0000000..289af9c --- /dev/null +++ b/crates/algo_fetch/docs/PublicApi.md @@ -0,0 +1,1293 @@ +# \PublicApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**account_application_information**](PublicApi.md#account_application_information) | **GET** /v2/accounts/{address}/applications/{application-id} | Get account information about a given app. +[**account_asset_information**](PublicApi.md#account_asset_information) | **GET** /v2/accounts/{address}/assets/{asset-id} | Get account information about a given asset. +[**account_assets_information**](PublicApi.md#account_assets_information) | **GET** /v2/accounts/{address}/assets | Get a list of assets held by an account, inclusive of asset params. +[**account_information**](PublicApi.md#account_information) | **GET** /v2/accounts/{address} | Get account information. +[**experimental_check**](PublicApi.md#experimental_check) | **GET** /v2/experimental | Returns OK if experimental API is enabled. +[**get_application_box_by_name**](PublicApi.md#get_application_box_by_name) | **GET** /v2/applications/{application-id}/box | Get box information for a given application. +[**get_application_boxes**](PublicApi.md#get_application_boxes) | **GET** /v2/applications/{application-id}/boxes | Get all box names for a given application. +[**get_application_by_id**](PublicApi.md#get_application_by_id) | **GET** /v2/applications/{application-id} | Get application information. +[**get_asset_by_id**](PublicApi.md#get_asset_by_id) | **GET** /v2/assets/{asset-id} | Get asset information. +[**get_block**](PublicApi.md#get_block) | **GET** /v2/blocks/{round} | Get the block for the given round. +[**get_block_hash**](PublicApi.md#get_block_hash) | **GET** /v2/blocks/{round}/hash | Get the block hash for the block on the given round. +[**get_block_logs**](PublicApi.md#get_block_logs) | **GET** /v2/blocks/{round}/logs | Get all of the logs from outer and inner app calls in the given round +[**get_block_time_stamp_offset**](PublicApi.md#get_block_time_stamp_offset) | **GET** /v2/devmode/blocks/offset | Returns the timestamp offset. Timestamp offsets can only be set in dev mode. +[**get_block_txids**](PublicApi.md#get_block_txids) | **GET** /v2/blocks/{round}/txids | Get the top level transaction IDs for the block on the given round. +[**get_genesis**](PublicApi.md#get_genesis) | **GET** /genesis | Gets the genesis information. +[**get_ledger_state_delta**](PublicApi.md#get_ledger_state_delta) | **GET** /v2/deltas/{round} | Get a LedgerStateDelta object for a given round +[**get_ledger_state_delta_for_transaction_group**](PublicApi.md#get_ledger_state_delta_for_transaction_group) | **GET** /v2/deltas/txn/group/{id} | Get a LedgerStateDelta object for a given transaction group +[**get_light_block_header_proof**](PublicApi.md#get_light_block_header_proof) | **GET** /v2/blocks/{round}/lightheader/proof | Gets a proof for a given light block header inside a state proof commitment +[**get_pending_transactions**](PublicApi.md#get_pending_transactions) | **GET** /v2/transactions/pending | Get a list of unconfirmed transactions currently in the transaction pool. +[**get_pending_transactions_by_address**](PublicApi.md#get_pending_transactions_by_address) | **GET** /v2/accounts/{address}/transactions/pending | Get a list of unconfirmed transactions currently in the transaction pool by address. +[**get_ready**](PublicApi.md#get_ready) | **GET** /ready | Returns OK if healthy and fully caught up. +[**get_state_proof**](PublicApi.md#get_state_proof) | **GET** /v2/stateproofs/{round} | Get a state proof that covers a given round +[**get_status**](PublicApi.md#get_status) | **GET** /v2/status | Gets the current node status. +[**get_supply**](PublicApi.md#get_supply) | **GET** /v2/ledger/supply | Get the current supply reported by the ledger. +[**get_sync_round**](PublicApi.md#get_sync_round) | **GET** /v2/ledger/sync | Returns the minimum sync round the ledger is keeping in cache. +[**get_transaction_group_ledger_state_deltas_for_round**](PublicApi.md#get_transaction_group_ledger_state_deltas_for_round) | **GET** /v2/deltas/{round}/txn/group | Get LedgerStateDelta objects for all transaction groups in a given round +[**get_transaction_proof**](PublicApi.md#get_transaction_proof) | **GET** /v2/blocks/{round}/transactions/{txid}/proof | Get a proof for a transaction in a block. +[**get_version**](PublicApi.md#get_version) | **GET** /versions | +[**health_check**](PublicApi.md#health_check) | **GET** /health | Returns OK if healthy. +[**metrics**](PublicApi.md#metrics) | **GET** /metrics | Return metrics about algod functioning. +[**pending_transaction_information**](PublicApi.md#pending_transaction_information) | **GET** /v2/transactions/pending/{txid} | Get a specific pending transaction. +[**raw_transaction**](PublicApi.md#raw_transaction) | **POST** /v2/transactions | Broadcasts a raw transaction or transaction group to the network. +[**raw_transaction_async**](PublicApi.md#raw_transaction_async) | **POST** /v2/transactions/async | Fast track for broadcasting a raw transaction or transaction group to the network through the tx handler without performing most of the checks and reporting detailed errors. Should be only used for development and performance testing. +[**set_block_time_stamp_offset**](PublicApi.md#set_block_time_stamp_offset) | **POST** /v2/devmode/blocks/offset/{offset} | Given a timestamp offset in seconds, adds the offset to every subsequent block header's timestamp. +[**set_sync_round**](PublicApi.md#set_sync_round) | **POST** /v2/ledger/sync/{round} | Given a round, tells the ledger to keep that round in its cache. +[**simulate_transaction**](PublicApi.md#simulate_transaction) | **POST** /v2/transactions/simulate | Simulates a raw transaction or transaction group as it would be evaluated on the network. The simulation will use blockchain state from the latest committed round. +[**swagger_json**](PublicApi.md#swagger_json) | **GET** /swagger.json | Gets the current swagger spec. +[**teal_compile**](PublicApi.md#teal_compile) | **POST** /v2/teal/compile | Compile TEAL source code to binary, produce its hash +[**teal_disassemble**](PublicApi.md#teal_disassemble) | **POST** /v2/teal/disassemble | Disassemble program bytes into the TEAL source code. +[**teal_dryrun**](PublicApi.md#teal_dryrun) | **POST** /v2/teal/dryrun | Provide debugging information for a transaction (or group). +[**transaction_params**](PublicApi.md#transaction_params) | **GET** /v2/transactions/params | Get parameters for constructing a new transaction +[**unset_sync_round**](PublicApi.md#unset_sync_round) | **DELETE** /v2/ledger/sync | Removes minimum sync round restriction from the ledger. +[**wait_for_block**](PublicApi.md#wait_for_block) | **GET** /v2/status/wait-for-block-after/{round} | Gets the node status after waiting for a round after the given round. + + + +## account_application_information + +> models::AccountApplicationInformation200Response account_application_information(address, application_id, format) +Get account information about a given app. + +Given a specific account public key and application ID, this call returns the account's application local state and global state (AppLocalState and AppParams, if either exists). Global state will only be returned if the provided address is the application's creator. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**address** | **String** | An account public key | [required] | +**application_id** | **i32** | An application identifier | [required] | +**format** | Option<**String**> | Configures whether the response object is JSON or MessagePack encoded. If not provided, defaults to JSON. | | + +### Return type + +[**models::AccountApplicationInformation200Response**](AccountApplicationInformation_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json, application/msgpack + +[[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) + + +## account_asset_information + +> models::AccountAssetInformation200Response account_asset_information(address, asset_id, format) +Get account information about a given asset. + +Given a specific account public key and asset ID, this call returns the account's asset holding and asset parameters (if either exist). Asset parameters will only be returned if the provided address is the asset's creator. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**address** | **String** | An account public key | [required] | +**asset_id** | **i32** | An asset identifier | [required] | +**format** | Option<**String**> | Configures whether the response object is JSON or MessagePack encoded. If not provided, defaults to JSON. | | + +### Return type + +[**models::AccountAssetInformation200Response**](AccountAssetInformation_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json, application/msgpack + +[[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) + + +## account_assets_information + +> models::AccountAssetsInformation200Response account_assets_information(address, limit, next) +Get a list of assets held by an account, inclusive of asset params. + +Lookup an account's asset holdings. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**address** | **String** | An account public key | [required] | +**limit** | Option<**i32**> | Maximum number of results to return. | | +**next** | Option<**String**> | The next page of results. Use the next token provided by the previous results. | | + +### Return type + +[**models::AccountAssetsInformation200Response**](AccountAssetsInformation_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## account_information + +> models::Account account_information(address, format, exclude) +Get account information. + +Given a specific account public key, this call returns the accounts status, balance and spendable amounts + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**address** | **String** | An account public key | [required] | +**format** | Option<**String**> | Configures whether the response object is JSON or MessagePack encoded. If not provided, defaults to JSON. | | +**exclude** | Option<**String**> | When set to `all` will exclude asset holdings, application local state, created asset parameters, any created application parameters. Defaults to `none`. | | + +### Return type + +[**models::Account**](Account.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json, application/msgpack + +[[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) + + +## experimental_check + +> experimental_check() +Returns OK if experimental API is enabled. + +### Parameters + +This endpoint does not need any parameter. + +### Return type + + (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[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) + + +## get_application_box_by_name + +> models::Box get_application_box_by_name(application_id, name) +Get box information for a given application. + +Given an application ID and box name, it returns the round, box name, and value (each base64 encoded). Box names must be in the goal app call arg encoding form 'encoding:value'. For ints, use the form 'int:1234'. For raw bytes, use the form 'b64:A=='. For printable strings, use the form 'str:hello'. For addresses, use the form 'addr:XYZ...'. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**application_id** | **i32** | An application identifier | [required] | +**name** | **String** | A box name, in the goal app call arg form 'encoding:value'. For ints, use the form 'int:1234'. For raw bytes, use the form 'b64:A=='. For printable strings, use the form 'str:hello'. For addresses, use the form 'addr:XYZ...'. | [required] | + +### Return type + +[**models::Box**](Box.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## get_application_boxes + +> models::GetApplicationBoxes200Response get_application_boxes(application_id, max) +Get all box names for a given application. + +Given an application ID, return all Box names. No particular ordering is guaranteed. Request fails when client or server-side configured limits prevent returning all Box names. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**application_id** | **i32** | An application identifier | [required] | +**max** | Option<**i32**> | Max number of box names to return. If max is not set, or max == 0, returns all box-names. | | + +### Return type + +[**models::GetApplicationBoxes200Response**](GetApplicationBoxes_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## get_application_by_id + +> models::Application get_application_by_id(application_id) +Get application information. + +Given a application ID, it returns application information including creator, approval and clear programs, global and local schemas, and global state. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**application_id** | **i32** | An application identifier | [required] | + +### Return type + +[**models::Application**](Application.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## get_asset_by_id + +> models::Asset get_asset_by_id(asset_id) +Get asset information. + +Given a asset ID, it returns asset information including creator, name, total supply and special addresses. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**asset_id** | **i32** | An asset identifier | [required] | + +### Return type + +[**models::Asset**](Asset.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## get_block + +> models::GetBlock200Response get_block(round, format) +Get the block for the given round. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**round** | **i32** | The round from which to fetch block information. | [required] | +**format** | Option<**String**> | Configures whether the response object is JSON or MessagePack encoded. If not provided, defaults to JSON. | | + +### Return type + +[**models::GetBlock200Response**](GetBlock_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json, application/msgpack + +[[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) + + +## get_block_hash + +> models::GetBlockHash200Response get_block_hash(round) +Get the block hash for the block on the given round. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**round** | **i32** | The round from which to fetch block hash information. | [required] | + +### Return type + +[**models::GetBlockHash200Response**](GetBlockHash_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## get_block_logs + +> models::GetBlockLogs200Response get_block_logs(round) +Get all of the logs from outer and inner app calls in the given round + +Get all of the logs from outer and inner app calls in the given round + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**round** | **i32** | The round from which to fetch block log information. | [required] | + +### Return type + +[**models::GetBlockLogs200Response**](GetBlockLogs_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## get_block_time_stamp_offset + +> models::GetBlockTimeStampOffset200Response get_block_time_stamp_offset() +Returns the timestamp offset. Timestamp offsets can only be set in dev mode. + +Gets the current timestamp offset. + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**models::GetBlockTimeStampOffset200Response**](GetBlockTimeStampOffset_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## get_block_txids + +> models::GetBlockTxids200Response get_block_txids(round) +Get the top level transaction IDs for the block on the given round. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**round** | **i32** | The round from which to fetch block transaction IDs. | [required] | + +### Return type + +[**models::GetBlockTxids200Response**](GetBlockTxids_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## get_genesis + +> String get_genesis() +Gets the genesis information. + +Returns the entire genesis file in json. + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +**String** + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## get_ledger_state_delta + +> serde_json::Value get_ledger_state_delta(round, format) +Get a LedgerStateDelta object for a given round + +Get ledger deltas for a round. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**round** | **i32** | The round for which the deltas are desired. | [required] | +**format** | Option<**String**> | Configures whether the response object is JSON or MessagePack encoded. If not provided, defaults to JSON. | | + +### Return type + +[**serde_json::Value**](serde_json::Value.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json, application/msgpack + +[[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) + + +## get_ledger_state_delta_for_transaction_group + +> serde_json::Value get_ledger_state_delta_for_transaction_group(id, format) +Get a LedgerStateDelta object for a given transaction group + +Get a ledger delta for a given transaction group. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**id** | **String** | A transaction ID, or transaction group ID | [required] | +**format** | Option<**String**> | Configures whether the response object is JSON or MessagePack encoded. If not provided, defaults to JSON. | | + +### Return type + +[**serde_json::Value**](serde_json::Value.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json, application/msgpack + +[[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) + + +## get_light_block_header_proof + +> models::LightBlockHeaderProof get_light_block_header_proof(round) +Gets a proof for a given light block header inside a state proof commitment + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**round** | **i32** | The round to which the light block header belongs. | [required] | + +### Return type + +[**models::LightBlockHeaderProof**](LightBlockHeaderProof.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## get_pending_transactions + +> models::GetPendingTransactionsByAddress200Response get_pending_transactions(max, format) +Get a list of unconfirmed transactions currently in the transaction pool. + +Get the list of pending transactions, sorted by priority, in decreasing order, truncated at the end at MAX. If MAX = 0, returns all pending transactions. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**max** | Option<**i32**> | Truncated number of transactions to display. If max=0, returns all pending txns. | | +**format** | Option<**String**> | Configures whether the response object is JSON or MessagePack encoded. If not provided, defaults to JSON. | | + +### Return type + +[**models::GetPendingTransactionsByAddress200Response**](GetPendingTransactionsByAddress_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json, application/msgpack + +[[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) + + +## get_pending_transactions_by_address + +> models::GetPendingTransactionsByAddress200Response get_pending_transactions_by_address(address, max, format) +Get a list of unconfirmed transactions currently in the transaction pool by address. + +Get the list of pending transactions by address, sorted by priority, in decreasing order, truncated at the end at MAX. If MAX = 0, returns all pending transactions. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**address** | **String** | An account public key | [required] | +**max** | Option<**i32**> | Truncated number of transactions to display. If max=0, returns all pending txns. | | +**format** | Option<**String**> | Configures whether the response object is JSON or MessagePack encoded. If not provided, defaults to JSON. | | + +### Return type + +[**models::GetPendingTransactionsByAddress200Response**](GetPendingTransactionsByAddress_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json, application/msgpack + +[[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) + + +## get_ready + +> get_ready() +Returns OK if healthy and fully caught up. + +### Parameters + +This endpoint does not need any parameter. + +### Return type + + (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[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) + + +## get_state_proof + +> models::StateProof get_state_proof(round) +Get a state proof that covers a given round + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**round** | **i32** | The round for which a state proof is desired. | [required] | + +### Return type + +[**models::StateProof**](StateProof.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## get_status + +> models::GetStatus200Response get_status() +Gets the current node status. + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**models::GetStatus200Response**](GetStatus_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## get_supply + +> models::GetSupply200Response get_supply() +Get the current supply reported by the ledger. + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**models::GetSupply200Response**](GetSupply_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## get_sync_round + +> models::GetSyncRound200Response get_sync_round() +Returns the minimum sync round the ledger is keeping in cache. + +Gets the minimum sync round for the ledger. + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**models::GetSyncRound200Response**](GetSyncRound_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## get_transaction_group_ledger_state_deltas_for_round + +> models::GetTransactionGroupLedgerStateDeltasForRound200Response get_transaction_group_ledger_state_deltas_for_round(round, format) +Get LedgerStateDelta objects for all transaction groups in a given round + +Get ledger deltas for transaction groups in a given round. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**round** | **i32** | The round for which the deltas are desired. | [required] | +**format** | Option<**String**> | Configures whether the response object is JSON or MessagePack encoded. If not provided, defaults to JSON. | | + +### Return type + +[**models::GetTransactionGroupLedgerStateDeltasForRound200Response**](GetTransactionGroupLedgerStateDeltasForRound_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json, application/msgpack + +[[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) + + +## get_transaction_proof + +> models::GetTransactionProof200Response get_transaction_proof(round, txid, hashtype, format) +Get a proof for a transaction in a block. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**round** | **i32** | The round in which the transaction appears. | [required] | +**txid** | **String** | The transaction ID for which to generate a proof. | [required] | +**hashtype** | Option<**String**> | The type of hash function used to create the proof, must be one of: * sha512_256 * sha256 | | +**format** | Option<**String**> | Configures whether the response object is JSON or MessagePack encoded. If not provided, defaults to JSON. | | + +### Return type + +[**models::GetTransactionProof200Response**](GetTransactionProof_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## get_version + +> models::Version get_version() + + +Retrieves the supported API versions, binary build versions, and genesis information. + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**models::Version**](Version.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## health_check + +> health_check() +Returns OK if healthy. + +### Parameters + +This endpoint does not need any parameter. + +### Return type + + (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[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 + +> metrics() +Return metrics about algod functioning. + +### Parameters + +This endpoint does not need any parameter. + +### Return type + + (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[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) + + +## pending_transaction_information + +> models::PendingTransactionResponse pending_transaction_information(txid, format) +Get a specific pending transaction. + +Given a transaction ID of a recently submitted transaction, it returns information about it. There are several cases when this might succeed: - transaction committed (committed round > 0) - transaction still in the pool (committed round = 0, pool error = \"\") - transaction removed from pool due to error (committed round = 0, pool error != \"\") Or the transaction may have happened sufficiently long ago that the node no longer remembers it, and this will return an error. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**txid** | **String** | A transaction ID | [required] | +**format** | Option<**String**> | Configures whether the response object is JSON or MessagePack encoded. If not provided, defaults to JSON. | | + +### Return type + +[**models::PendingTransactionResponse**](PendingTransactionResponse.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json, application/msgpack + +[[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) + + +## raw_transaction + +> models::RawTransaction200Response raw_transaction(rawtxn) +Broadcasts a raw transaction or transaction group to the network. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**rawtxn** | **std::path::PathBuf** | The byte encoded signed transaction to broadcast to network | [required] | + +### Return type + +[**models::RawTransaction200Response**](RawTransaction_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/x-binary +- **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) + + +## raw_transaction_async + +> raw_transaction_async(rawtxn) +Fast track for broadcasting a raw transaction or transaction group to the network through the tx handler without performing most of the checks and reporting detailed errors. Should be only used for development and performance testing. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**rawtxn** | **std::path::PathBuf** | The byte encoded signed transaction to broadcast to network | [required] | + +### Return type + + (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/x-binary +- **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) + + +## set_block_time_stamp_offset + +> set_block_time_stamp_offset(offset) +Given a timestamp offset in seconds, adds the offset to every subsequent block header's timestamp. + +Sets the timestamp offset (seconds) for blocks in dev mode. Providing an offset of 0 will unset this value and try to use the real clock for the timestamp. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**offset** | **i32** | The timestamp offset for blocks in dev mode. | [required] | + +### Return type + + (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## set_sync_round + +> set_sync_round(round) +Given a round, tells the ledger to keep that round in its cache. + +Sets the minimum sync round on the ledger. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**round** | **i32** | The round for which the deltas are desired. | [required] | + +### Return type + + (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## simulate_transaction + +> models::SimulateTransaction200Response simulate_transaction(request, format) +Simulates a raw transaction or transaction group as it would be evaluated on the network. The simulation will use blockchain state from the latest committed round. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**request** | [**SimulateRequest**](SimulateRequest.md) | The transactions to simulate, along with any other inputs. | [required] | +**format** | Option<**String**> | Configures whether the response object is JSON or MessagePack encoded. If not provided, defaults to JSON. | | + +### Return type + +[**models::SimulateTransaction200Response**](SimulateTransaction_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/json, application/msgpack +- **Accept**: application/json, application/msgpack + +[[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) + + +## swagger_json + +> String swagger_json() +Gets the current swagger spec. + +Returns the entire swagger spec in json. + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +**String** + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## teal_compile + +> models::TealCompile200Response teal_compile(source, sourcemap) +Compile TEAL source code to binary, produce its hash + +Given TEAL source code in plain text, return base64 encoded program bytes and base32 SHA512_256 hash of program bytes (Address style). This endpoint is only enabled when a node's configuration file sets EnableDeveloperAPI to true. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**source** | **std::path::PathBuf** | TEAL source code to be compiled | [required] | +**sourcemap** | Option<**bool**> | When set to `true`, returns the source map of the program as a JSON. Defaults to `false`. | | + +### Return type + +[**models::TealCompile200Response**](TealCompile_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: text/plain +- **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) + + +## teal_disassemble + +> models::TealDisassemble200Response teal_disassemble(source) +Disassemble program bytes into the TEAL source code. + +Given the program bytes, return the TEAL source code in plain text. This endpoint is only enabled when a node's configuration file sets EnableDeveloperAPI to true. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**source** | **String** | TEAL program binary to be disassembled | [required] | + +### Return type + +[**models::TealDisassemble200Response**](TealDisassemble_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/x-binary +- **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) + + +## teal_dryrun + +> models::TealDryrun200Response teal_dryrun(request) +Provide debugging information for a transaction (or group). + +Executes TEAL program(s) in context and returns debugging information about the execution. This endpoint is only enabled when a node's configuration file sets EnableDeveloperAPI to true. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**request** | Option<[**DryrunRequest**](DryrunRequest.md)> | Transaction (or group) and any accompanying state-simulation data. | | + +### Return type + +[**models::TealDryrun200Response**](TealDryrun_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/json, application/msgpack +- **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) + + +## transaction_params + +> models::TransactionParams200Response transaction_params() +Get parameters for constructing a new transaction + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**models::TransactionParams200Response**](TransactionParams_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## unset_sync_round + +> unset_sync_round() +Removes minimum sync round restriction from the ledger. + +Unset the ledger sync round. + +### Parameters + +This endpoint does not need any parameter. + +### Return type + + (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + + +## wait_for_block + +> models::GetStatus200Response wait_for_block(round) +Gets the node status after waiting for a round after the given round. + +Waits for a block to appear after round {round} and returns the node's status at the time. There is a 1 minute timeout, when reached the current status is returned regardless of whether or not it is the round after the given round. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**round** | **i32** | The round to wait until returning status | [required] | + +### Return type + +[**models::GetStatus200Response**](GetStatus_200_response.md) + +### Authorization + +[api_key](../README.md#api_key) + +### 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/crates/algo_fetch/docs/RawTransaction200Response.md b/crates/algo_fetch/docs/RawTransaction200Response.md new file mode 100644 index 0000000..81eb5be --- /dev/null +++ b/crates/algo_fetch/docs/RawTransaction200Response.md @@ -0,0 +1,11 @@ +# RawTransaction200Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**tx_id** | **String** | encoding of the transaction hash. | + +[[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/crates/algo_fetch/docs/ScratchChange.md b/crates/algo_fetch/docs/ScratchChange.md new file mode 100644 index 0000000..ece41ba --- /dev/null +++ b/crates/algo_fetch/docs/ScratchChange.md @@ -0,0 +1,12 @@ +# ScratchChange + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**new_value** | [**models::AvmValue**](AvmValue.md) | | +**slot** | **i32** | The scratch slot written. | + +[[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/crates/algo_fetch/docs/SimulateInitialStates.md b/crates/algo_fetch/docs/SimulateInitialStates.md new file mode 100644 index 0000000..e0669f4 --- /dev/null +++ b/crates/algo_fetch/docs/SimulateInitialStates.md @@ -0,0 +1,11 @@ +# SimulateInitialStates + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**app_initial_states** | Option<[**Vec**](ApplicationInitialStates.md)> | The initial states of accessed application before simulation. The order of this array is arbitrary. | [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/crates/algo_fetch/docs/SimulateRequest.md b/crates/algo_fetch/docs/SimulateRequest.md new file mode 100644 index 0000000..4c7056a --- /dev/null +++ b/crates/algo_fetch/docs/SimulateRequest.md @@ -0,0 +1,18 @@ +# SimulateRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**allow_empty_signatures** | Option<**bool**> | Allows transactions without signatures to be simulated as if they had correct signatures. | [optional] +**allow_more_logging** | Option<**bool**> | Lifts limits on log opcode usage during simulation. | [optional] +**allow_unnamed_resources** | Option<**bool**> | Allows access to unnamed resources during simulation. | [optional] +**exec_trace_config** | Option<[**models::SimulateTraceConfig**](SimulateTraceConfig.md)> | | [optional] +**extra_opcode_budget** | Option<**i32**> | Applies extra opcode budget during simulation for each transaction group. | [optional] +**fix_signers** | Option<**bool**> | If true, signers for transactions that are missing signatures will be fixed during evaluation. | [optional] +**round** | Option<**i32**> | If provided, specifies the round preceding the simulation. State changes through this round will be used to run this simulation. Usually only the 4 most recent rounds will be available (controlled by the node config value MaxAcctLookback). If not specified, defaults to the latest available round. | [optional] +**txn_groups** | [**Vec**](SimulateRequestTransactionGroup.md) | The transaction groups to simulate. | + +[[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/crates/algo_fetch/docs/SimulateRequestTransactionGroup.md b/crates/algo_fetch/docs/SimulateRequestTransactionGroup.md new file mode 100644 index 0000000..b117052 --- /dev/null +++ b/crates/algo_fetch/docs/SimulateRequestTransactionGroup.md @@ -0,0 +1,11 @@ +# SimulateRequestTransactionGroup + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**txns** | **Vec** | An atomic transaction group. | + +[[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/crates/algo_fetch/docs/SimulateTraceConfig.md b/crates/algo_fetch/docs/SimulateTraceConfig.md new file mode 100644 index 0000000..204fcac --- /dev/null +++ b/crates/algo_fetch/docs/SimulateTraceConfig.md @@ -0,0 +1,14 @@ +# SimulateTraceConfig + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enable** | Option<**bool**> | A boolean option for opting in execution trace features simulation endpoint. | [optional] +**scratch_change** | Option<**bool**> | A boolean option enabling returning scratch slot changes together with execution trace during simulation. | [optional] +**stack_change** | Option<**bool**> | A boolean option enabling returning stack changes together with execution trace during simulation. | [optional] +**state_change** | Option<**bool**> | A boolean option enabling returning application state changes (global, local, and box changes) with the execution trace during simulation. | [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/crates/algo_fetch/docs/SimulateTransaction200Response.md b/crates/algo_fetch/docs/SimulateTransaction200Response.md new file mode 100644 index 0000000..46dffd2 --- /dev/null +++ b/crates/algo_fetch/docs/SimulateTransaction200Response.md @@ -0,0 +1,16 @@ +# SimulateTransaction200Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**eval_overrides** | Option<[**models::SimulationEvalOverrides**](SimulationEvalOverrides.md)> | | [optional] +**exec_trace_config** | Option<[**models::SimulateTraceConfig**](SimulateTraceConfig.md)> | | [optional] +**initial_states** | Option<[**models::SimulateInitialStates**](SimulateInitialStates.md)> | | [optional] +**last_round** | **i32** | The round immediately preceding this simulation. State changes through this round were used to run this simulation. | +**txn_groups** | [**Vec**](SimulateTransactionGroupResult.md) | A result object for each transaction group that was simulated. | +**version** | **i32** | The version of this response object. | + +[[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/crates/algo_fetch/docs/SimulateTransactionGroupResult.md b/crates/algo_fetch/docs/SimulateTransactionGroupResult.md new file mode 100644 index 0000000..c28cefb --- /dev/null +++ b/crates/algo_fetch/docs/SimulateTransactionGroupResult.md @@ -0,0 +1,16 @@ +# SimulateTransactionGroupResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**app_budget_added** | Option<**i32**> | Total budget added during execution of app calls in the transaction group. | [optional] +**app_budget_consumed** | Option<**i32**> | Total budget consumed during execution of app calls in the transaction group. | [optional] +**failed_at** | Option<**Vec**> | If present, indicates which transaction in this group caused the failure. This array represents the path to the failing transaction. Indexes are zero based, the first element indicates the top-level transaction, and successive elements indicate deeper inner transactions. | [optional] +**failure_message** | Option<**String**> | If present, indicates that the transaction group failed and specifies why that happened | [optional] +**txn_results** | [**Vec**](SimulateTransactionResult.md) | Simulation result for individual transactions | +**unnamed_resources_accessed** | Option<[**models::SimulateUnnamedResourcesAccessed**](SimulateUnnamedResourcesAccessed.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/crates/algo_fetch/docs/SimulateTransactionResult.md b/crates/algo_fetch/docs/SimulateTransactionResult.md new file mode 100644 index 0000000..db482d0 --- /dev/null +++ b/crates/algo_fetch/docs/SimulateTransactionResult.md @@ -0,0 +1,16 @@ +# SimulateTransactionResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**app_budget_consumed** | Option<**i32**> | Budget used during execution of an app call transaction. This value includes budged used by inner app calls spawned by this transaction. | [optional] +**exec_trace** | Option<[**models::SimulationTransactionExecTrace**](SimulationTransactionExecTrace.md)> | | [optional] +**fixed_signer** | Option<**String**> | The account that needed to sign this transaction when no signature was provided and the provided signer was incorrect. | [optional] +**logic_sig_budget_consumed** | Option<**i32**> | Budget used during execution of a logic sig transaction. | [optional] +**txn_result** | [**models::PendingTransactionResponse**](PendingTransactionResponse.md) | | +**unnamed_resources_accessed** | Option<[**models::SimulateUnnamedResourcesAccessed**](SimulateUnnamedResourcesAccessed.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/crates/algo_fetch/docs/SimulateUnnamedResourcesAccessed.md b/crates/algo_fetch/docs/SimulateUnnamedResourcesAccessed.md new file mode 100644 index 0000000..06ca9a0 --- /dev/null +++ b/crates/algo_fetch/docs/SimulateUnnamedResourcesAccessed.md @@ -0,0 +1,17 @@ +# SimulateUnnamedResourcesAccessed + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**accounts** | Option<**Vec**> | The unnamed accounts that were referenced. The order of this array is arbitrary. | [optional] +**app_locals** | Option<[**Vec**](ApplicationLocalReference.md)> | The unnamed application local states that were referenced. The order of this array is arbitrary. | [optional] +**apps** | Option<**Vec**> | The unnamed applications that were referenced. The order of this array is arbitrary. | [optional] +**asset_holdings** | Option<[**Vec**](AssetHoldingReference.md)> | The unnamed asset holdings that were referenced. The order of this array is arbitrary. | [optional] +**assets** | Option<**Vec**> | The unnamed assets that were referenced. The order of this array is arbitrary. | [optional] +**boxes** | Option<[**Vec**](BoxReference.md)> | The unnamed boxes that were referenced. The order of this array is arbitrary. | [optional] +**extra_box_refs** | Option<**i32**> | The number of extra box references used to increase the IO budget. This is in addition to the references defined in the input transaction group and any referenced to unnamed boxes. | [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/crates/algo_fetch/docs/SimulationEvalOverrides.md b/crates/algo_fetch/docs/SimulationEvalOverrides.md new file mode 100644 index 0000000..1ba2db8 --- /dev/null +++ b/crates/algo_fetch/docs/SimulationEvalOverrides.md @@ -0,0 +1,16 @@ +# SimulationEvalOverrides + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**allow_empty_signatures** | Option<**bool**> | If true, transactions without signatures are allowed and simulated as if they were properly signed. | [optional] +**allow_unnamed_resources** | Option<**bool**> | If true, allows access to unnamed resources during simulation. | [optional] +**extra_opcode_budget** | Option<**i32**> | The extra opcode budget added to each transaction group during simulation | [optional] +**fix_signers** | Option<**bool**> | If true, signers for transactions that are missing signatures will be fixed during evaluation. | [optional] +**max_log_calls** | Option<**i32**> | The maximum log calls one can make during simulation | [optional] +**max_log_size** | Option<**i32**> | The maximum byte number to log during simulation | [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/crates/algo_fetch/docs/SimulationOpcodeTraceUnit.md b/crates/algo_fetch/docs/SimulationOpcodeTraceUnit.md new file mode 100644 index 0000000..f3dceb6 --- /dev/null +++ b/crates/algo_fetch/docs/SimulationOpcodeTraceUnit.md @@ -0,0 +1,16 @@ +# SimulationOpcodeTraceUnit + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**pc** | **i32** | The program counter of the current opcode being evaluated. | +**scratch_changes** | Option<[**Vec**](ScratchChange.md)> | The writes into scratch slots. | [optional] +**spawned_inners** | Option<**Vec**> | The indexes of the traces for inner transactions spawned by this opcode, if any. | [optional] +**stack_additions** | Option<[**Vec**](AvmValue.md)> | The values added by this opcode to the stack. | [optional] +**stack_pop_count** | Option<**i32**> | The number of deleted stack values by this opcode. | [optional] +**state_changes** | Option<[**Vec**](ApplicationStateOperation.md)> | The operations against the current application's states. | [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/crates/algo_fetch/docs/SimulationTransactionExecTrace.md b/crates/algo_fetch/docs/SimulationTransactionExecTrace.md new file mode 100644 index 0000000..cbd69ee --- /dev/null +++ b/crates/algo_fetch/docs/SimulationTransactionExecTrace.md @@ -0,0 +1,19 @@ +# SimulationTransactionExecTrace + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**approval_program_hash** | Option<**String**> | SHA512_256 hash digest of the approval program executed in transaction. | [optional] +**approval_program_trace** | Option<[**Vec**](SimulationOpcodeTraceUnit.md)> | Program trace that contains a trace of opcode effects in an approval program. | [optional] +**clear_state_program_hash** | Option<**String**> | SHA512_256 hash digest of the clear state program executed in transaction. | [optional] +**clear_state_program_trace** | Option<[**Vec**](SimulationOpcodeTraceUnit.md)> | Program trace that contains a trace of opcode effects in a clear state program. | [optional] +**clear_state_rollback** | Option<**bool**> | If true, indicates that the clear state program failed and any persistent state changes it produced should be reverted once the program exits. | [optional] +**clear_state_rollback_error** | Option<**String**> | The error message explaining why the clear state program failed. This field will only be populated if clear-state-rollback is true and the failure was due to an execution error. | [optional] +**inner_trace** | Option<[**Vec**](SimulationTransactionExecTrace.md)> | An array of SimulationTransactionExecTrace representing the execution trace of any inner transactions executed. | [optional] +**logic_sig_hash** | Option<**String**> | SHA512_256 hash digest of the logic sig executed in transaction. | [optional] +**logic_sig_trace** | Option<[**Vec**](SimulationOpcodeTraceUnit.md)> | Program trace that contains a trace of opcode effects in a logic sig. | [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/crates/algo_fetch/docs/StartCatchup200Response.md b/crates/algo_fetch/docs/StartCatchup200Response.md new file mode 100644 index 0000000..0f286e0 --- /dev/null +++ b/crates/algo_fetch/docs/StartCatchup200Response.md @@ -0,0 +1,11 @@ +# StartCatchup200Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**catchup_message** | **String** | Catchup start response 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/crates/algo_fetch/docs/StateProof.md b/crates/algo_fetch/docs/StateProof.md new file mode 100644 index 0000000..eadf997 --- /dev/null +++ b/crates/algo_fetch/docs/StateProof.md @@ -0,0 +1,12 @@ +# StateProof + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**message** | [**models::StateProofMessage**](StateProofMessage.md) | | +**state_proof** | **String** | The encoded StateProof for the message. | + +[[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/crates/algo_fetch/docs/StateProofMessage.md b/crates/algo_fetch/docs/StateProofMessage.md new file mode 100644 index 0000000..0e20425 --- /dev/null +++ b/crates/algo_fetch/docs/StateProofMessage.md @@ -0,0 +1,15 @@ +# StateProofMessage + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**block_headers_commitment** | **String** | The vector commitment root on all light block headers within a state proof interval. | +**first_attested_round** | **i32** | The first round the message attests to. | +**last_attested_round** | **i32** | The last round the message attests to. | +**ln_proven_weight** | **i32** | An integer value representing the natural log of the proven weight with 16 bits of precision. This value would be used to verify the next state proof. | +**voters_commitment** | **String** | The vector commitment root of the top N accounts to sign the next StateProof. | + +[[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/crates/algo_fetch/docs/TealCompile200Response.md b/crates/algo_fetch/docs/TealCompile200Response.md new file mode 100644 index 0000000..bb3efb0 --- /dev/null +++ b/crates/algo_fetch/docs/TealCompile200Response.md @@ -0,0 +1,13 @@ +# TealCompile200Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**hash** | **String** | base32 SHA512_256 of program bytes (Address style) | +**result** | **String** | base64 encoded program bytes | +**sourcemap** | Option<[**serde_json::Value**](.md)> | JSON of the source map | [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/crates/algo_fetch/docs/TealDisassemble200Response.md b/crates/algo_fetch/docs/TealDisassemble200Response.md new file mode 100644 index 0000000..bf87c47 --- /dev/null +++ b/crates/algo_fetch/docs/TealDisassemble200Response.md @@ -0,0 +1,11 @@ +# TealDisassemble200Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**result** | **String** | disassembled Teal code | + +[[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/crates/algo_fetch/docs/TealDryrun200Response.md b/crates/algo_fetch/docs/TealDryrun200Response.md new file mode 100644 index 0000000..45dc044 --- /dev/null +++ b/crates/algo_fetch/docs/TealDryrun200Response.md @@ -0,0 +1,13 @@ +# TealDryrun200Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**error** | **String** | | +**protocol_version** | **String** | Protocol version is the protocol version Dryrun was operated under. | +**txns** | [**Vec**](DryrunTxnResult.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/crates/algo_fetch/docs/TealKeyValue.md b/crates/algo_fetch/docs/TealKeyValue.md new file mode 100644 index 0000000..6730f41 --- /dev/null +++ b/crates/algo_fetch/docs/TealKeyValue.md @@ -0,0 +1,12 @@ +# TealKeyValue + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**key** | **String** | | +**value** | [**models::TealValue**](TealValue.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/crates/algo_fetch/docs/TealValue.md b/crates/algo_fetch/docs/TealValue.md new file mode 100644 index 0000000..614812d --- /dev/null +++ b/crates/algo_fetch/docs/TealValue.md @@ -0,0 +1,13 @@ +# TealValue + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bytes** | **String** | \\[tb\\] bytes value. | +**r#type** | **i32** | \\[tt\\] value type. Value `1` refers to **bytes**, value `2` refers to **uint** | +**uint** | **i32** | \\[ui\\] uint value. | + +[[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/crates/algo_fetch/docs/TransactionParams200Response.md b/crates/algo_fetch/docs/TransactionParams200Response.md new file mode 100644 index 0000000..a050e77 --- /dev/null +++ b/crates/algo_fetch/docs/TransactionParams200Response.md @@ -0,0 +1,16 @@ +# TransactionParams200Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**consensus_version** | **String** | ConsensusVersion indicates the consensus protocol version as of LastRound. | +**fee** | **i32** | Fee is the suggested transaction fee Fee is in units of micro-Algos per byte. Fee may fall to zero but transactions must still have a fee of at least MinTxnFee for the current network protocol. | +**genesis_hash** | **String** | GenesisHash is the hash of the genesis block. | +**genesis_id** | **String** | GenesisID is an ID listed in the genesis block. | +**last_round** | **i32** | LastRound indicates the last round seen | +**min_fee** | **i32** | The minimum transaction fee (not per byte) required for the txn to validate for the current network protocol. | + +[[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/crates/algo_fetch/docs/Version.md b/crates/algo_fetch/docs/Version.md new file mode 100644 index 0000000..e2a4f90 --- /dev/null +++ b/crates/algo_fetch/docs/Version.md @@ -0,0 +1,14 @@ +# Version + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**build** | [**models::BuildVersion**](BuildVersion.md) | | +**genesis_hash_b64** | **String** | | +**genesis_id** | **String** | | +**versions** | **Vec** | | + +[[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/crates/algo_fetch/git_push.sh b/crates/algo_fetch/git_push.sh new file mode 100644 index 0000000..f53a75d --- /dev/null +++ b/crates/algo_fetch/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/crates/algo_fetch/src/apis/common_api.rs b/crates/algo_fetch/src/apis/common_api.rs new file mode 100644 index 0000000..36a76f6 --- /dev/null +++ b/crates/algo_fetch/src/apis/common_api.rs @@ -0,0 +1,280 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + + +use reqwest; +use serde::{Deserialize, Serialize}; +use crate::{apis::ResponseContent, models}; +use super::{Error, configuration}; + + +/// struct for typed errors of method [`get_genesis`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetGenesisError { + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_ready`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetReadyError { + Status500(), + Status503(), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_version`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetVersionError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`health_check`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum HealthCheckError { + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`metrics`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum MetricsError { + Status404(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`swagger_json`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum SwaggerJsonError { + DefaultResponse(), + UnknownValue(serde_json::Value), +} + + +/// Returns the entire genesis file in json. +pub async fn get_genesis(configuration: &configuration::Configuration, ) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/genesis", 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +pub async fn get_ready(configuration: &configuration::Configuration, ) -> Result<(), Error> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/ready", 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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() { + Ok(()) + } 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)) + } +} + +/// Retrieves the supported API versions, binary build versions, and genesis information. +pub async fn get_version(configuration: &configuration::Configuration, ) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/versions", 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +pub async fn health_check(configuration: &configuration::Configuration, ) -> Result<(), Error> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/health", 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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() { + Ok(()) + } 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)) + } +} + +pub async fn metrics(configuration: &configuration::Configuration, ) -> Result<(), Error> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/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_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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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() { + Ok(()) + } 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 entire swagger spec in json. +pub async fn swagger_json(configuration: &configuration::Configuration, ) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/swagger.json", 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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/crates/algo_fetch/src/apis/configuration.rs b/crates/algo_fetch/src/apis/configuration.rs new file mode 100644 index 0000000..8c08b7d --- /dev/null +++ b/crates/algo_fetch/src/apis/configuration.rs @@ -0,0 +1,51 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + + + +#[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, +} + +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 { + Configuration { + base_path: "http://localhost".to_owned(), + user_agent: Some("OpenAPI-Generator/0.0.1/rust".to_owned()), + client: reqwest::Client::new(), + basic_auth: None, + oauth_access_token: None, + bearer_access_token: None, + api_key: None, + } + } +} diff --git a/crates/algo_fetch/src/apis/data_api.rs b/crates/algo_fetch/src/apis/data_api.rs new file mode 100644 index 0000000..b7f7c29 --- /dev/null +++ b/crates/algo_fetch/src/apis/data_api.rs @@ -0,0 +1,162 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + + +use reqwest; +use serde::{Deserialize, Serialize}; +use crate::{apis::ResponseContent, models}; +use super::{Error, configuration}; + + +/// struct for typed errors of method [`get_sync_round`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetSyncRoundError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status500(models::ErrorResponse), + Status503(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`set_sync_round`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum SetSyncRoundError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status500(models::ErrorResponse), + Status503(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`unset_sync_round`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum UnsetSyncRoundError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status500(models::ErrorResponse), + Status503(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + + +/// Gets the minimum sync round for the ledger. +pub async fn get_sync_round(configuration: &configuration::Configuration, ) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/ledger/sync", 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +/// Sets the minimum sync round on the ledger. +pub async fn set_sync_round(configuration: &configuration::Configuration, round: i32) -> Result<(), Error> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/ledger/sync/{round}", local_var_configuration.base_path, round=round); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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() { + Ok(()) + } 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)) + } +} + +/// Unset the ledger sync round. +pub async fn unset_sync_round(configuration: &configuration::Configuration, ) -> Result<(), Error> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/ledger/sync", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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() { + Ok(()) + } 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/crates/algo_fetch/src/apis/experimental_api.rs b/crates/algo_fetch/src/apis/experimental_api.rs new file mode 100644 index 0000000..1156097 --- /dev/null +++ b/crates/algo_fetch/src/apis/experimental_api.rs @@ -0,0 +1,164 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + + +use reqwest; +use serde::{Deserialize, Serialize}; +use crate::{apis::ResponseContent, models}; +use super::{Error, configuration}; + + +/// struct for typed errors of method [`account_assets_information`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum AccountAssetsInformationError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status500(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`experimental_check`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ExperimentalCheckError { + Status404(), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`raw_transaction_async`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum RawTransactionAsyncError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status404(), + Status500(models::ErrorResponse), + Status503(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + + +/// Lookup an account's asset holdings. +pub async fn account_assets_information(configuration: &configuration::Configuration, address: &str, limit: Option, next: Option<&str>) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/accounts/{address}/assets", 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) = limit { + local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = next { + local_var_req_builder = local_var_req_builder.query(&[("next", &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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +pub async fn experimental_check(configuration: &configuration::Configuration, ) -> Result<(), Error> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/experimental", 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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() { + Ok(()) + } 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)) + } +} + +pub async fn raw_transaction_async(configuration: &configuration::Configuration, rawtxn: std::path::PathBuf) -> Result<(), Error> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/transactions/async", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + local_var_req_builder = local_var_req_builder.json(&rawtxn); + + 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() { + Ok(()) + } 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/crates/algo_fetch/src/apis/mod.rs b/crates/algo_fetch/src/apis/mod.rs new file mode 100644 index 0000000..da81643 --- /dev/null +++ b/crates/algo_fetch/src/apis/mod.rs @@ -0,0 +1,101 @@ +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 common_api; +pub mod data_api; +pub mod experimental_api; +pub mod nonparticipating_api; +pub mod participating_api; +pub mod private_api; +pub mod public_api; + +pub mod configuration; diff --git a/crates/algo_fetch/src/apis/nonparticipating_api.rs b/crates/algo_fetch/src/apis/nonparticipating_api.rs new file mode 100644 index 0000000..3bcf414 --- /dev/null +++ b/crates/algo_fetch/src/apis/nonparticipating_api.rs @@ -0,0 +1,1482 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + + +use reqwest; +use serde::{Deserialize, Serialize}; +use crate::{apis::ResponseContent, models}; +use super::{Error, configuration}; + + +/// struct for typed errors of method [`abort_catchup`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum AbortCatchupError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status500(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`account_application_information`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum AccountApplicationInformationError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status500(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`account_asset_information`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum AccountAssetInformationError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status500(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`account_information`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum AccountInformationError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status500(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_application_box_by_name`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetApplicationBoxByNameError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status404(models::ErrorResponse), + Status500(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_application_boxes`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetApplicationBoxesError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status500(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_application_by_id`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetApplicationByIdError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status404(models::ErrorResponse), + Status500(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_asset_by_id`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetAssetByIdError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status404(models::ErrorResponse), + Status500(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_block`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetBlockError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status404(models::ErrorResponse), + Status500(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_block_hash`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetBlockHashError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status404(models::ErrorResponse), + Status500(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_block_logs`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetBlockLogsError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status404(models::ErrorResponse), + Status500(models::ErrorResponse), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_block_time_stamp_offset`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetBlockTimeStampOffsetError { + Status400(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_block_txids`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetBlockTxidsError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status404(models::ErrorResponse), + Status500(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_ledger_state_delta`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetLedgerStateDeltaError { + Status401(models::ErrorResponse), + Status404(models::ErrorResponse), + Status408(models::ErrorResponse), + Status500(models::ErrorResponse), + Status503(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_ledger_state_delta_for_transaction_group`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetLedgerStateDeltaForTransactionGroupError { + Status401(models::ErrorResponse), + Status404(models::ErrorResponse), + Status408(models::ErrorResponse), + Status500(models::ErrorResponse), + Status501(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_light_block_header_proof`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetLightBlockHeaderProofError { + Status401(models::ErrorResponse), + Status404(models::ErrorResponse), + Status408(models::ErrorResponse), + Status500(models::ErrorResponse), + Status503(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_state_proof`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetStateProofError { + Status401(models::ErrorResponse), + Status404(models::ErrorResponse), + Status408(models::ErrorResponse), + Status500(models::ErrorResponse), + Status503(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_status`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetStatusError { + Status401(models::ErrorResponse), + Status500(String), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_supply`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetSupplyError { + Status401(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_transaction_group_ledger_state_deltas_for_round`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetTransactionGroupLedgerStateDeltasForRoundError { + Status401(models::ErrorResponse), + Status404(models::ErrorResponse), + Status408(models::ErrorResponse), + Status500(models::ErrorResponse), + Status501(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_transaction_proof`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetTransactionProofError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status404(models::ErrorResponse), + Status500(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`set_block_time_stamp_offset`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum SetBlockTimeStampOffsetError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status500(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`shutdown_node`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ShutdownNodeError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`simulate_transaction`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum SimulateTransactionError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status500(models::ErrorResponse), + Status503(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`start_catchup`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum StartCatchupError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status408(models::ErrorResponse), + Status500(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`teal_compile`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum TealCompileError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status404(), + Status500(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`teal_disassemble`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum TealDisassembleError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status404(), + Status500(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`teal_dryrun`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum TealDryrunError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status404(), + Status500(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`transaction_params`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum TransactionParamsError { + Status401(models::ErrorResponse), + Status500(models::ErrorResponse), + Status503(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`wait_for_block`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum WaitForBlockError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status500(models::ErrorResponse), + Status503(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + + +/// Given a catchpoint, it aborts catching up to this catchpoint +pub async fn abort_catchup(configuration: &configuration::Configuration, catchpoint: &str) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/catchup/{catchpoint}", local_var_configuration.base_path, catchpoint=crate::apis::urlencode(catchpoint)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +/// Given a specific account public key and application ID, this call returns the account's application local state and global state (AppLocalState and AppParams, if either exists). Global state will only be returned if the provided address is the application's creator. +pub async fn account_application_information(configuration: &configuration::Configuration, address: &str, application_id: i32, format: Option<&str>) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/accounts/{address}/applications/{applicationId}", local_var_configuration.base_path, address=crate::apis::urlencode(address), applicationId=application_id); + 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) = format { + local_var_req_builder = local_var_req_builder.query(&[("format", &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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +/// Given a specific account public key and asset ID, this call returns the account's asset holding and asset parameters (if either exist). Asset parameters will only be returned if the provided address is the asset's creator. +pub async fn account_asset_information(configuration: &configuration::Configuration, address: &str, asset_id: i32, format: Option<&str>) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/accounts/{address}/assets/{assetId}", local_var_configuration.base_path, address=crate::apis::urlencode(address), assetId=asset_id); + 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) = format { + local_var_req_builder = local_var_req_builder.query(&[("format", &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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +/// Given a specific account public key, this call returns the accounts status, balance and spendable amounts +pub async fn account_information(configuration: &configuration::Configuration, address: &str, format: Option<&str>, exclude: Option<&str>) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/accounts/{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) = format { + local_var_req_builder = local_var_req_builder.query(&[("format", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = exclude { + local_var_req_builder = local_var_req_builder.query(&[("exclude", &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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +/// Given an application ID and box name, it returns the round, box name, and value (each base64 encoded). Box names must be in the goal app call arg encoding form 'encoding:value'. For ints, use the form 'int:1234'. For raw bytes, use the form 'b64:A=='. For printable strings, use the form 'str:hello'. For addresses, use the form 'addr:XYZ...'. +pub async fn get_application_box_by_name(configuration: &configuration::Configuration, application_id: i32, name: &str) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/applications/{applicationId}/box", local_var_configuration.base_path, applicationId=application_id); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + local_var_req_builder = local_var_req_builder.query(&[("name", &name.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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +/// Given an application ID, return all Box names. No particular ordering is guaranteed. Request fails when client or server-side configured limits prevent returning all Box names. +pub async fn get_application_boxes(configuration: &configuration::Configuration, application_id: i32, max: Option) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/applications/{applicationId}/boxes", local_var_configuration.base_path, applicationId=application_id); + 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) = max { + local_var_req_builder = local_var_req_builder.query(&[("max", &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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +/// Given a application ID, it returns application information including creator, approval and clear programs, global and local schemas, and global state. +pub async fn get_application_by_id(configuration: &configuration::Configuration, application_id: i32) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/applications/{applicationId}", local_var_configuration.base_path, applicationId=application_id); + 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +/// Given a asset ID, it returns asset information including creator, name, total supply and special addresses. +pub async fn get_asset_by_id(configuration: &configuration::Configuration, asset_id: i32) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/assets/{assetId}", local_var_configuration.base_path, assetId=asset_id); + 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +pub async fn get_block(configuration: &configuration::Configuration, round: i32, format: Option<&str>) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/blocks/{round}", local_var_configuration.base_path, round=round); + 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) = format { + local_var_req_builder = local_var_req_builder.query(&[("format", &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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +pub async fn get_block_hash(configuration: &configuration::Configuration, round: i32) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/blocks/{round}/hash", local_var_configuration.base_path, round=round); + 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +/// Get all of the logs from outer and inner app calls in the given round +pub async fn get_block_logs(configuration: &configuration::Configuration, round: i32) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/blocks/{round}/logs", local_var_configuration.base_path, round=round); + 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +/// Gets the current timestamp offset. +pub async fn get_block_time_stamp_offset(configuration: &configuration::Configuration, ) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/devmode/blocks/offset", 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +pub async fn get_block_txids(configuration: &configuration::Configuration, round: i32) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/blocks/{round}/txids", local_var_configuration.base_path, round=round); + 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +/// Get ledger deltas for a round. +pub async fn get_ledger_state_delta(configuration: &configuration::Configuration, round: i32, format: Option<&str>) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/deltas/{round}", local_var_configuration.base_path, round=round); + 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) = format { + local_var_req_builder = local_var_req_builder.query(&[("format", &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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +/// Get a ledger delta for a given transaction group. +pub async fn get_ledger_state_delta_for_transaction_group(configuration: &configuration::Configuration, id: &str, format: Option<&str>) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/deltas/txn/group/{id}", local_var_configuration.base_path, id=crate::apis::urlencode(id)); + 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) = format { + local_var_req_builder = local_var_req_builder.query(&[("format", &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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +pub async fn get_light_block_header_proof(configuration: &configuration::Configuration, round: i32) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/blocks/{round}/lightheader/proof", local_var_configuration.base_path, round=round); + 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +pub async fn get_state_proof(configuration: &configuration::Configuration, round: i32) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/stateproofs/{round}", local_var_configuration.base_path, round=round); + 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +pub async fn get_status(configuration: &configuration::Configuration, ) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/status", 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +pub async fn get_supply(configuration: &configuration::Configuration, ) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/ledger/supply", 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +/// Get ledger deltas for transaction groups in a given round. +pub async fn get_transaction_group_ledger_state_deltas_for_round(configuration: &configuration::Configuration, round: i32, format: Option<&str>) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/deltas/{round}/txn/group", local_var_configuration.base_path, round=round); + 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) = format { + local_var_req_builder = local_var_req_builder.query(&[("format", &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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +pub async fn get_transaction_proof(configuration: &configuration::Configuration, round: i32, txid: &str, hashtype: Option<&str>, format: Option<&str>) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/blocks/{round}/transactions/{txid}/proof", local_var_configuration.base_path, round=round, txid=crate::apis::urlencode(txid)); + 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) = hashtype { + local_var_req_builder = local_var_req_builder.query(&[("hashtype", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = format { + local_var_req_builder = local_var_req_builder.query(&[("format", &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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +/// Sets the timestamp offset (seconds) for blocks in dev mode. Providing an offset of 0 will unset this value and try to use the real clock for the timestamp. +pub async fn set_block_time_stamp_offset(configuration: &configuration::Configuration, offset: i32) -> Result<(), Error> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/devmode/blocks/offset/{offset}", local_var_configuration.base_path, offset=offset); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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() { + Ok(()) + } 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)) + } +} + +/// Special management endpoint to shutdown the node. Optionally provide a timeout parameter to indicate that the node should begin shutting down after a number of seconds. +pub async fn shutdown_node(configuration: &configuration::Configuration, timeout: Option) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/shutdown", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = timeout { + local_var_req_builder = local_var_req_builder.query(&[("timeout", &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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +pub async fn simulate_transaction(configuration: &configuration::Configuration, request: models::SimulateRequest, format: Option<&str>) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/transactions/simulate", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = format { + local_var_req_builder = local_var_req_builder.query(&[("format", &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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + local_var_req_builder = local_var_req_builder.json(&request); + + 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)) + } +} + +/// Given a catchpoint, it starts catching up to this catchpoint +pub async fn start_catchup(configuration: &configuration::Configuration, catchpoint: &str, min: Option) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/catchup/{catchpoint}", local_var_configuration.base_path, catchpoint=crate::apis::urlencode(catchpoint)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = min { + local_var_req_builder = local_var_req_builder.query(&[("min", &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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +/// Given TEAL source code in plain text, return base64 encoded program bytes and base32 SHA512_256 hash of program bytes (Address style). This endpoint is only enabled when a node's configuration file sets EnableDeveloperAPI to true. +pub async fn teal_compile(configuration: &configuration::Configuration, source: std::path::PathBuf, sourcemap: Option) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/teal/compile", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = sourcemap { + local_var_req_builder = local_var_req_builder.query(&[("sourcemap", &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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + local_var_req_builder = local_var_req_builder.json(&source); + + 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)) + } +} + +/// Given the program bytes, return the TEAL source code in plain text. This endpoint is only enabled when a node's configuration file sets EnableDeveloperAPI to true. +pub async fn teal_disassemble(configuration: &configuration::Configuration, source: String) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/teal/disassemble", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + local_var_req_builder = local_var_req_builder.json(&source); + + 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)) + } +} + +/// Executes TEAL program(s) in context and returns debugging information about the execution. This endpoint is only enabled when a node's configuration file sets EnableDeveloperAPI to true. +pub async fn teal_dryrun(configuration: &configuration::Configuration, request: Option) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/teal/dryrun", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + local_var_req_builder = local_var_req_builder.json(&request); + + 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)) + } +} + +pub async fn transaction_params(configuration: &configuration::Configuration, ) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/transactions/params", 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +/// Waits for a block to appear after round {round} and returns the node's status at the time. There is a 1 minute timeout, when reached the current status is returned regardless of whether or not it is the round after the given round. +pub async fn wait_for_block(configuration: &configuration::Configuration, round: i32) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/status/wait-for-block-after/{round}", local_var_configuration.base_path, round=round); + 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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/crates/algo_fetch/src/apis/participating_api.rs b/crates/algo_fetch/src/apis/participating_api.rs new file mode 100644 index 0000000..d5da5e7 --- /dev/null +++ b/crates/algo_fetch/src/apis/participating_api.rs @@ -0,0 +1,517 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + + +use reqwest; +use serde::{Deserialize, Serialize}; +use crate::{apis::ResponseContent, models}; +use super::{Error, configuration}; + + +/// struct for typed errors of method [`add_participation_key`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum AddParticipationKeyError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status404(models::ErrorResponse), + Status500(models::ErrorResponse), + Status503(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`append_keys`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum AppendKeysError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status404(models::ErrorResponse), + Status500(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`delete_participation_key_by_id`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DeleteParticipationKeyByIdError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status404(models::ErrorResponse), + Status500(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`generate_participation_keys`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GenerateParticipationKeysError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status500(models::ErrorResponse), + Status503(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_participation_key_by_id`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetParticipationKeyByIdError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status404(models::ErrorResponse), + Status500(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_participation_keys`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetParticipationKeysError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status404(models::ErrorResponse), + Status500(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_pending_transactions`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetPendingTransactionsError { + Status401(models::ErrorResponse), + Status500(models::ErrorResponse), + Status503(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_pending_transactions_by_address`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetPendingTransactionsByAddressError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status500(models::ErrorResponse), + Status503(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`pending_transaction_information`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum PendingTransactionInformationError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status404(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`raw_transaction`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum RawTransactionError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status500(models::ErrorResponse), + Status503(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + + +pub async fn add_participation_key(configuration: &configuration::Configuration, participationkey: std::path::PathBuf) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/participation", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + local_var_req_builder = local_var_req_builder.json(&participationkey); + + 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)) + } +} + +/// Given a participation ID, append state proof keys to a particular set of participation keys +pub async fn append_keys(configuration: &configuration::Configuration, participation_id: &str, keymap: std::path::PathBuf) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/participation/{participationId}", local_var_configuration.base_path, participationId=crate::apis::urlencode(participation_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + local_var_req_builder = local_var_req_builder.json(&keymap); + + 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)) + } +} + +/// Delete a given participation key by ID +pub async fn delete_participation_key_by_id(configuration: &configuration::Configuration, participation_id: &str) -> Result<(), Error> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/participation/{participationId}", local_var_configuration.base_path, participationId=crate::apis::urlencode(participation_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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() { + Ok(()) + } 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)) + } +} + +pub async fn generate_participation_keys(configuration: &configuration::Configuration, address: &str, first: i32, last: i32, dilution: Option) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/participation/generate/{address}", local_var_configuration.base_path, address=crate::apis::urlencode(address)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = dilution { + local_var_req_builder = local_var_req_builder.query(&[("dilution", &local_var_str.to_string())]); + } + local_var_req_builder = local_var_req_builder.query(&[("first", &first.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("last", &last.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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +/// Given a participation ID, return information about that participation key +pub async fn get_participation_key_by_id(configuration: &configuration::Configuration, participation_id: &str) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/participation/{participationId}", local_var_configuration.base_path, participationId=crate::apis::urlencode(participation_id)); + 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +/// Return a list of participation keys +pub async fn get_participation_keys(configuration: &configuration::Configuration, ) -> Result, Error> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/participation", 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +/// Get the list of pending transactions, sorted by priority, in decreasing order, truncated at the end at MAX. If MAX = 0, returns all pending transactions. +pub async fn get_pending_transactions(configuration: &configuration::Configuration, max: Option, format: Option<&str>) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/transactions/pending", 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) = max { + local_var_req_builder = local_var_req_builder.query(&[("max", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = format { + local_var_req_builder = local_var_req_builder.query(&[("format", &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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +/// Get the list of pending transactions by address, sorted by priority, in decreasing order, truncated at the end at MAX. If MAX = 0, returns all pending transactions. +pub async fn get_pending_transactions_by_address(configuration: &configuration::Configuration, address: &str, max: Option, format: Option<&str>) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/accounts/{address}/transactions/pending", 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) = max { + local_var_req_builder = local_var_req_builder.query(&[("max", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = format { + local_var_req_builder = local_var_req_builder.query(&[("format", &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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +/// Given a transaction ID of a recently submitted transaction, it returns information about it. There are several cases when this might succeed: - transaction committed (committed round > 0) - transaction still in the pool (committed round = 0, pool error = \"\") - transaction removed from pool due to error (committed round = 0, pool error != \"\") Or the transaction may have happened sufficiently long ago that the node no longer remembers it, and this will return an error. +pub async fn pending_transaction_information(configuration: &configuration::Configuration, txid: &str, format: Option<&str>) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/transactions/pending/{txid}", local_var_configuration.base_path, txid=crate::apis::urlencode(txid)); + 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) = format { + local_var_req_builder = local_var_req_builder.query(&[("format", &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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +pub async fn raw_transaction(configuration: &configuration::Configuration, rawtxn: std::path::PathBuf) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/transactions", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + local_var_req_builder = local_var_req_builder.json(&rawtxn); + + 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/crates/algo_fetch/src/apis/private_api.rs b/crates/algo_fetch/src/apis/private_api.rs new file mode 100644 index 0000000..740142a --- /dev/null +++ b/crates/algo_fetch/src/apis/private_api.rs @@ -0,0 +1,586 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + + +use reqwest; +use serde::{Deserialize, Serialize}; +use crate::{apis::ResponseContent, models}; +use super::{Error, configuration}; + + +/// struct for typed errors of method [`abort_catchup`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum AbortCatchupError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status500(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`add_participation_key`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum AddParticipationKeyError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status404(models::ErrorResponse), + Status500(models::ErrorResponse), + Status503(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`append_keys`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum AppendKeysError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status404(models::ErrorResponse), + Status500(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`delete_participation_key_by_id`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DeleteParticipationKeyByIdError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status404(models::ErrorResponse), + Status500(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`generate_participation_keys`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GenerateParticipationKeysError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status500(models::ErrorResponse), + Status503(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_config`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetConfigError { + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_debug_settings_prof`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetDebugSettingsProfError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_participation_key_by_id`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetParticipationKeyByIdError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status404(models::ErrorResponse), + Status500(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_participation_keys`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetParticipationKeysError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status404(models::ErrorResponse), + Status500(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`put_debug_settings_prof`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum PutDebugSettingsProfError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`shutdown_node`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ShutdownNodeError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`start_catchup`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum StartCatchupError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status408(models::ErrorResponse), + Status500(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + + +/// Given a catchpoint, it aborts catching up to this catchpoint +pub async fn abort_catchup(configuration: &configuration::Configuration, catchpoint: &str) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/catchup/{catchpoint}", local_var_configuration.base_path, catchpoint=crate::apis::urlencode(catchpoint)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +pub async fn add_participation_key(configuration: &configuration::Configuration, participationkey: std::path::PathBuf) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/participation", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + local_var_req_builder = local_var_req_builder.json(&participationkey); + + 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)) + } +} + +/// Given a participation ID, append state proof keys to a particular set of participation keys +pub async fn append_keys(configuration: &configuration::Configuration, participation_id: &str, keymap: std::path::PathBuf) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/participation/{participationId}", local_var_configuration.base_path, participationId=crate::apis::urlencode(participation_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + local_var_req_builder = local_var_req_builder.json(&keymap); + + 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)) + } +} + +/// Delete a given participation key by ID +pub async fn delete_participation_key_by_id(configuration: &configuration::Configuration, participation_id: &str) -> Result<(), Error> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/participation/{participationId}", local_var_configuration.base_path, participationId=crate::apis::urlencode(participation_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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() { + Ok(()) + } 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)) + } +} + +pub async fn generate_participation_keys(configuration: &configuration::Configuration, address: &str, first: i32, last: i32, dilution: Option) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/participation/generate/{address}", local_var_configuration.base_path, address=crate::apis::urlencode(address)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = dilution { + local_var_req_builder = local_var_req_builder.query(&[("dilution", &local_var_str.to_string())]); + } + local_var_req_builder = local_var_req_builder.query(&[("first", &first.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("last", &last.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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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 merged (defaults + overrides) config file in json. +pub async fn get_config(configuration: &configuration::Configuration, ) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/debug/settings/config", 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +/// Retrieves the current settings for blocking and mutex profiles +pub async fn get_debug_settings_prof(configuration: &configuration::Configuration, ) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/debug/settings/pprof", 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +/// Given a participation ID, return information about that participation key +pub async fn get_participation_key_by_id(configuration: &configuration::Configuration, participation_id: &str) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/participation/{participationId}", local_var_configuration.base_path, participationId=crate::apis::urlencode(participation_id)); + 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +/// Return a list of participation keys +pub async fn get_participation_keys(configuration: &configuration::Configuration, ) -> Result, Error> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/participation", 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +/// Enables blocking and mutex profiles, and returns the old settings +pub async fn put_debug_settings_prof(configuration: &configuration::Configuration, ) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/debug/settings/pprof", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +/// Special management endpoint to shutdown the node. Optionally provide a timeout parameter to indicate that the node should begin shutting down after a number of seconds. +pub async fn shutdown_node(configuration: &configuration::Configuration, timeout: Option) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/shutdown", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = timeout { + local_var_req_builder = local_var_req_builder.query(&[("timeout", &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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +/// Given a catchpoint, it starts catching up to this catchpoint +pub async fn start_catchup(configuration: &configuration::Configuration, catchpoint: &str, min: Option) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/catchup/{catchpoint}", local_var_configuration.base_path, catchpoint=crate::apis::urlencode(catchpoint)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = min { + local_var_req_builder = local_var_req_builder.query(&[("min", &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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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/crates/algo_fetch/src/apis/public_api.rs b/crates/algo_fetch/src/apis/public_api.rs new file mode 100644 index 0000000..313625c --- /dev/null +++ b/crates/algo_fetch/src/apis/public_api.rs @@ -0,0 +1,2095 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + + +use reqwest; +use serde::{Deserialize, Serialize}; +use crate::{apis::ResponseContent, models}; +use super::{Error, configuration}; + + +/// struct for typed errors of method [`account_application_information`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum AccountApplicationInformationError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status500(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`account_asset_information`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum AccountAssetInformationError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status500(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`account_assets_information`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum AccountAssetsInformationError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status500(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`account_information`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum AccountInformationError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status500(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`experimental_check`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ExperimentalCheckError { + Status404(), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_application_box_by_name`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetApplicationBoxByNameError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status404(models::ErrorResponse), + Status500(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_application_boxes`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetApplicationBoxesError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status500(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_application_by_id`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetApplicationByIdError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status404(models::ErrorResponse), + Status500(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_asset_by_id`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetAssetByIdError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status404(models::ErrorResponse), + Status500(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_block`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetBlockError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status404(models::ErrorResponse), + Status500(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_block_hash`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetBlockHashError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status404(models::ErrorResponse), + Status500(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_block_logs`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetBlockLogsError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status404(models::ErrorResponse), + Status500(models::ErrorResponse), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_block_time_stamp_offset`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetBlockTimeStampOffsetError { + Status400(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_block_txids`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetBlockTxidsError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status404(models::ErrorResponse), + Status500(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_genesis`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetGenesisError { + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_ledger_state_delta`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetLedgerStateDeltaError { + Status401(models::ErrorResponse), + Status404(models::ErrorResponse), + Status408(models::ErrorResponse), + Status500(models::ErrorResponse), + Status503(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_ledger_state_delta_for_transaction_group`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetLedgerStateDeltaForTransactionGroupError { + Status401(models::ErrorResponse), + Status404(models::ErrorResponse), + Status408(models::ErrorResponse), + Status500(models::ErrorResponse), + Status501(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_light_block_header_proof`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetLightBlockHeaderProofError { + Status401(models::ErrorResponse), + Status404(models::ErrorResponse), + Status408(models::ErrorResponse), + Status500(models::ErrorResponse), + Status503(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_pending_transactions`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetPendingTransactionsError { + Status401(models::ErrorResponse), + Status500(models::ErrorResponse), + Status503(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_pending_transactions_by_address`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetPendingTransactionsByAddressError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status500(models::ErrorResponse), + Status503(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_ready`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetReadyError { + Status500(), + Status503(), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_state_proof`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetStateProofError { + Status401(models::ErrorResponse), + Status404(models::ErrorResponse), + Status408(models::ErrorResponse), + Status500(models::ErrorResponse), + Status503(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_status`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetStatusError { + Status401(models::ErrorResponse), + Status500(String), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_supply`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetSupplyError { + Status401(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_sync_round`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetSyncRoundError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status500(models::ErrorResponse), + Status503(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_transaction_group_ledger_state_deltas_for_round`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetTransactionGroupLedgerStateDeltasForRoundError { + Status401(models::ErrorResponse), + Status404(models::ErrorResponse), + Status408(models::ErrorResponse), + Status500(models::ErrorResponse), + Status501(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_transaction_proof`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetTransactionProofError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status404(models::ErrorResponse), + Status500(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_version`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetVersionError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`health_check`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum HealthCheckError { + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`metrics`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum MetricsError { + Status404(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`pending_transaction_information`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum PendingTransactionInformationError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status404(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`raw_transaction`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum RawTransactionError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status500(models::ErrorResponse), + Status503(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`raw_transaction_async`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum RawTransactionAsyncError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status404(), + Status500(models::ErrorResponse), + Status503(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`set_block_time_stamp_offset`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum SetBlockTimeStampOffsetError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status500(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`set_sync_round`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum SetSyncRoundError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status500(models::ErrorResponse), + Status503(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`simulate_transaction`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum SimulateTransactionError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status500(models::ErrorResponse), + Status503(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`swagger_json`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum SwaggerJsonError { + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`teal_compile`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum TealCompileError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status404(), + Status500(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`teal_disassemble`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum TealDisassembleError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status404(), + Status500(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`teal_dryrun`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum TealDryrunError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status404(), + Status500(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`transaction_params`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum TransactionParamsError { + Status401(models::ErrorResponse), + Status500(models::ErrorResponse), + Status503(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`unset_sync_round`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum UnsetSyncRoundError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status500(models::ErrorResponse), + Status503(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`wait_for_block`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum WaitForBlockError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status500(models::ErrorResponse), + Status503(models::ErrorResponse), + DefaultResponse(), + UnknownValue(serde_json::Value), +} + + +/// Given a specific account public key and application ID, this call returns the account's application local state and global state (AppLocalState and AppParams, if either exists). Global state will only be returned if the provided address is the application's creator. +pub async fn account_application_information(configuration: &configuration::Configuration, address: &str, application_id: i32, format: Option<&str>) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/accounts/{address}/applications/{applicationId}", local_var_configuration.base_path, address=crate::apis::urlencode(address), applicationId=application_id); + 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) = format { + local_var_req_builder = local_var_req_builder.query(&[("format", &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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +/// Given a specific account public key and asset ID, this call returns the account's asset holding and asset parameters (if either exist). Asset parameters will only be returned if the provided address is the asset's creator. +pub async fn account_asset_information(configuration: &configuration::Configuration, address: &str, asset_id: i32, format: Option<&str>) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/accounts/{address}/assets/{assetId}", local_var_configuration.base_path, address=crate::apis::urlencode(address), assetId=asset_id); + 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) = format { + local_var_req_builder = local_var_req_builder.query(&[("format", &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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +/// Lookup an account's asset holdings. +pub async fn account_assets_information(configuration: &configuration::Configuration, address: &str, limit: Option, next: Option<&str>) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/accounts/{address}/assets", 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) = limit { + local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = next { + local_var_req_builder = local_var_req_builder.query(&[("next", &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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +/// Given a specific account public key, this call returns the accounts status, balance and spendable amounts +pub async fn account_information(configuration: &configuration::Configuration, address: &str, format: Option<&str>, exclude: Option<&str>) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/accounts/{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) = format { + local_var_req_builder = local_var_req_builder.query(&[("format", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = exclude { + local_var_req_builder = local_var_req_builder.query(&[("exclude", &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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +pub async fn experimental_check(configuration: &configuration::Configuration, ) -> Result<(), Error> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/experimental", 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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() { + Ok(()) + } 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)) + } +} + +/// Given an application ID and box name, it returns the round, box name, and value (each base64 encoded). Box names must be in the goal app call arg encoding form 'encoding:value'. For ints, use the form 'int:1234'. For raw bytes, use the form 'b64:A=='. For printable strings, use the form 'str:hello'. For addresses, use the form 'addr:XYZ...'. +pub async fn get_application_box_by_name(configuration: &configuration::Configuration, application_id: i32, name: &str) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/applications/{applicationId}/box", local_var_configuration.base_path, applicationId=application_id); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + local_var_req_builder = local_var_req_builder.query(&[("name", &name.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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +/// Given an application ID, return all Box names. No particular ordering is guaranteed. Request fails when client or server-side configured limits prevent returning all Box names. +pub async fn get_application_boxes(configuration: &configuration::Configuration, application_id: i32, max: Option) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/applications/{applicationId}/boxes", local_var_configuration.base_path, applicationId=application_id); + 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) = max { + local_var_req_builder = local_var_req_builder.query(&[("max", &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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +/// Given a application ID, it returns application information including creator, approval and clear programs, global and local schemas, and global state. +pub async fn get_application_by_id(configuration: &configuration::Configuration, application_id: i32) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/applications/{applicationId}", local_var_configuration.base_path, applicationId=application_id); + 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +/// Given a asset ID, it returns asset information including creator, name, total supply and special addresses. +pub async fn get_asset_by_id(configuration: &configuration::Configuration, asset_id: i32) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/assets/{assetId}", local_var_configuration.base_path, assetId=asset_id); + 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +pub async fn get_block(configuration: &configuration::Configuration, round: i32, format: Option<&str>) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/blocks/{round}", local_var_configuration.base_path, round=round); + 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) = format { + local_var_req_builder = local_var_req_builder.query(&[("format", &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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +pub async fn get_block_hash(configuration: &configuration::Configuration, round: i32) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/blocks/{round}/hash", local_var_configuration.base_path, round=round); + 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +/// Get all of the logs from outer and inner app calls in the given round +pub async fn get_block_logs(configuration: &configuration::Configuration, round: i32) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/blocks/{round}/logs", local_var_configuration.base_path, round=round); + 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +/// Gets the current timestamp offset. +pub async fn get_block_time_stamp_offset(configuration: &configuration::Configuration, ) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/devmode/blocks/offset", 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +pub async fn get_block_txids(configuration: &configuration::Configuration, round: i32) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/blocks/{round}/txids", local_var_configuration.base_path, round=round); + 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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 entire genesis file in json. +pub async fn get_genesis(configuration: &configuration::Configuration, ) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/genesis", 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +/// Get ledger deltas for a round. +pub async fn get_ledger_state_delta(configuration: &configuration::Configuration, round: i32, format: Option<&str>) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/deltas/{round}", local_var_configuration.base_path, round=round); + 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) = format { + local_var_req_builder = local_var_req_builder.query(&[("format", &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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +/// Get a ledger delta for a given transaction group. +pub async fn get_ledger_state_delta_for_transaction_group(configuration: &configuration::Configuration, id: &str, format: Option<&str>) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/deltas/txn/group/{id}", local_var_configuration.base_path, id=crate::apis::urlencode(id)); + 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) = format { + local_var_req_builder = local_var_req_builder.query(&[("format", &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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +pub async fn get_light_block_header_proof(configuration: &configuration::Configuration, round: i32) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/blocks/{round}/lightheader/proof", local_var_configuration.base_path, round=round); + 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +/// Get the list of pending transactions, sorted by priority, in decreasing order, truncated at the end at MAX. If MAX = 0, returns all pending transactions. +pub async fn get_pending_transactions(configuration: &configuration::Configuration, max: Option, format: Option<&str>) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/transactions/pending", 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) = max { + local_var_req_builder = local_var_req_builder.query(&[("max", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = format { + local_var_req_builder = local_var_req_builder.query(&[("format", &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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +/// Get the list of pending transactions by address, sorted by priority, in decreasing order, truncated at the end at MAX. If MAX = 0, returns all pending transactions. +pub async fn get_pending_transactions_by_address(configuration: &configuration::Configuration, address: &str, max: Option, format: Option<&str>) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/accounts/{address}/transactions/pending", 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) = max { + local_var_req_builder = local_var_req_builder.query(&[("max", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = format { + local_var_req_builder = local_var_req_builder.query(&[("format", &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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +pub async fn get_ready(configuration: &configuration::Configuration, ) -> Result<(), Error> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/ready", 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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() { + Ok(()) + } 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)) + } +} + +pub async fn get_state_proof(configuration: &configuration::Configuration, round: i32) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/stateproofs/{round}", local_var_configuration.base_path, round=round); + 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +pub async fn get_status(configuration: &configuration::Configuration, ) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/status", 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +pub async fn get_supply(configuration: &configuration::Configuration, ) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/ledger/supply", 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +/// Gets the minimum sync round for the ledger. +pub async fn get_sync_round(configuration: &configuration::Configuration, ) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/ledger/sync", 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +/// Get ledger deltas for transaction groups in a given round. +pub async fn get_transaction_group_ledger_state_deltas_for_round(configuration: &configuration::Configuration, round: i32, format: Option<&str>) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/deltas/{round}/txn/group", local_var_configuration.base_path, round=round); + 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) = format { + local_var_req_builder = local_var_req_builder.query(&[("format", &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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +pub async fn get_transaction_proof(configuration: &configuration::Configuration, round: i32, txid: &str, hashtype: Option<&str>, format: Option<&str>) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/blocks/{round}/transactions/{txid}/proof", local_var_configuration.base_path, round=round, txid=crate::apis::urlencode(txid)); + 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) = hashtype { + local_var_req_builder = local_var_req_builder.query(&[("hashtype", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = format { + local_var_req_builder = local_var_req_builder.query(&[("format", &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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +/// Retrieves the supported API versions, binary build versions, and genesis information. +pub async fn get_version(configuration: &configuration::Configuration, ) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/versions", 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +pub async fn health_check(configuration: &configuration::Configuration, ) -> Result<(), Error> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/health", 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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() { + Ok(()) + } 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)) + } +} + +pub async fn metrics(configuration: &configuration::Configuration, ) -> Result<(), Error> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/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_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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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() { + Ok(()) + } 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)) + } +} + +/// Given a transaction ID of a recently submitted transaction, it returns information about it. There are several cases when this might succeed: - transaction committed (committed round > 0) - transaction still in the pool (committed round = 0, pool error = \"\") - transaction removed from pool due to error (committed round = 0, pool error != \"\") Or the transaction may have happened sufficiently long ago that the node no longer remembers it, and this will return an error. +pub async fn pending_transaction_information(configuration: &configuration::Configuration, txid: &str, format: Option<&str>) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/transactions/pending/{txid}", local_var_configuration.base_path, txid=crate::apis::urlencode(txid)); + 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) = format { + local_var_req_builder = local_var_req_builder.query(&[("format", &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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +pub async fn raw_transaction(configuration: &configuration::Configuration, rawtxn: std::path::PathBuf) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/transactions", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + local_var_req_builder = local_var_req_builder.json(&rawtxn); + + 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)) + } +} + +pub async fn raw_transaction_async(configuration: &configuration::Configuration, rawtxn: std::path::PathBuf) -> Result<(), Error> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/transactions/async", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + local_var_req_builder = local_var_req_builder.json(&rawtxn); + + 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() { + Ok(()) + } 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)) + } +} + +/// Sets the timestamp offset (seconds) for blocks in dev mode. Providing an offset of 0 will unset this value and try to use the real clock for the timestamp. +pub async fn set_block_time_stamp_offset(configuration: &configuration::Configuration, offset: i32) -> Result<(), Error> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/devmode/blocks/offset/{offset}", local_var_configuration.base_path, offset=offset); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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() { + Ok(()) + } 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)) + } +} + +/// Sets the minimum sync round on the ledger. +pub async fn set_sync_round(configuration: &configuration::Configuration, round: i32) -> Result<(), Error> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/ledger/sync/{round}", local_var_configuration.base_path, round=round); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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() { + Ok(()) + } 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)) + } +} + +pub async fn simulate_transaction(configuration: &configuration::Configuration, request: models::SimulateRequest, format: Option<&str>) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/transactions/simulate", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = format { + local_var_req_builder = local_var_req_builder.query(&[("format", &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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + local_var_req_builder = local_var_req_builder.json(&request); + + 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 entire swagger spec in json. +pub async fn swagger_json(configuration: &configuration::Configuration, ) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/swagger.json", 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +/// Given TEAL source code in plain text, return base64 encoded program bytes and base32 SHA512_256 hash of program bytes (Address style). This endpoint is only enabled when a node's configuration file sets EnableDeveloperAPI to true. +pub async fn teal_compile(configuration: &configuration::Configuration, source: std::path::PathBuf, sourcemap: Option) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/teal/compile", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = sourcemap { + local_var_req_builder = local_var_req_builder.query(&[("sourcemap", &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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + local_var_req_builder = local_var_req_builder.json(&source); + + 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)) + } +} + +/// Given the program bytes, return the TEAL source code in plain text. This endpoint is only enabled when a node's configuration file sets EnableDeveloperAPI to true. +pub async fn teal_disassemble(configuration: &configuration::Configuration, source: String) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/teal/disassemble", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + local_var_req_builder = local_var_req_builder.json(&source); + + 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)) + } +} + +/// Executes TEAL program(s) in context and returns debugging information about the execution. This endpoint is only enabled when a node's configuration file sets EnableDeveloperAPI to true. +pub async fn teal_dryrun(configuration: &configuration::Configuration, request: Option) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/teal/dryrun", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + local_var_req_builder = local_var_req_builder.json(&request); + + 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)) + } +} + +pub async fn transaction_params(configuration: &configuration::Configuration, ) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/transactions/params", 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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)) + } +} + +/// Unset the ledger sync round. +pub async fn unset_sync_round(configuration: &configuration::Configuration, ) -> Result<(), Error> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/ledger/sync", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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() { + Ok(()) + } 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)) + } +} + +/// Waits for a block to appear after round {round} and returns the node's status at the time. There is a 1 minute timeout, when reached the current status is returned regardless of whether or not it is the round after the given round. +pub async fn wait_for_block(configuration: &configuration::Configuration, round: i32) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v2/status/wait-for-block-after/{round}", local_var_configuration.base_path, round=round); + 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("X-Algo-API-Token", local_var_value); + }; + + 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/crates/algo_fetch/src/lib.rs b/crates/algo_fetch/src/lib.rs new file mode 100644 index 0000000..e152062 --- /dev/null +++ b/crates/algo_fetch/src/lib.rs @@ -0,0 +1,11 @@ +#![allow(unused_imports)] +#![allow(clippy::too_many_arguments)] + +extern crate serde_repr; +extern crate serde; +extern crate serde_json; +extern crate url; +extern crate reqwest; + +pub mod apis; +pub mod models; diff --git a/crates/algo_fetch/src/models/abort_catchup_200_response.rs b/crates/algo_fetch/src/models/abort_catchup_200_response.rs new file mode 100644 index 0000000..7acb3e2 --- /dev/null +++ b/crates/algo_fetch/src/models/abort_catchup_200_response.rs @@ -0,0 +1,30 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// AbortCatchup200Response : An catchpoint abort response. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct AbortCatchup200Response { + /// Catchup abort response string + #[serde(rename = "catchup-message")] + pub catchup_message: String, +} + +impl AbortCatchup200Response { + /// An catchpoint abort response. + pub fn new(catchup_message: String) -> AbortCatchup200Response { + AbortCatchup200Response { + catchup_message, + } + } +} + diff --git a/crates/algo_fetch/src/models/account.rs b/crates/algo_fetch/src/models/account.rs new file mode 100644 index 0000000..30e1b69 --- /dev/null +++ b/crates/algo_fetch/src/models/account.rs @@ -0,0 +1,148 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// Account : Account information at a given round. Definition: data/basics/userBalance.go : AccountData +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct Account { + /// the account public key + #[serde(rename = "address")] + pub address: String, + /// \\[algo\\] total number of MicroAlgos in the account + #[serde(rename = "amount")] + pub amount: i32, + /// specifies the amount of MicroAlgos in the account, without the pending rewards. + #[serde(rename = "amount-without-pending-rewards")] + pub amount_without_pending_rewards: i32, + /// \\[appl\\] applications local data stored in this account. Note the raw object uses `map[int] -> AppLocalState` for this type. + #[serde(rename = "apps-local-state", skip_serializing_if = "Option::is_none")] + pub apps_local_state: Option>, + /// \\[teap\\] the sum of all extra application program pages for this account. + #[serde(rename = "apps-total-extra-pages", skip_serializing_if = "Option::is_none")] + pub apps_total_extra_pages: Option, + #[serde(rename = "apps-total-schema", skip_serializing_if = "Option::is_none")] + pub apps_total_schema: Option>, + /// \\[asset\\] assets held by this account. Note the raw object uses `map[int] -> AssetHolding` for this type. + #[serde(rename = "assets", skip_serializing_if = "Option::is_none")] + pub assets: Option>, + /// \\[spend\\] the address against which signing should be checked. If empty, the address of the current account is used. This field can be updated in any transaction by setting the RekeyTo field. + #[serde(rename = "auth-addr", skip_serializing_if = "Option::is_none")] + pub auth_addr: Option, + /// \\[appp\\] parameters of applications created by this account including app global data. Note: the raw account uses `map[int] -> AppParams` for this type. + #[serde(rename = "created-apps", skip_serializing_if = "Option::is_none")] + pub created_apps: Option>, + /// \\[apar\\] parameters of assets created by this account. Note: the raw account uses `map[int] -> Asset` for this type. + #[serde(rename = "created-assets", skip_serializing_if = "Option::is_none")] + pub created_assets: Option>, + /// Whether or not the account can receive block incentives if its balance is in range at proposal time. + #[serde(rename = "incentive-eligible", skip_serializing_if = "Option::is_none")] + pub incentive_eligible: Option, + /// The round in which this account last went online, or explicitly renewed their online status. + #[serde(rename = "last-heartbeat", skip_serializing_if = "Option::is_none")] + pub last_heartbeat: Option, + /// The round in which this account last proposed the block. + #[serde(rename = "last-proposed", skip_serializing_if = "Option::is_none")] + pub last_proposed: Option, + /// MicroAlgo balance required by the account. The requirement grows based on asset and application usage. + #[serde(rename = "min-balance")] + pub min_balance: i32, + #[serde(rename = "participation", skip_serializing_if = "Option::is_none")] + pub participation: Option>, + /// amount of MicroAlgos of pending rewards in this account. + #[serde(rename = "pending-rewards")] + pub pending_rewards: i32, + /// \\[ebase\\] used as part of the rewards computation. Only applicable to accounts which are participating. + #[serde(rename = "reward-base", skip_serializing_if = "Option::is_none")] + pub reward_base: Option, + /// \\[ern\\] total rewards of MicroAlgos the account has received, including pending rewards. + #[serde(rename = "rewards")] + pub rewards: i32, + /// The round for which this information is relevant. + #[serde(rename = "round")] + pub round: i32, + /// Indicates what type of signature is used by this account, must be one of: * sig * msig * lsig + #[serde(rename = "sig-type", skip_serializing_if = "Option::is_none")] + pub sig_type: Option, + /// \\[onl\\] delegation status of the account's MicroAlgos * Offline - indicates that the associated account is delegated. * Online - indicates that the associated account used as part of the delegation pool. * NotParticipating - indicates that the associated account is neither a delegator nor a delegate. + #[serde(rename = "status")] + pub status: String, + /// The count of all applications that have been opted in, equivalent to the count of application local data (AppLocalState objects) stored in this account. + #[serde(rename = "total-apps-opted-in")] + pub total_apps_opted_in: i32, + /// The count of all assets that have been opted in, equivalent to the count of AssetHolding objects held by this account. + #[serde(rename = "total-assets-opted-in")] + pub total_assets_opted_in: i32, + /// \\[tbxb\\] The total number of bytes used by this account's app's box keys and values. + #[serde(rename = "total-box-bytes", skip_serializing_if = "Option::is_none")] + pub total_box_bytes: Option, + /// \\[tbx\\] The number of existing boxes created by this account's app. + #[serde(rename = "total-boxes", skip_serializing_if = "Option::is_none")] + pub total_boxes: Option, + /// The count of all apps (AppParams objects) created by this account. + #[serde(rename = "total-created-apps")] + pub total_created_apps: i32, + /// The count of all assets (AssetParams objects) created by this account. + #[serde(rename = "total-created-assets")] + pub total_created_assets: i32, +} + +impl Account { + /// Account information at a given round. Definition: data/basics/userBalance.go : AccountData + pub fn new(address: String, amount: i32, amount_without_pending_rewards: i32, min_balance: i32, pending_rewards: i32, rewards: i32, round: i32, status: String, total_apps_opted_in: i32, total_assets_opted_in: i32, total_created_apps: i32, total_created_assets: i32) -> Account { + Account { + address, + amount, + amount_without_pending_rewards, + apps_local_state: None, + apps_total_extra_pages: None, + apps_total_schema: None, + assets: None, + auth_addr: None, + created_apps: None, + created_assets: None, + incentive_eligible: None, + last_heartbeat: None, + last_proposed: None, + min_balance, + participation: None, + pending_rewards, + reward_base: None, + rewards, + round, + sig_type: None, + status, + total_apps_opted_in, + total_assets_opted_in, + total_box_bytes: None, + total_boxes: None, + total_created_apps, + total_created_assets, + } + } +} +/// Indicates what type of signature is used by this account, must be one of: * sig * msig * lsig +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum SigType { + #[serde(rename = "sig")] + Sig, + #[serde(rename = "msig")] + Msig, + #[serde(rename = "lsig")] + Lsig, +} + +impl Default for SigType { + fn default() -> SigType { + Self::Sig + } +} + diff --git a/crates/algo_fetch/src/models/account_application_information_200_response.rs b/crates/algo_fetch/src/models/account_application_information_200_response.rs new file mode 100644 index 0000000..9f08c70 --- /dev/null +++ b/crates/algo_fetch/src/models/account_application_information_200_response.rs @@ -0,0 +1,34 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct AccountApplicationInformation200Response { + #[serde(rename = "app-local-state", skip_serializing_if = "Option::is_none")] + pub app_local_state: Option>, + #[serde(rename = "created-app", skip_serializing_if = "Option::is_none")] + pub created_app: Option>, + /// The round for which this information is relevant. + #[serde(rename = "round")] + pub round: i32, +} + +impl AccountApplicationInformation200Response { + pub fn new(round: i32) -> AccountApplicationInformation200Response { + AccountApplicationInformation200Response { + app_local_state: None, + created_app: None, + round, + } + } +} + diff --git a/crates/algo_fetch/src/models/account_asset_holding.rs b/crates/algo_fetch/src/models/account_asset_holding.rs new file mode 100644 index 0000000..a08dc79 --- /dev/null +++ b/crates/algo_fetch/src/models/account_asset_holding.rs @@ -0,0 +1,32 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// AccountAssetHolding : AccountAssetHolding describes the account's asset holding and asset parameters (if either exist) for a specific asset ID. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct AccountAssetHolding { + #[serde(rename = "asset-holding")] + pub asset_holding: Box, + #[serde(rename = "asset-params", skip_serializing_if = "Option::is_none")] + pub asset_params: Option>, +} + +impl AccountAssetHolding { + /// AccountAssetHolding describes the account's asset holding and asset parameters (if either exist) for a specific asset ID. + pub fn new(asset_holding: models::AssetHolding) -> AccountAssetHolding { + AccountAssetHolding { + asset_holding: Box::new(asset_holding), + asset_params: None, + } + } +} + diff --git a/crates/algo_fetch/src/models/account_asset_information_200_response.rs b/crates/algo_fetch/src/models/account_asset_information_200_response.rs new file mode 100644 index 0000000..cd05c8c --- /dev/null +++ b/crates/algo_fetch/src/models/account_asset_information_200_response.rs @@ -0,0 +1,34 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct AccountAssetInformation200Response { + #[serde(rename = "asset-holding", skip_serializing_if = "Option::is_none")] + pub asset_holding: Option>, + #[serde(rename = "created-asset", skip_serializing_if = "Option::is_none")] + pub created_asset: Option>, + /// The round for which this information is relevant. + #[serde(rename = "round")] + pub round: i32, +} + +impl AccountAssetInformation200Response { + pub fn new(round: i32) -> AccountAssetInformation200Response { + AccountAssetInformation200Response { + asset_holding: None, + created_asset: None, + round, + } + } +} + diff --git a/crates/algo_fetch/src/models/account_assets_information_200_response.rs b/crates/algo_fetch/src/models/account_assets_information_200_response.rs new file mode 100644 index 0000000..33ad430 --- /dev/null +++ b/crates/algo_fetch/src/models/account_assets_information_200_response.rs @@ -0,0 +1,35 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct AccountAssetsInformation200Response { + #[serde(rename = "asset-holdings", skip_serializing_if = "Option::is_none")] + pub asset_holdings: Option>, + /// Used for pagination, when making another request provide this token with the next parameter. + #[serde(rename = "next-token", skip_serializing_if = "Option::is_none")] + pub next_token: Option, + /// The round for which this information is relevant. + #[serde(rename = "round")] + pub round: i32, +} + +impl AccountAssetsInformation200Response { + pub fn new(round: i32) -> AccountAssetsInformation200Response { + AccountAssetsInformation200Response { + asset_holdings: None, + next_token: None, + round, + } + } +} + diff --git a/crates/algo_fetch/src/models/account_participation.rs b/crates/algo_fetch/src/models/account_participation.rs new file mode 100644 index 0000000..2984e1c --- /dev/null +++ b/crates/algo_fetch/src/models/account_participation.rs @@ -0,0 +1,56 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +use serde_with::serde_as; + +/// AccountParticipation : AccountParticipation describes the parameters used by this account in consensus protocol. +#[serde_as] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct AccountParticipation { + /// \\[sel\\] Selection public key (if any) currently registered for this round. + #[serde_as(as = "serde_with::base64::Base64")] + #[serde(rename = "selection-participation-key")] + pub selection_participation_key: Vec, + /// \\[stprf\\] Root of the state proof key (if any) + #[serde_as(as = "Option")] + #[serde(rename = "state-proof-key", skip_serializing_if = "Option::is_none")] + pub state_proof_key: Option>, + /// \\[voteFst\\] First round for which this participation is valid. + #[serde(rename = "vote-first-valid")] + pub vote_first_valid: i32, + /// \\[voteKD\\] Number of subkeys in each batch of participation keys. + #[serde(rename = "vote-key-dilution")] + pub vote_key_dilution: i32, + /// \\[voteLst\\] Last round for which this participation is valid. + #[serde(rename = "vote-last-valid")] + pub vote_last_valid: i32, + /// \\[vote\\] root participation public key (if any) currently registered for this round. + #[serde_as(as = "serde_with::base64::Base64")] + #[serde(rename = "vote-participation-key")] + pub vote_participation_key: Vec, +} + +impl AccountParticipation { + /// AccountParticipation describes the parameters used by this account in consensus protocol. + pub fn new(selection_participation_key: Vec, vote_first_valid: i32, vote_key_dilution: i32, vote_last_valid: i32, vote_participation_key: Vec) -> AccountParticipation { + AccountParticipation { + selection_participation_key, + state_proof_key: None, + vote_first_valid, + vote_key_dilution, + vote_last_valid, + vote_participation_key, + } + } +} + diff --git a/crates/algo_fetch/src/models/account_state_delta.rs b/crates/algo_fetch/src/models/account_state_delta.rs new file mode 100644 index 0000000..998738f --- /dev/null +++ b/crates/algo_fetch/src/models/account_state_delta.rs @@ -0,0 +1,33 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// AccountStateDelta : Application state delta. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct AccountStateDelta { + #[serde(rename = "address")] + pub address: String, + /// Application state delta. + #[serde(rename = "delta")] + pub delta: Vec, +} + +impl AccountStateDelta { + /// Application state delta. + pub fn new(address: String, delta: Vec) -> AccountStateDelta { + AccountStateDelta { + address, + delta, + } + } +} + diff --git a/crates/algo_fetch/src/models/add_participation_key_200_response.rs b/crates/algo_fetch/src/models/add_participation_key_200_response.rs new file mode 100644 index 0000000..fd5b217 --- /dev/null +++ b/crates/algo_fetch/src/models/add_participation_key_200_response.rs @@ -0,0 +1,28 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct AddParticipationKey200Response { + /// encoding of the participation ID. + #[serde(rename = "partId")] + pub part_id: String, +} + +impl AddParticipationKey200Response { + pub fn new(part_id: String) -> AddParticipationKey200Response { + AddParticipationKey200Response { + part_id, + } + } +} + diff --git a/crates/algo_fetch/src/models/app_call_logs.rs b/crates/algo_fetch/src/models/app_call_logs.rs new file mode 100644 index 0000000..7da3570 --- /dev/null +++ b/crates/algo_fetch/src/models/app_call_logs.rs @@ -0,0 +1,38 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// AppCallLogs : The logged messages from an app call along with the app ID and outer transaction ID. Logs appear in the same order that they were emitted. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct AppCallLogs { + /// The application from which the logs were generated + #[serde(rename = "application-index")] + pub application_index: i32, + /// An array of logs + #[serde(rename = "logs")] + pub logs: Vec, + /// The transaction ID of the outer app call that lead to these logs + #[serde(rename = "txId")] + pub tx_id: String, +} + +impl AppCallLogs { + /// The logged messages from an app call along with the app ID and outer transaction ID. Logs appear in the same order that they were emitted. + pub fn new(application_index: i32, logs: Vec, tx_id: String) -> AppCallLogs { + AppCallLogs { + application_index, + logs, + tx_id, + } + } +} + diff --git a/crates/algo_fetch/src/models/application.rs b/crates/algo_fetch/src/models/application.rs new file mode 100644 index 0000000..cc822f7 --- /dev/null +++ b/crates/algo_fetch/src/models/application.rs @@ -0,0 +1,33 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// Application : Application index and its parameters +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct Application { + /// \\[appidx\\] application index. + #[serde(rename = "id")] + pub id: i32, + #[serde(rename = "params")] + pub params: Box, +} + +impl Application { + /// Application index and its parameters + pub fn new(id: i32, params: models::ApplicationParams) -> Application { + Application { + id, + params: Box::new(params), + } + } +} + diff --git a/crates/algo_fetch/src/models/application_initial_states.rs b/crates/algo_fetch/src/models/application_initial_states.rs new file mode 100644 index 0000000..adf393c --- /dev/null +++ b/crates/algo_fetch/src/models/application_initial_states.rs @@ -0,0 +1,40 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// ApplicationInitialStates : An application's initial global/local/box states that were accessed during simulation. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApplicationInitialStates { + #[serde(rename = "app-boxes", skip_serializing_if = "Option::is_none")] + pub app_boxes: Option>, + #[serde(rename = "app-globals", skip_serializing_if = "Option::is_none")] + pub app_globals: Option>, + /// An application's initial local states tied to different accounts. + #[serde(rename = "app-locals", skip_serializing_if = "Option::is_none")] + pub app_locals: Option>, + /// Application index. + #[serde(rename = "id")] + pub id: i32, +} + +impl ApplicationInitialStates { + /// An application's initial global/local/box states that were accessed during simulation. + pub fn new(id: i32) -> ApplicationInitialStates { + ApplicationInitialStates { + app_boxes: None, + app_globals: None, + app_locals: None, + id, + } + } +} + diff --git a/crates/algo_fetch/src/models/application_kv_storage.rs b/crates/algo_fetch/src/models/application_kv_storage.rs new file mode 100644 index 0000000..6f20c6c --- /dev/null +++ b/crates/algo_fetch/src/models/application_kv_storage.rs @@ -0,0 +1,34 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// ApplicationKvStorage : An application's global/local/box state. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApplicationKvStorage { + /// The address of the account associated with the local state. + #[serde(rename = "account", skip_serializing_if = "Option::is_none")] + pub account: Option, + /// Key-Value pairs representing application states. + #[serde(rename = "kvs")] + pub kvs: Vec, +} + +impl ApplicationKvStorage { + /// An application's global/local/box state. + pub fn new(kvs: Vec) -> ApplicationKvStorage { + ApplicationKvStorage { + account: None, + kvs, + } + } +} + diff --git a/crates/algo_fetch/src/models/application_local_reference.rs b/crates/algo_fetch/src/models/application_local_reference.rs new file mode 100644 index 0000000..38d3d2c --- /dev/null +++ b/crates/algo_fetch/src/models/application_local_reference.rs @@ -0,0 +1,34 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// ApplicationLocalReference : References an account's local state for an application. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApplicationLocalReference { + /// Address of the account with the local state. + #[serde(rename = "account")] + pub account: String, + /// Application ID of the local state application. + #[serde(rename = "app")] + pub app: i32, +} + +impl ApplicationLocalReference { + /// References an account's local state for an application. + pub fn new(account: String, app: i32) -> ApplicationLocalReference { + ApplicationLocalReference { + account, + app, + } + } +} + diff --git a/crates/algo_fetch/src/models/application_local_state.rs b/crates/algo_fetch/src/models/application_local_state.rs new file mode 100644 index 0000000..3232653 --- /dev/null +++ b/crates/algo_fetch/src/models/application_local_state.rs @@ -0,0 +1,37 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// ApplicationLocalState : Stores local state associated with an application. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApplicationLocalState { + /// The application which this local state is for. + #[serde(rename = "id")] + pub id: i32, + /// Represents a key-value store for use in an application. + #[serde(rename = "key-value", skip_serializing_if = "Option::is_none")] + pub key_value: Option>, + #[serde(rename = "schema")] + pub schema: Box, +} + +impl ApplicationLocalState { + /// Stores local state associated with an application. + pub fn new(id: i32, schema: models::ApplicationStateSchema) -> ApplicationLocalState { + ApplicationLocalState { + id, + key_value: None, + schema: Box::new(schema), + } + } +} + diff --git a/crates/algo_fetch/src/models/application_params.rs b/crates/algo_fetch/src/models/application_params.rs new file mode 100644 index 0000000..c01c0bc --- /dev/null +++ b/crates/algo_fetch/src/models/application_params.rs @@ -0,0 +1,57 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +use serde_with::serde_as; + +/// ApplicationParams : Stores the global information associated with an application. +#[serde_as] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApplicationParams { + /// \\[approv\\] approval program. + #[serde_as(as = "serde_with::base64::Base64")] + #[serde(rename = "approval-program")] + pub approval_program: Vec, + /// \\[clearp\\] approval program. + #[serde_as(as = "serde_with::base64::Base64")] + #[serde(rename = "clear-state-program")] + pub clear_state_program: Vec, + /// The address that created this application. This is the address where the parameters and global state for this application can be found. + #[serde(rename = "creator")] + pub creator: String, + /// \\[epp\\] the amount of extra program pages available to this app. + #[serde(rename = "extra-program-pages", skip_serializing_if = "Option::is_none")] + pub extra_program_pages: Option, + /// Represents a key-value store for use in an application. + #[serde(rename = "global-state", skip_serializing_if = "Option::is_none")] + pub global_state: Option>, + #[serde(rename = "global-state-schema", skip_serializing_if = "Option::is_none")] + pub global_state_schema: Option>, + #[serde(rename = "local-state-schema", skip_serializing_if = "Option::is_none")] + pub local_state_schema: Option>, +} + +impl ApplicationParams { + /// Stores the global information associated with an application. + pub fn new(approval_program: Vec, clear_state_program: Vec, creator: String) -> ApplicationParams { + ApplicationParams { + approval_program, + clear_state_program, + creator, + extra_program_pages: None, + global_state: None, + global_state_schema: None, + local_state_schema: None, + } + } +} + diff --git a/crates/algo_fetch/src/models/application_state_operation.rs b/crates/algo_fetch/src/models/application_state_operation.rs new file mode 100644 index 0000000..7d3c38e --- /dev/null +++ b/crates/algo_fetch/src/models/application_state_operation.rs @@ -0,0 +1,49 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +use serde_with::serde_as; + +/// ApplicationStateOperation : An operation against an application's global/local/box state. +#[serde_as] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApplicationStateOperation { + /// For local state changes, the address of the account associated with the local state. + #[serde(rename = "account", skip_serializing_if = "Option::is_none")] + pub account: Option, + /// Type of application state. Value `g` is **global state**, `l` is **local state**, `b` is **boxes**. + #[serde(rename = "app-state-type")] + pub app_state_type: String, + /// The key (name) of the global/local/box state. + #[serde_as(as = "serde_with::base64::Base64")] + #[serde(rename = "key")] + pub key: Vec, + #[serde(rename = "new-value", skip_serializing_if = "Option::is_none")] + pub new_value: Option>, + /// Operation type. Value `w` is **write**, `d` is **delete**. + #[serde(rename = "operation")] + pub operation: String, +} + +impl ApplicationStateOperation { + /// An operation against an application's global/local/box state. + pub fn new(app_state_type: String, key: Vec, operation: String) -> ApplicationStateOperation { + ApplicationStateOperation { + account: None, + app_state_type, + key, + new_value: None, + operation, + } + } +} + diff --git a/crates/algo_fetch/src/models/application_state_schema.rs b/crates/algo_fetch/src/models/application_state_schema.rs new file mode 100644 index 0000000..4a8b759 --- /dev/null +++ b/crates/algo_fetch/src/models/application_state_schema.rs @@ -0,0 +1,34 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// ApplicationStateSchema : Specifies maximums on the number of each type that may be stored. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApplicationStateSchema { + /// \\[nbs\\] num of byte slices. + #[serde(rename = "num-byte-slice")] + pub num_byte_slice: i32, + /// \\[nui\\] num of uints. + #[serde(rename = "num-uint")] + pub num_uint: i32, +} + +impl ApplicationStateSchema { + /// Specifies maximums on the number of each type that may be stored. + pub fn new(num_byte_slice: i32, num_uint: i32) -> ApplicationStateSchema { + ApplicationStateSchema { + num_byte_slice, + num_uint, + } + } +} + diff --git a/crates/algo_fetch/src/models/asset.rs b/crates/algo_fetch/src/models/asset.rs new file mode 100644 index 0000000..1d56259 --- /dev/null +++ b/crates/algo_fetch/src/models/asset.rs @@ -0,0 +1,33 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// Asset : Specifies both the unique identifier and the parameters for an asset +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct Asset { + /// unique asset identifier + #[serde(rename = "index")] + pub index: i32, + #[serde(rename = "params")] + pub params: Box, +} + +impl Asset { + /// Specifies both the unique identifier and the parameters for an asset + pub fn new(index: i32, params: models::AssetParams) -> Asset { + Asset { + index, + params: Box::new(params), + } + } +} + diff --git a/crates/algo_fetch/src/models/asset_holding.rs b/crates/algo_fetch/src/models/asset_holding.rs new file mode 100644 index 0000000..11a8833 --- /dev/null +++ b/crates/algo_fetch/src/models/asset_holding.rs @@ -0,0 +1,38 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// AssetHolding : Describes an asset held by an account. Definition: data/basics/userBalance.go : AssetHolding +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct AssetHolding { + /// \\[a\\] number of units held. + #[serde(rename = "amount")] + pub amount: i32, + /// Asset ID of the holding. + #[serde(rename = "asset-id")] + pub asset_id: i32, + /// \\[f\\] whether or not the holding is frozen. + #[serde(rename = "is-frozen")] + pub is_frozen: bool, +} + +impl AssetHolding { + /// Describes an asset held by an account. Definition: data/basics/userBalance.go : AssetHolding + pub fn new(amount: i32, asset_id: i32, is_frozen: bool) -> AssetHolding { + AssetHolding { + amount, + asset_id, + is_frozen, + } + } +} + diff --git a/crates/algo_fetch/src/models/asset_holding_reference.rs b/crates/algo_fetch/src/models/asset_holding_reference.rs new file mode 100644 index 0000000..f47d6a2 --- /dev/null +++ b/crates/algo_fetch/src/models/asset_holding_reference.rs @@ -0,0 +1,34 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// AssetHoldingReference : References an asset held by an account. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct AssetHoldingReference { + /// Address of the account holding the asset. + #[serde(rename = "account")] + pub account: String, + /// Asset ID of the holding. + #[serde(rename = "asset")] + pub asset: i32, +} + +impl AssetHoldingReference { + /// References an asset held by an account. + pub fn new(account: String, asset: i32) -> AssetHoldingReference { + AssetHoldingReference { + account, + asset, + } + } +} + diff --git a/crates/algo_fetch/src/models/asset_params.rs b/crates/algo_fetch/src/models/asset_params.rs new file mode 100644 index 0000000..953a694 --- /dev/null +++ b/crates/algo_fetch/src/models/asset_params.rs @@ -0,0 +1,93 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +use serde_with::serde_as; + +/// AssetParams : AssetParams specifies the parameters for an asset. \\[apar\\] when part of an AssetConfig transaction. Definition: data/transactions/asset.go : AssetParams +#[serde_as] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct AssetParams { + /// \\[c\\] Address of account used to clawback holdings of this asset. If empty, clawback is not permitted. + #[serde(rename = "clawback", skip_serializing_if = "Option::is_none")] + pub clawback: Option, + /// The address that created this asset. This is the address where the parameters for this asset can be found, and also the address where unwanted asset units can be sent in the worst case. + #[serde(rename = "creator")] + pub creator: String, + /// \\[dc\\] The number of digits to use after the decimal point when displaying this asset. If 0, the asset is not divisible. If 1, the base unit of the asset is in tenths. If 2, the base unit of the asset is in hundredths, and so on. This value must be between 0 and 19 (inclusive). + #[serde(rename = "decimals")] + pub decimals: i32, + /// \\[df\\] Whether holdings of this asset are frozen by default. + #[serde(rename = "default-frozen", skip_serializing_if = "Option::is_none")] + pub default_frozen: Option, + /// \\[f\\] Address of account used to freeze holdings of this asset. If empty, freezing is not permitted. + #[serde(rename = "freeze", skip_serializing_if = "Option::is_none")] + pub freeze: Option, + /// \\[m\\] Address of account used to manage the keys of this asset and to destroy it. + #[serde(rename = "manager", skip_serializing_if = "Option::is_none")] + pub manager: Option, + /// \\[am\\] A commitment to some unspecified asset metadata. The format of this metadata is up to the application. + #[serde_as(as = "Option")] + #[serde(rename = "metadata-hash", skip_serializing_if = "Option::is_none")] + pub metadata_hash: Option>, + /// \\[an\\] Name of this asset, as supplied by the creator. Included only when the asset name is composed of printable utf-8 characters. + #[serde(rename = "name", skip_serializing_if = "Option::is_none")] + pub name: Option, + /// Base64 encoded name of this asset, as supplied by the creator. + #[serde_as(as = "Option")] + #[serde(rename = "name-b64", skip_serializing_if = "Option::is_none")] + pub name_b64: Option>, + /// \\[r\\] Address of account holding reserve (non-minted) units of this asset. + #[serde(rename = "reserve", skip_serializing_if = "Option::is_none")] + pub reserve: Option, + /// \\[t\\] The total number of units of this asset. + #[serde(rename = "total")] + pub total: i32, + /// \\[un\\] Name of a unit of this asset, as supplied by the creator. Included only when the name of a unit of this asset is composed of printable utf-8 characters. + #[serde(rename = "unit-name", skip_serializing_if = "Option::is_none")] + pub unit_name: Option, + /// Base64 encoded name of a unit of this asset, as supplied by the creator. + #[serde_as(as = "Option")] + #[serde(rename = "unit-name-b64", skip_serializing_if = "Option::is_none")] + pub unit_name_b64: Option>, + /// \\[au\\] URL where more information about the asset can be retrieved. Included only when the URL is composed of printable utf-8 characters. + #[serde(rename = "url", skip_serializing_if = "Option::is_none")] + pub url: Option, + /// Base64 encoded URL where more information about the asset can be retrieved. + #[serde_as(as = "Option")] + #[serde(rename = "url-b64", skip_serializing_if = "Option::is_none")] + pub url_b64: Option>, +} + +impl AssetParams { + /// AssetParams specifies the parameters for an asset. \\[apar\\] when part of an AssetConfig transaction. Definition: data/transactions/asset.go : AssetParams + pub fn new(creator: String, decimals: i32, total: i32) -> AssetParams { + AssetParams { + clawback: None, + creator, + decimals, + default_frozen: None, + freeze: None, + manager: None, + metadata_hash: None, + name: None, + name_b64: None, + reserve: None, + total, + unit_name: None, + unit_name_b64: None, + url: None, + url_b64: None, + } + } +} + diff --git a/crates/algo_fetch/src/models/avm_key_value.rs b/crates/algo_fetch/src/models/avm_key_value.rs new file mode 100644 index 0000000..4aad625 --- /dev/null +++ b/crates/algo_fetch/src/models/avm_key_value.rs @@ -0,0 +1,36 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +use serde_with::serde_as; + +/// AvmKeyValue : Represents an AVM key-value pair in an application store. +#[serde_as] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct AvmKeyValue { + #[serde_as(as = "serde_with::base64::Base64")] + #[serde(rename = "key")] + pub key: Vec, + #[serde(rename = "value")] + pub value: Box, +} + +impl AvmKeyValue { + /// Represents an AVM key-value pair in an application store. + pub fn new(key: Vec, value: models::AvmValue) -> AvmKeyValue { + AvmKeyValue { + key, + value: Box::new(value), + } + } +} + diff --git a/crates/algo_fetch/src/models/avm_value.rs b/crates/algo_fetch/src/models/avm_value.rs new file mode 100644 index 0000000..11641ba --- /dev/null +++ b/crates/algo_fetch/src/models/avm_value.rs @@ -0,0 +1,42 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +use serde_with::serde_as; + +/// AvmValue : Represents an AVM value. +#[serde_as] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct AvmValue { + /// bytes value. + #[serde_as(as = "Option")] + #[serde(rename = "bytes", skip_serializing_if = "Option::is_none")] + pub bytes: Option>, + /// value type. Value `1` refers to **bytes**, value `2` refers to **uint64** + #[serde(rename = "type")] + pub r#type: i32, + /// uint value. + #[serde(rename = "uint", skip_serializing_if = "Option::is_none")] + pub uint: Option, +} + +impl AvmValue { + /// Represents an AVM value. + pub fn new(r#type: i32) -> AvmValue { + AvmValue { + bytes: None, + r#type, + uint: None, + } + } +} + diff --git a/crates/algo_fetch/src/models/box_descriptor.rs b/crates/algo_fetch/src/models/box_descriptor.rs new file mode 100644 index 0000000..d0fab21 --- /dev/null +++ b/crates/algo_fetch/src/models/box_descriptor.rs @@ -0,0 +1,34 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +use serde_with::serde_as; + +/// BoxDescriptor : Box descriptor describes a Box. +#[serde_as] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct BoxDescriptor { + /// Base64 encoded box name + #[serde_as(as = "serde_with::base64::Base64")] + #[serde(rename = "name")] + pub name: Vec, +} + +impl BoxDescriptor { + /// Box descriptor describes a Box. + pub fn new(name: Vec) -> BoxDescriptor { + BoxDescriptor { + name, + } + } +} + diff --git a/crates/algo_fetch/src/models/box_reference.rs b/crates/algo_fetch/src/models/box_reference.rs new file mode 100644 index 0000000..f038258 --- /dev/null +++ b/crates/algo_fetch/src/models/box_reference.rs @@ -0,0 +1,38 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +use serde_with::serde_as; + +/// BoxReference : References a box of an application. +#[serde_as] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct BoxReference { + /// Application ID which this box belongs to + #[serde(rename = "app")] + pub app: i32, + /// Base64 encoded box name + #[serde_as(as = "serde_with::base64::Base64")] + #[serde(rename = "name")] + pub name: Vec, +} + +impl BoxReference { + /// References a box of an application. + pub fn new(app: i32, name: Vec) -> BoxReference { + BoxReference { + app, + name, + } + } +} + diff --git a/crates/algo_fetch/src/models/build_version.rs b/crates/algo_fetch/src/models/build_version.rs new file mode 100644 index 0000000..4071b4f --- /dev/null +++ b/crates/algo_fetch/src/models/build_version.rs @@ -0,0 +1,42 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct BuildVersion { + #[serde(rename = "branch")] + pub branch: String, + #[serde(rename = "build_number")] + pub build_number: i64, + #[serde(rename = "channel")] + pub channel: String, + #[serde(rename = "commit_hash")] + pub commit_hash: String, + #[serde(rename = "major")] + pub major: i64, + #[serde(rename = "minor")] + pub minor: i64, +} + +impl BuildVersion { + pub fn new(branch: String, build_number: i64, channel: String, commit_hash: String, major: i64, minor: i64) -> BuildVersion { + BuildVersion { + branch, + build_number, + channel, + commit_hash, + major, + minor, + } + } +} + diff --git a/crates/algo_fetch/src/models/debug_settings_prof.rs b/crates/algo_fetch/src/models/debug_settings_prof.rs new file mode 100644 index 0000000..b9bbe67 --- /dev/null +++ b/crates/algo_fetch/src/models/debug_settings_prof.rs @@ -0,0 +1,34 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// DebugSettingsProf : algod mutex and blocking profiling state. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct DebugSettingsProf { + /// The rate of blocking events. The profiler aims to sample an average of one blocking event per rate nanoseconds spent blocked. To turn off profiling entirely, pass rate 0. + #[serde(rename = "block-rate", skip_serializing_if = "Option::is_none")] + pub block_rate: Option, + /// The rate of mutex events. On average 1/rate events are reported. To turn off profiling entirely, pass rate 0 + #[serde(rename = "mutex-rate", skip_serializing_if = "Option::is_none")] + pub mutex_rate: Option, +} + +impl DebugSettingsProf { + /// algod mutex and blocking profiling state. + pub fn new() -> DebugSettingsProf { + DebugSettingsProf { + block_rate: None, + mutex_rate: None, + } + } +} + diff --git a/crates/algo_fetch/src/models/dryrun_request.rs b/crates/algo_fetch/src/models/dryrun_request.rs new file mode 100644 index 0000000..931aebb --- /dev/null +++ b/crates/algo_fetch/src/models/dryrun_request.rs @@ -0,0 +1,50 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// DryrunRequest : Request data type for dryrun endpoint. Given the Transactions and simulated ledger state upload, run TEAL scripts and return debugging information. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct DryrunRequest { + #[serde(rename = "accounts")] + pub accounts: Vec, + #[serde(rename = "apps")] + pub apps: Vec, + /// LatestTimestamp is available to some TEAL scripts. Defaults to the latest confirmed timestamp this algod is attached to. + #[serde(rename = "latest-timestamp")] + pub latest_timestamp: i64, + /// ProtocolVersion specifies a specific version string to operate under, otherwise whatever the current protocol of the network this algod is running in. + #[serde(rename = "protocol-version")] + pub protocol_version: String, + /// Round is available to some TEAL scripts. Defaults to the current round on the network this algod is attached to. + #[serde(rename = "round")] + pub round: i32, + #[serde(rename = "sources")] + pub sources: Vec, + #[serde(rename = "txns")] + pub txns: Vec, +} + +impl DryrunRequest { + /// Request data type for dryrun endpoint. Given the Transactions and simulated ledger state upload, run TEAL scripts and return debugging information. + pub fn new(accounts: Vec, apps: Vec, latest_timestamp: i64, protocol_version: String, round: i32, sources: Vec, txns: Vec) -> DryrunRequest { + DryrunRequest { + accounts, + apps, + latest_timestamp, + protocol_version, + round, + sources, + txns, + } + } +} + diff --git a/crates/algo_fetch/src/models/dryrun_source.rs b/crates/algo_fetch/src/models/dryrun_source.rs new file mode 100644 index 0000000..69656c8 --- /dev/null +++ b/crates/algo_fetch/src/models/dryrun_source.rs @@ -0,0 +1,39 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// DryrunSource : DryrunSource is TEAL source text that gets uploaded, compiled, and inserted into transactions or application state. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct DryrunSource { + #[serde(rename = "app-index")] + pub app_index: i32, + /// FieldName is what kind of sources this is. If lsig then it goes into the transactions[this.TxnIndex].LogicSig. If approv or clearp it goes into the Approval Program or Clear State Program of application[this.AppIndex]. + #[serde(rename = "field-name")] + pub field_name: String, + #[serde(rename = "source")] + pub source: String, + #[serde(rename = "txn-index")] + pub txn_index: i32, +} + +impl DryrunSource { + /// DryrunSource is TEAL source text that gets uploaded, compiled, and inserted into transactions or application state. + pub fn new(app_index: i32, field_name: String, source: String, txn_index: i32) -> DryrunSource { + DryrunSource { + app_index, + field_name, + source, + txn_index, + } + } +} + diff --git a/crates/algo_fetch/src/models/dryrun_state.rs b/crates/algo_fetch/src/models/dryrun_state.rs new file mode 100644 index 0000000..d16ddf4 --- /dev/null +++ b/crates/algo_fetch/src/models/dryrun_state.rs @@ -0,0 +1,44 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// DryrunState : Stores the TEAL eval step data +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct DryrunState { + /// Evaluation error if any + #[serde(rename = "error", skip_serializing_if = "Option::is_none")] + pub error: Option, + /// Line number + #[serde(rename = "line")] + pub line: i32, + /// Program counter + #[serde(rename = "pc")] + pub pc: i32, + #[serde(rename = "scratch", skip_serializing_if = "Option::is_none")] + pub scratch: Option>, + #[serde(rename = "stack")] + pub stack: Vec, +} + +impl DryrunState { + /// Stores the TEAL eval step data + pub fn new(line: i32, pc: i32, stack: Vec) -> DryrunState { + DryrunState { + error: None, + line, + pc, + scratch: None, + stack, + } + } +} + diff --git a/crates/algo_fetch/src/models/dryrun_txn_result.rs b/crates/algo_fetch/src/models/dryrun_txn_result.rs new file mode 100644 index 0000000..2d9b685 --- /dev/null +++ b/crates/algo_fetch/src/models/dryrun_txn_result.rs @@ -0,0 +1,64 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// DryrunTxnResult : DryrunTxnResult contains any LogicSig or ApplicationCall program debug information and state updates from a dryrun. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct DryrunTxnResult { + #[serde(rename = "app-call-messages", skip_serializing_if = "Option::is_none")] + pub app_call_messages: Option>, + #[serde(rename = "app-call-trace", skip_serializing_if = "Option::is_none")] + pub app_call_trace: Option>, + /// Budget added during execution of app call transaction. + #[serde(rename = "budget-added", skip_serializing_if = "Option::is_none")] + pub budget_added: Option, + /// Budget consumed during execution of app call transaction. + #[serde(rename = "budget-consumed", skip_serializing_if = "Option::is_none")] + pub budget_consumed: Option, + /// Disassembled program line by line. + #[serde(rename = "disassembly")] + pub disassembly: Vec, + /// Application state delta. + #[serde(rename = "global-delta", skip_serializing_if = "Option::is_none")] + pub global_delta: Option>, + #[serde(rename = "local-deltas", skip_serializing_if = "Option::is_none")] + pub local_deltas: Option>, + /// Disassembled lsig program line by line. + #[serde(rename = "logic-sig-disassembly", skip_serializing_if = "Option::is_none")] + pub logic_sig_disassembly: Option>, + #[serde(rename = "logic-sig-messages", skip_serializing_if = "Option::is_none")] + pub logic_sig_messages: Option>, + #[serde(rename = "logic-sig-trace", skip_serializing_if = "Option::is_none")] + pub logic_sig_trace: Option>, + #[serde(rename = "logs", skip_serializing_if = "Option::is_none")] + pub logs: Option>, +} + +impl DryrunTxnResult { + /// DryrunTxnResult contains any LogicSig or ApplicationCall program debug information and state updates from a dryrun. + pub fn new(disassembly: Vec) -> DryrunTxnResult { + DryrunTxnResult { + app_call_messages: None, + app_call_trace: None, + budget_added: None, + budget_consumed: None, + disassembly, + global_delta: None, + local_deltas: None, + logic_sig_disassembly: None, + logic_sig_messages: None, + logic_sig_trace: None, + logs: None, + } + } +} + diff --git a/crates/algo_fetch/src/models/error_response.rs b/crates/algo_fetch/src/models/error_response.rs new file mode 100644 index 0000000..9e136b6 --- /dev/null +++ b/crates/algo_fetch/src/models/error_response.rs @@ -0,0 +1,32 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// ErrorResponse : An error response with optional data field. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct ErrorResponse { + #[serde(rename = "data", skip_serializing_if = "Option::is_none")] + pub data: Option, + #[serde(rename = "message")] + pub message: String, +} + +impl ErrorResponse { + /// An error response with optional data field. + pub fn new(message: String) -> ErrorResponse { + ErrorResponse { + data: None, + message, + } + } +} + diff --git a/crates/algo_fetch/src/models/eval_delta.rs b/crates/algo_fetch/src/models/eval_delta.rs new file mode 100644 index 0000000..65fccea --- /dev/null +++ b/crates/algo_fetch/src/models/eval_delta.rs @@ -0,0 +1,38 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// EvalDelta : Represents a TEAL value delta. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct EvalDelta { + /// \\[at\\] delta action. + #[serde(rename = "action")] + pub action: i32, + /// \\[bs\\] bytes value. + #[serde(rename = "bytes", skip_serializing_if = "Option::is_none")] + pub bytes: Option, + /// \\[ui\\] uint value. + #[serde(rename = "uint", skip_serializing_if = "Option::is_none")] + pub uint: Option, +} + +impl EvalDelta { + /// Represents a TEAL value delta. + pub fn new(action: i32) -> EvalDelta { + EvalDelta { + action, + bytes: None, + uint: None, + } + } +} + diff --git a/crates/algo_fetch/src/models/eval_delta_key_value.rs b/crates/algo_fetch/src/models/eval_delta_key_value.rs new file mode 100644 index 0000000..c5fe030 --- /dev/null +++ b/crates/algo_fetch/src/models/eval_delta_key_value.rs @@ -0,0 +1,32 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// EvalDeltaKeyValue : Key-value pairs for StateDelta. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct EvalDeltaKeyValue { + #[serde(rename = "key")] + pub key: String, + #[serde(rename = "value")] + pub value: Box, +} + +impl EvalDeltaKeyValue { + /// Key-value pairs for StateDelta. + pub fn new(key: String, value: models::EvalDelta) -> EvalDeltaKeyValue { + EvalDeltaKeyValue { + key, + value: Box::new(value), + } + } +} + diff --git a/crates/algo_fetch/src/models/get_application_boxes_200_response.rs b/crates/algo_fetch/src/models/get_application_boxes_200_response.rs new file mode 100644 index 0000000..03acb22 --- /dev/null +++ b/crates/algo_fetch/src/models/get_application_boxes_200_response.rs @@ -0,0 +1,27 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct GetApplicationBoxes200Response { + #[serde(rename = "boxes")] + pub boxes: Vec, +} + +impl GetApplicationBoxes200Response { + pub fn new(boxes: Vec) -> GetApplicationBoxes200Response { + GetApplicationBoxes200Response { + boxes, + } + } +} + diff --git a/crates/algo_fetch/src/models/get_block_200_response.rs b/crates/algo_fetch/src/models/get_block_200_response.rs new file mode 100644 index 0000000..9746b9a --- /dev/null +++ b/crates/algo_fetch/src/models/get_block_200_response.rs @@ -0,0 +1,32 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct GetBlock200Response { + /// Block header data. + #[serde(rename = "block")] + pub block: serde_json::Value, + /// Optional certificate object. This is only included when the format is set to message pack. + #[serde(rename = "cert", skip_serializing_if = "Option::is_none")] + pub cert: Option, +} + +impl GetBlock200Response { + pub fn new(block: serde_json::Value) -> GetBlock200Response { + GetBlock200Response { + block, + cert: None, + } + } +} + diff --git a/crates/algo_fetch/src/models/get_block_hash_200_response.rs b/crates/algo_fetch/src/models/get_block_hash_200_response.rs new file mode 100644 index 0000000..87bed37 --- /dev/null +++ b/crates/algo_fetch/src/models/get_block_hash_200_response.rs @@ -0,0 +1,28 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct GetBlockHash200Response { + /// Block header hash. + #[serde(rename = "blockHash")] + pub block_hash: String, +} + +impl GetBlockHash200Response { + pub fn new(block_hash: String) -> GetBlockHash200Response { + GetBlockHash200Response { + block_hash, + } + } +} + diff --git a/crates/algo_fetch/src/models/get_block_logs_200_response.rs b/crates/algo_fetch/src/models/get_block_logs_200_response.rs new file mode 100644 index 0000000..2622b39 --- /dev/null +++ b/crates/algo_fetch/src/models/get_block_logs_200_response.rs @@ -0,0 +1,27 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct GetBlockLogs200Response { + #[serde(rename = "logs")] + pub logs: Vec, +} + +impl GetBlockLogs200Response { + pub fn new(logs: Vec) -> GetBlockLogs200Response { + GetBlockLogs200Response { + logs, + } + } +} + diff --git a/crates/algo_fetch/src/models/get_block_time_stamp_offset_200_response.rs b/crates/algo_fetch/src/models/get_block_time_stamp_offset_200_response.rs new file mode 100644 index 0000000..6f40202 --- /dev/null +++ b/crates/algo_fetch/src/models/get_block_time_stamp_offset_200_response.rs @@ -0,0 +1,28 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct GetBlockTimeStampOffset200Response { + /// Timestamp offset in seconds. + #[serde(rename = "offset")] + pub offset: i32, +} + +impl GetBlockTimeStampOffset200Response { + pub fn new(offset: i32) -> GetBlockTimeStampOffset200Response { + GetBlockTimeStampOffset200Response { + offset, + } + } +} + diff --git a/crates/algo_fetch/src/models/get_block_txids_200_response.rs b/crates/algo_fetch/src/models/get_block_txids_200_response.rs new file mode 100644 index 0000000..76e1677 --- /dev/null +++ b/crates/algo_fetch/src/models/get_block_txids_200_response.rs @@ -0,0 +1,28 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct GetBlockTxids200Response { + /// Block transaction IDs. + #[serde(rename = "blockTxids")] + pub block_txids: Vec, +} + +impl GetBlockTxids200Response { + pub fn new(block_txids: Vec) -> GetBlockTxids200Response { + GetBlockTxids200Response { + block_txids, + } + } +} + diff --git a/crates/algo_fetch/src/models/get_pending_transactions_by_address_200_response.rs b/crates/algo_fetch/src/models/get_pending_transactions_by_address_200_response.rs new file mode 100644 index 0000000..a44ba5a --- /dev/null +++ b/crates/algo_fetch/src/models/get_pending_transactions_by_address_200_response.rs @@ -0,0 +1,34 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// GetPendingTransactionsByAddress200Response : PendingTransactions is an array of signed transactions exactly as they were submitted. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct GetPendingTransactionsByAddress200Response { + /// An array of signed transaction objects. + #[serde(rename = "top-transactions")] + pub top_transactions: Vec, + /// Total number of transactions in the pool. + #[serde(rename = "total-transactions")] + pub total_transactions: i32, +} + +impl GetPendingTransactionsByAddress200Response { + /// PendingTransactions is an array of signed transactions exactly as they were submitted. + pub fn new(top_transactions: Vec, total_transactions: i32) -> GetPendingTransactionsByAddress200Response { + GetPendingTransactionsByAddress200Response { + top_transactions, + total_transactions, + } + } +} + diff --git a/crates/algo_fetch/src/models/get_status_200_response.rs b/crates/algo_fetch/src/models/get_status_200_response.rs new file mode 100644 index 0000000..7524f54 --- /dev/null +++ b/crates/algo_fetch/src/models/get_status_200_response.rs @@ -0,0 +1,130 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// GetStatus200Response : NodeStatus contains the information about a node status +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct GetStatus200Response { + /// The current catchpoint that is being caught up to + #[serde(rename = "catchpoint", skip_serializing_if = "Option::is_none")] + pub catchpoint: Option, + /// The number of blocks that have already been obtained by the node as part of the catchup + #[serde(rename = "catchpoint-acquired-blocks", skip_serializing_if = "Option::is_none")] + pub catchpoint_acquired_blocks: Option, + /// The number of accounts from the current catchpoint that have been processed so far as part of the catchup + #[serde(rename = "catchpoint-processed-accounts", skip_serializing_if = "Option::is_none")] + pub catchpoint_processed_accounts: Option, + /// The number of key-values (KVs) from the current catchpoint that have been processed so far as part of the catchup + #[serde(rename = "catchpoint-processed-kvs", skip_serializing_if = "Option::is_none")] + pub catchpoint_processed_kvs: Option, + /// The total number of accounts included in the current catchpoint + #[serde(rename = "catchpoint-total-accounts", skip_serializing_if = "Option::is_none")] + pub catchpoint_total_accounts: Option, + /// The total number of blocks that are required to complete the current catchpoint catchup + #[serde(rename = "catchpoint-total-blocks", skip_serializing_if = "Option::is_none")] + pub catchpoint_total_blocks: Option, + /// The total number of key-values (KVs) included in the current catchpoint + #[serde(rename = "catchpoint-total-kvs", skip_serializing_if = "Option::is_none")] + pub catchpoint_total_kvs: Option, + /// The number of accounts from the current catchpoint that have been verified so far as part of the catchup + #[serde(rename = "catchpoint-verified-accounts", skip_serializing_if = "Option::is_none")] + pub catchpoint_verified_accounts: Option, + /// The number of key-values (KVs) from the current catchpoint that have been verified so far as part of the catchup + #[serde(rename = "catchpoint-verified-kvs", skip_serializing_if = "Option::is_none")] + pub catchpoint_verified_kvs: Option, + /// CatchupTime in nanoseconds + #[serde(rename = "catchup-time")] + pub catchup_time: i32, + /// The last catchpoint seen by the node + #[serde(rename = "last-catchpoint", skip_serializing_if = "Option::is_none")] + pub last_catchpoint: Option, + /// LastRound indicates the last round seen + #[serde(rename = "last-round")] + pub last_round: i32, + /// LastVersion indicates the last consensus version supported + #[serde(rename = "last-version")] + pub last_version: String, + /// NextVersion of consensus protocol to use + #[serde(rename = "next-version")] + pub next_version: String, + /// NextVersionRound is the round at which the next consensus version will apply + #[serde(rename = "next-version-round")] + pub next_version_round: i32, + /// NextVersionSupported indicates whether the next consensus version is supported by this node + #[serde(rename = "next-version-supported")] + pub next_version_supported: bool, + /// StoppedAtUnsupportedRound indicates that the node does not support the new rounds and has stopped making progress + #[serde(rename = "stopped-at-unsupported-round")] + pub stopped_at_unsupported_round: bool, + /// TimeSinceLastRound in nanoseconds + #[serde(rename = "time-since-last-round")] + pub time_since_last_round: i32, + /// Upgrade delay + #[serde(rename = "upgrade-delay", skip_serializing_if = "Option::is_none")] + pub upgrade_delay: Option, + /// Next protocol round + #[serde(rename = "upgrade-next-protocol-vote-before", skip_serializing_if = "Option::is_none")] + pub upgrade_next_protocol_vote_before: Option, + /// No votes cast for consensus upgrade + #[serde(rename = "upgrade-no-votes", skip_serializing_if = "Option::is_none")] + pub upgrade_no_votes: Option, + /// This node's upgrade vote + #[serde(rename = "upgrade-node-vote", skip_serializing_if = "Option::is_none")] + pub upgrade_node_vote: Option, + /// Total voting rounds for current upgrade + #[serde(rename = "upgrade-vote-rounds", skip_serializing_if = "Option::is_none")] + pub upgrade_vote_rounds: Option, + /// Total votes cast for consensus upgrade + #[serde(rename = "upgrade-votes", skip_serializing_if = "Option::is_none")] + pub upgrade_votes: Option, + /// Yes votes required for consensus upgrade + #[serde(rename = "upgrade-votes-required", skip_serializing_if = "Option::is_none")] + pub upgrade_votes_required: Option, + /// Yes votes cast for consensus upgrade + #[serde(rename = "upgrade-yes-votes", skip_serializing_if = "Option::is_none")] + pub upgrade_yes_votes: Option, +} + +impl GetStatus200Response { + /// NodeStatus contains the information about a node status + pub fn new(catchup_time: i32, last_round: i32, last_version: String, next_version: String, next_version_round: i32, next_version_supported: bool, stopped_at_unsupported_round: bool, time_since_last_round: i32) -> GetStatus200Response { + GetStatus200Response { + catchpoint: None, + catchpoint_acquired_blocks: None, + catchpoint_processed_accounts: None, + catchpoint_processed_kvs: None, + catchpoint_total_accounts: None, + catchpoint_total_blocks: None, + catchpoint_total_kvs: None, + catchpoint_verified_accounts: None, + catchpoint_verified_kvs: None, + catchup_time, + last_catchpoint: None, + last_round, + last_version, + next_version, + next_version_round, + next_version_supported, + stopped_at_unsupported_round, + time_since_last_round, + upgrade_delay: None, + upgrade_next_protocol_vote_before: None, + upgrade_no_votes: None, + upgrade_node_vote: None, + upgrade_vote_rounds: None, + upgrade_votes: None, + upgrade_votes_required: None, + upgrade_yes_votes: None, + } + } +} + diff --git a/crates/algo_fetch/src/models/get_supply_200_response.rs b/crates/algo_fetch/src/models/get_supply_200_response.rs new file mode 100644 index 0000000..bf461af --- /dev/null +++ b/crates/algo_fetch/src/models/get_supply_200_response.rs @@ -0,0 +1,38 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// GetSupply200Response : Supply represents the current supply of MicroAlgos in the system +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct GetSupply200Response { + /// Round + #[serde(rename = "current_round")] + pub current_round: i32, + /// OnlineMoney + #[serde(rename = "online-money")] + pub online_money: i32, + /// TotalMoney + #[serde(rename = "total-money")] + pub total_money: i32, +} + +impl GetSupply200Response { + /// Supply represents the current supply of MicroAlgos in the system + pub fn new(current_round: i32, online_money: i32, total_money: i32) -> GetSupply200Response { + GetSupply200Response { + current_round, + online_money, + total_money, + } + } +} + diff --git a/crates/algo_fetch/src/models/get_sync_round_200_response.rs b/crates/algo_fetch/src/models/get_sync_round_200_response.rs new file mode 100644 index 0000000..dcd9399 --- /dev/null +++ b/crates/algo_fetch/src/models/get_sync_round_200_response.rs @@ -0,0 +1,28 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct GetSyncRound200Response { + /// The minimum sync round for the ledger. + #[serde(rename = "round")] + pub round: i32, +} + +impl GetSyncRound200Response { + pub fn new(round: i32) -> GetSyncRound200Response { + GetSyncRound200Response { + round, + } + } +} + diff --git a/crates/algo_fetch/src/models/get_transaction_group_ledger_state_deltas_for_round_200_response.rs b/crates/algo_fetch/src/models/get_transaction_group_ledger_state_deltas_for_round_200_response.rs new file mode 100644 index 0000000..c23cca7 --- /dev/null +++ b/crates/algo_fetch/src/models/get_transaction_group_ledger_state_deltas_for_round_200_response.rs @@ -0,0 +1,27 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct GetTransactionGroupLedgerStateDeltasForRound200Response { + #[serde(rename = "Deltas")] + pub deltas: Vec, +} + +impl GetTransactionGroupLedgerStateDeltasForRound200Response { + pub fn new(deltas: Vec) -> GetTransactionGroupLedgerStateDeltasForRound200Response { + GetTransactionGroupLedgerStateDeltasForRound200Response { + deltas, + } + } +} + diff --git a/crates/algo_fetch/src/models/get_transaction_proof_200_response.rs b/crates/algo_fetch/src/models/get_transaction_proof_200_response.rs new file mode 100644 index 0000000..9053b58 --- /dev/null +++ b/crates/algo_fetch/src/models/get_transaction_proof_200_response.rs @@ -0,0 +1,63 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +use serde_with::serde_as; + +#[serde_as] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct GetTransactionProof200Response { + /// The type of hash function used to create the proof, must be one of: * sha512_256 * sha256 + #[serde(rename = "hashtype")] + pub hashtype: Hashtype, + /// Index of the transaction in the block's payset. + #[serde(rename = "idx")] + pub idx: i32, + /// Proof of transaction membership. + #[serde_as(as = "serde_with::base64::Base64")] + #[serde(rename = "proof")] + pub proof: Vec, + /// Hash of SignedTxnInBlock for verifying proof. + #[serde_as(as = "serde_with::base64::Base64")] + #[serde(rename = "stibhash")] + pub stibhash: Vec, + /// Represents the depth of the tree that is being proven, i.e. the number of edges from a leaf to the root. + #[serde(rename = "treedepth")] + pub treedepth: i32, +} + +impl GetTransactionProof200Response { + pub fn new(hashtype: Hashtype, idx: i32, proof: Vec, stibhash: Vec, treedepth: i32) -> GetTransactionProof200Response { + GetTransactionProof200Response { + hashtype, + idx, + proof, + stibhash, + treedepth, + } + } +} +/// The type of hash function used to create the proof, must be one of: * sha512_256 * sha256 +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum Hashtype { + #[serde(rename = "sha512_256")] + Sha512256, + #[serde(rename = "sha256")] + Sha256, +} + +impl Default for Hashtype { + fn default() -> Hashtype { + Self::Sha512256 + } +} + diff --git a/crates/algo_fetch/src/models/kv_delta.rs b/crates/algo_fetch/src/models/kv_delta.rs new file mode 100644 index 0000000..40bb815 --- /dev/null +++ b/crates/algo_fetch/src/models/kv_delta.rs @@ -0,0 +1,39 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +use serde_with::serde_as; + +/// KvDelta : A single Delta containing the key, the previous value and the current value for a single round. +#[serde_as] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct KvDelta { + /// The key, base64 encoded. + #[serde_as(as = "Option")] + #[serde(rename = "key", skip_serializing_if = "Option::is_none")] + pub key: Option>, + /// The new value of the KV store entry, base64 encoded. + #[serde_as(as = "Option")] + #[serde(rename = "value", skip_serializing_if = "Option::is_none")] + pub value: Option>, +} + +impl KvDelta { + /// A single Delta containing the key, the previous value and the current value for a single round. + pub fn new() -> KvDelta { + KvDelta { + key: None, + value: None, + } + } +} + diff --git a/crates/algo_fetch/src/models/ledger_state_delta_for_transaction_group.rs b/crates/algo_fetch/src/models/ledger_state_delta_for_transaction_group.rs new file mode 100644 index 0000000..a2e81da --- /dev/null +++ b/crates/algo_fetch/src/models/ledger_state_delta_for_transaction_group.rs @@ -0,0 +1,33 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// LedgerStateDeltaForTransactionGroup : Contains a ledger delta for a single transaction group +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct LedgerStateDeltaForTransactionGroup { + /// Ledger StateDelta object + #[serde(rename = "Delta")] + pub delta: serde_json::Value, + #[serde(rename = "Ids")] + pub ids: Vec, +} + +impl LedgerStateDeltaForTransactionGroup { + /// Contains a ledger delta for a single transaction group + pub fn new(delta: serde_json::Value, ids: Vec) -> LedgerStateDeltaForTransactionGroup { + LedgerStateDeltaForTransactionGroup { + delta, + ids, + } + } +} + diff --git a/crates/algo_fetch/src/models/light_block_header_proof.rs b/crates/algo_fetch/src/models/light_block_header_proof.rs new file mode 100644 index 0000000..034b2fe --- /dev/null +++ b/crates/algo_fetch/src/models/light_block_header_proof.rs @@ -0,0 +1,42 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +use serde_with::serde_as; + +/// LightBlockHeaderProof : Proof of membership and position of a light block header. +#[serde_as] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct LightBlockHeaderProof { + /// The index of the light block header in the vector commitment tree + #[serde(rename = "index")] + pub index: i32, + /// The encoded proof. + #[serde_as(as = "serde_with::base64::Base64")] + #[serde(rename = "proof")] + pub proof: Vec, + /// Represents the depth of the tree that is being proven, i.e. the number of edges from a leaf to the root. + #[serde(rename = "treedepth")] + pub treedepth: i32, +} + +impl LightBlockHeaderProof { + /// Proof of membership and position of a light block header. + pub fn new(index: i32, proof: Vec, treedepth: i32) -> LightBlockHeaderProof { + LightBlockHeaderProof { + index, + proof, + treedepth, + } + } +} + diff --git a/crates/algo_fetch/src/models/mod.rs b/crates/algo_fetch/src/models/mod.rs new file mode 100644 index 0000000..29d243a --- /dev/null +++ b/crates/algo_fetch/src/models/mod.rs @@ -0,0 +1,152 @@ +pub mod abort_catchup_200_response; +pub use self::abort_catchup_200_response::AbortCatchup200Response; +pub mod account; +pub use self::account::Account; +pub mod account_application_information_200_response; +pub use self::account_application_information_200_response::AccountApplicationInformation200Response; +pub mod account_asset_holding; +pub use self::account_asset_holding::AccountAssetHolding; +pub mod account_asset_information_200_response; +pub use self::account_asset_information_200_response::AccountAssetInformation200Response; +pub mod account_assets_information_200_response; +pub use self::account_assets_information_200_response::AccountAssetsInformation200Response; +pub mod account_participation; +pub use self::account_participation::AccountParticipation; +pub mod account_state_delta; +pub use self::account_state_delta::AccountStateDelta; +pub mod add_participation_key_200_response; +pub use self::add_participation_key_200_response::AddParticipationKey200Response; +pub mod app_call_logs; +pub use self::app_call_logs::AppCallLogs; +pub mod application; +pub use self::application::Application; +pub mod application_initial_states; +pub use self::application_initial_states::ApplicationInitialStates; +pub mod application_kv_storage; +pub use self::application_kv_storage::ApplicationKvStorage; +pub mod application_local_reference; +pub use self::application_local_reference::ApplicationLocalReference; +pub mod application_local_state; +pub use self::application_local_state::ApplicationLocalState; +pub mod application_params; +pub use self::application_params::ApplicationParams; +pub mod application_state_operation; +pub use self::application_state_operation::ApplicationStateOperation; +pub mod application_state_schema; +pub use self::application_state_schema::ApplicationStateSchema; +pub mod asset; +pub use self::asset::Asset; +pub mod asset_holding; +pub use self::asset_holding::AssetHolding; +pub mod asset_holding_reference; +pub use self::asset_holding_reference::AssetHoldingReference; +pub mod asset_params; +pub use self::asset_params::AssetParams; +pub mod avm_key_value; +pub use self::avm_key_value::AvmKeyValue; +pub mod avm_value; +pub use self::avm_value::AvmValue; +pub mod model_box; +pub use self::model_box::Box; +pub mod box_descriptor; +pub use self::box_descriptor::BoxDescriptor; +pub mod box_reference; +pub use self::box_reference::BoxReference; +pub mod build_version; +pub use self::build_version::BuildVersion; +pub mod debug_settings_prof; +pub use self::debug_settings_prof::DebugSettingsProf; +pub mod dryrun_request; +pub use self::dryrun_request::DryrunRequest; +pub mod dryrun_source; +pub use self::dryrun_source::DryrunSource; +pub mod dryrun_state; +pub use self::dryrun_state::DryrunState; +pub mod dryrun_txn_result; +pub use self::dryrun_txn_result::DryrunTxnResult; +pub mod error_response; +pub use self::error_response::ErrorResponse; +pub mod eval_delta; +pub use self::eval_delta::EvalDelta; +pub mod eval_delta_key_value; +pub use self::eval_delta_key_value::EvalDeltaKeyValue; +pub mod get_application_boxes_200_response; +pub use self::get_application_boxes_200_response::GetApplicationBoxes200Response; +pub mod get_block_200_response; +pub use self::get_block_200_response::GetBlock200Response; +pub mod get_block_hash_200_response; +pub use self::get_block_hash_200_response::GetBlockHash200Response; +pub mod get_block_logs_200_response; +pub use self::get_block_logs_200_response::GetBlockLogs200Response; +pub mod get_block_time_stamp_offset_200_response; +pub use self::get_block_time_stamp_offset_200_response::GetBlockTimeStampOffset200Response; +pub mod get_block_txids_200_response; +pub use self::get_block_txids_200_response::GetBlockTxids200Response; +pub mod get_pending_transactions_by_address_200_response; +pub use self::get_pending_transactions_by_address_200_response::GetPendingTransactionsByAddress200Response; +pub mod get_status_200_response; +pub use self::get_status_200_response::GetStatus200Response; +pub mod get_supply_200_response; +pub use self::get_supply_200_response::GetSupply200Response; +pub mod get_sync_round_200_response; +pub use self::get_sync_round_200_response::GetSyncRound200Response; +pub mod get_transaction_group_ledger_state_deltas_for_round_200_response; +pub use self::get_transaction_group_ledger_state_deltas_for_round_200_response::GetTransactionGroupLedgerStateDeltasForRound200Response; +pub mod get_transaction_proof_200_response; +pub use self::get_transaction_proof_200_response::GetTransactionProof200Response; +pub mod kv_delta; +pub use self::kv_delta::KvDelta; +pub mod ledger_state_delta_for_transaction_group; +pub use self::ledger_state_delta_for_transaction_group::LedgerStateDeltaForTransactionGroup; +pub mod light_block_header_proof; +pub use self::light_block_header_proof::LightBlockHeaderProof; +pub mod participation_key; +pub use self::participation_key::ParticipationKey; +pub mod pending_transaction_response; +pub use self::pending_transaction_response::PendingTransactionResponse; +pub mod raw_transaction_200_response; +pub use self::raw_transaction_200_response::RawTransaction200Response; +pub mod scratch_change; +pub use self::scratch_change::ScratchChange; +pub mod simulate_initial_states; +pub use self::simulate_initial_states::SimulateInitialStates; +pub mod simulate_request; +pub use self::simulate_request::SimulateRequest; +pub mod simulate_request_transaction_group; +pub use self::simulate_request_transaction_group::SimulateRequestTransactionGroup; +pub mod simulate_trace_config; +pub use self::simulate_trace_config::SimulateTraceConfig; +pub mod simulate_transaction_200_response; +pub use self::simulate_transaction_200_response::SimulateTransaction200Response; +pub mod simulate_transaction_group_result; +pub use self::simulate_transaction_group_result::SimulateTransactionGroupResult; +pub mod simulate_transaction_result; +pub use self::simulate_transaction_result::SimulateTransactionResult; +pub mod simulate_unnamed_resources_accessed; +pub use self::simulate_unnamed_resources_accessed::SimulateUnnamedResourcesAccessed; +pub mod simulation_eval_overrides; +pub use self::simulation_eval_overrides::SimulationEvalOverrides; +pub mod simulation_opcode_trace_unit; +pub use self::simulation_opcode_trace_unit::SimulationOpcodeTraceUnit; +pub mod simulation_transaction_exec_trace; +pub use self::simulation_transaction_exec_trace::SimulationTransactionExecTrace; +pub mod start_catchup_200_response; +pub use self::start_catchup_200_response::StartCatchup200Response; +pub mod state_proof; +pub use self::state_proof::StateProof; +pub mod state_proof_message; +pub use self::state_proof_message::StateProofMessage; +pub mod teal_compile_200_response; +pub use self::teal_compile_200_response::TealCompile200Response; +pub mod teal_disassemble_200_response; +pub use self::teal_disassemble_200_response::TealDisassemble200Response; +pub mod teal_dryrun_200_response; +pub use self::teal_dryrun_200_response::TealDryrun200Response; +pub mod teal_key_value; +pub use self::teal_key_value::TealKeyValue; +pub mod teal_value; +pub use self::teal_value::TealValue; +pub mod transaction_params_200_response; +pub use self::transaction_params_200_response::TransactionParams200Response; +pub mod version; +pub use self::version::Version; diff --git a/crates/algo_fetch/src/models/model_box.rs b/crates/algo_fetch/src/models/model_box.rs new file mode 100644 index 0000000..0e1de3f --- /dev/null +++ b/crates/algo_fetch/src/models/model_box.rs @@ -0,0 +1,43 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +use serde_with::serde_as; + +/// Box : Box name and its content. +#[serde_as] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct Box { + /// \\[name\\] box name, base64 encoded + #[serde_as(as = "serde_with::base64::Base64")] + #[serde(rename = "name")] + pub name: Vec, + /// The round for which this information is relevant + #[serde(rename = "round")] + pub round: i32, + /// \\[value\\] box value, base64 encoded. + #[serde_as(as = "serde_with::base64::Base64")] + #[serde(rename = "value")] + pub value: Vec, +} + +impl Box { + /// Box name and its content. + pub fn new(name: Vec, round: i32, value: Vec) -> Box { + Box { + name, + round, + value, + } + } +} + diff --git a/crates/algo_fetch/src/models/participation_key.rs b/crates/algo_fetch/src/models/participation_key.rs new file mode 100644 index 0000000..e10a37f --- /dev/null +++ b/crates/algo_fetch/src/models/participation_key.rs @@ -0,0 +1,57 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// ParticipationKey : Represents a participation key used by the node. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct ParticipationKey { + /// Address the key was generated for. + #[serde(rename = "address")] + pub address: String, + /// When registered, this is the first round it may be used. + #[serde(rename = "effective-first-valid", skip_serializing_if = "Option::is_none")] + pub effective_first_valid: Option, + /// When registered, this is the last round it may be used. + #[serde(rename = "effective-last-valid", skip_serializing_if = "Option::is_none")] + pub effective_last_valid: Option, + /// The key's ParticipationID. + #[serde(rename = "id")] + pub id: String, + #[serde(rename = "key")] + pub key: Box, + /// Round when this key was last used to propose a block. + #[serde(rename = "last-block-proposal", skip_serializing_if = "Option::is_none")] + pub last_block_proposal: Option, + /// Round when this key was last used to generate a state proof. + #[serde(rename = "last-state-proof", skip_serializing_if = "Option::is_none")] + pub last_state_proof: Option, + /// Round when this key was last used to vote. + #[serde(rename = "last-vote", skip_serializing_if = "Option::is_none")] + pub last_vote: Option, +} + +impl ParticipationKey { + /// Represents a participation key used by the node. + pub fn new(address: String, id: String, key: models::AccountParticipation) -> ParticipationKey { + ParticipationKey { + address, + effective_first_valid: None, + effective_last_valid: None, + id, + key: Box::new(key), + last_block_proposal: None, + last_state_proof: None, + last_vote: None, + } + } +} + diff --git a/crates/algo_fetch/src/models/pending_transaction_response.rs b/crates/algo_fetch/src/models/pending_transaction_response.rs new file mode 100644 index 0000000..ed4ce21 --- /dev/null +++ b/crates/algo_fetch/src/models/pending_transaction_response.rs @@ -0,0 +1,82 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// PendingTransactionResponse : Details about a pending transaction. If the transaction was recently confirmed, includes confirmation details like the round and reward details. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct PendingTransactionResponse { + /// The application index if the transaction was found and it created an application. + #[serde(rename = "application-index", skip_serializing_if = "Option::is_none")] + pub application_index: Option, + /// The number of the asset's unit that were transferred to the close-to address. + #[serde(rename = "asset-closing-amount", skip_serializing_if = "Option::is_none")] + pub asset_closing_amount: Option, + /// The asset index if the transaction was found and it created an asset. + #[serde(rename = "asset-index", skip_serializing_if = "Option::is_none")] + pub asset_index: Option, + /// Rewards in microalgos applied to the close remainder to account. + #[serde(rename = "close-rewards", skip_serializing_if = "Option::is_none")] + pub close_rewards: Option, + /// Closing amount for the transaction. + #[serde(rename = "closing-amount", skip_serializing_if = "Option::is_none")] + pub closing_amount: Option, + /// The round where this transaction was confirmed, if present. + #[serde(rename = "confirmed-round", skip_serializing_if = "Option::is_none")] + pub confirmed_round: Option, + /// Application state delta. + #[serde(rename = "global-state-delta", skip_serializing_if = "Option::is_none")] + pub global_state_delta: Option>, + /// Inner transactions produced by application execution. + #[serde(rename = "inner-txns", skip_serializing_if = "Option::is_none")] + pub inner_txns: Option>, + /// Local state key/value changes for the application being executed by this transaction. + #[serde(rename = "local-state-delta", skip_serializing_if = "Option::is_none")] + pub local_state_delta: Option>, + /// Logs for the application being executed by this transaction. + #[serde(rename = "logs", skip_serializing_if = "Option::is_none")] + pub logs: Option>, + /// Indicates that the transaction was kicked out of this node's transaction pool (and specifies why that happened). An empty string indicates the transaction wasn't kicked out of this node's txpool due to an error. + #[serde(rename = "pool-error")] + pub pool_error: String, + /// Rewards in microalgos applied to the receiver account. + #[serde(rename = "receiver-rewards", skip_serializing_if = "Option::is_none")] + pub receiver_rewards: Option, + /// Rewards in microalgos applied to the sender account. + #[serde(rename = "sender-rewards", skip_serializing_if = "Option::is_none")] + pub sender_rewards: Option, + /// The raw signed transaction. + #[serde(rename = "txn")] + pub txn: serde_json::Value, +} + +impl PendingTransactionResponse { + /// Details about a pending transaction. If the transaction was recently confirmed, includes confirmation details like the round and reward details. + pub fn new(pool_error: String, txn: serde_json::Value) -> PendingTransactionResponse { + PendingTransactionResponse { + application_index: None, + asset_closing_amount: None, + asset_index: None, + close_rewards: None, + closing_amount: None, + confirmed_round: None, + global_state_delta: None, + inner_txns: None, + local_state_delta: None, + logs: None, + pool_error, + receiver_rewards: None, + sender_rewards: None, + txn, + } + } +} + diff --git a/crates/algo_fetch/src/models/raw_transaction_200_response.rs b/crates/algo_fetch/src/models/raw_transaction_200_response.rs new file mode 100644 index 0000000..d62b39c --- /dev/null +++ b/crates/algo_fetch/src/models/raw_transaction_200_response.rs @@ -0,0 +1,28 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct RawTransaction200Response { + /// encoding of the transaction hash. + #[serde(rename = "txId")] + pub tx_id: String, +} + +impl RawTransaction200Response { + pub fn new(tx_id: String) -> RawTransaction200Response { + RawTransaction200Response { + tx_id, + } + } +} + diff --git a/crates/algo_fetch/src/models/scratch_change.rs b/crates/algo_fetch/src/models/scratch_change.rs new file mode 100644 index 0000000..d7896c0 --- /dev/null +++ b/crates/algo_fetch/src/models/scratch_change.rs @@ -0,0 +1,33 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// ScratchChange : A write operation into a scratch slot. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct ScratchChange { + #[serde(rename = "new-value")] + pub new_value: Box, + /// The scratch slot written. + #[serde(rename = "slot")] + pub slot: i32, +} + +impl ScratchChange { + /// A write operation into a scratch slot. + pub fn new(new_value: models::AvmValue, slot: i32) -> ScratchChange { + ScratchChange { + new_value: Box::new(new_value), + slot, + } + } +} + diff --git a/crates/algo_fetch/src/models/simulate_initial_states.rs b/crates/algo_fetch/src/models/simulate_initial_states.rs new file mode 100644 index 0000000..1f606e0 --- /dev/null +++ b/crates/algo_fetch/src/models/simulate_initial_states.rs @@ -0,0 +1,30 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// SimulateInitialStates : Initial states of resources that were accessed during simulation. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct SimulateInitialStates { + /// The initial states of accessed application before simulation. The order of this array is arbitrary. + #[serde(rename = "app-initial-states", skip_serializing_if = "Option::is_none")] + pub app_initial_states: Option>, +} + +impl SimulateInitialStates { + /// Initial states of resources that were accessed during simulation. + pub fn new() -> SimulateInitialStates { + SimulateInitialStates { + app_initial_states: None, + } + } +} + diff --git a/crates/algo_fetch/src/models/simulate_request.rs b/crates/algo_fetch/src/models/simulate_request.rs new file mode 100644 index 0000000..34d0178 --- /dev/null +++ b/crates/algo_fetch/src/models/simulate_request.rs @@ -0,0 +1,57 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// SimulateRequest : Request type for simulation endpoint. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct SimulateRequest { + /// Allows transactions without signatures to be simulated as if they had correct signatures. + #[serde(rename = "allow-empty-signatures", skip_serializing_if = "Option::is_none")] + pub allow_empty_signatures: Option, + /// Lifts limits on log opcode usage during simulation. + #[serde(rename = "allow-more-logging", skip_serializing_if = "Option::is_none")] + pub allow_more_logging: Option, + /// Allows access to unnamed resources during simulation. + #[serde(rename = "allow-unnamed-resources", skip_serializing_if = "Option::is_none")] + pub allow_unnamed_resources: Option, + #[serde(rename = "exec-trace-config", skip_serializing_if = "Option::is_none")] + pub exec_trace_config: Option>, + /// Applies extra opcode budget during simulation for each transaction group. + #[serde(rename = "extra-opcode-budget", skip_serializing_if = "Option::is_none")] + pub extra_opcode_budget: Option, + /// If true, signers for transactions that are missing signatures will be fixed during evaluation. + #[serde(rename = "fix-signers", skip_serializing_if = "Option::is_none")] + pub fix_signers: Option, + /// If provided, specifies the round preceding the simulation. State changes through this round will be used to run this simulation. Usually only the 4 most recent rounds will be available (controlled by the node config value MaxAcctLookback). If not specified, defaults to the latest available round. + #[serde(rename = "round", skip_serializing_if = "Option::is_none")] + pub round: Option, + /// The transaction groups to simulate. + #[serde(rename = "txn-groups")] + pub txn_groups: Vec, +} + +impl SimulateRequest { + /// Request type for simulation endpoint. + pub fn new(txn_groups: Vec) -> SimulateRequest { + SimulateRequest { + allow_empty_signatures: None, + allow_more_logging: None, + allow_unnamed_resources: None, + exec_trace_config: None, + extra_opcode_budget: None, + fix_signers: None, + round: None, + txn_groups, + } + } +} + diff --git a/crates/algo_fetch/src/models/simulate_request_transaction_group.rs b/crates/algo_fetch/src/models/simulate_request_transaction_group.rs new file mode 100644 index 0000000..8ede484 --- /dev/null +++ b/crates/algo_fetch/src/models/simulate_request_transaction_group.rs @@ -0,0 +1,30 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// SimulateRequestTransactionGroup : A transaction group to simulate. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct SimulateRequestTransactionGroup { + /// An atomic transaction group. + #[serde(rename = "txns")] + pub txns: Vec, +} + +impl SimulateRequestTransactionGroup { + /// A transaction group to simulate. + pub fn new(txns: Vec) -> SimulateRequestTransactionGroup { + SimulateRequestTransactionGroup { + txns, + } + } +} + diff --git a/crates/algo_fetch/src/models/simulate_trace_config.rs b/crates/algo_fetch/src/models/simulate_trace_config.rs new file mode 100644 index 0000000..0f1c69b --- /dev/null +++ b/crates/algo_fetch/src/models/simulate_trace_config.rs @@ -0,0 +1,42 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// SimulateTraceConfig : An object that configures simulation execution trace. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct SimulateTraceConfig { + /// A boolean option for opting in execution trace features simulation endpoint. + #[serde(rename = "enable", skip_serializing_if = "Option::is_none")] + pub enable: Option, + /// A boolean option enabling returning scratch slot changes together with execution trace during simulation. + #[serde(rename = "scratch-change", skip_serializing_if = "Option::is_none")] + pub scratch_change: Option, + /// A boolean option enabling returning stack changes together with execution trace during simulation. + #[serde(rename = "stack-change", skip_serializing_if = "Option::is_none")] + pub stack_change: Option, + /// A boolean option enabling returning application state changes (global, local, and box changes) with the execution trace during simulation. + #[serde(rename = "state-change", skip_serializing_if = "Option::is_none")] + pub state_change: Option, +} + +impl SimulateTraceConfig { + /// An object that configures simulation execution trace. + pub fn new() -> SimulateTraceConfig { + SimulateTraceConfig { + enable: None, + scratch_change: None, + stack_change: None, + state_change: None, + } + } +} + diff --git a/crates/algo_fetch/src/models/simulate_transaction_200_response.rs b/crates/algo_fetch/src/models/simulate_transaction_200_response.rs new file mode 100644 index 0000000..c14058d --- /dev/null +++ b/crates/algo_fetch/src/models/simulate_transaction_200_response.rs @@ -0,0 +1,45 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct SimulateTransaction200Response { + #[serde(rename = "eval-overrides", skip_serializing_if = "Option::is_none")] + pub eval_overrides: Option>, + #[serde(rename = "exec-trace-config", skip_serializing_if = "Option::is_none")] + pub exec_trace_config: Option>, + #[serde(rename = "initial-states", skip_serializing_if = "Option::is_none")] + pub initial_states: Option>, + /// The round immediately preceding this simulation. State changes through this round were used to run this simulation. + #[serde(rename = "last-round")] + pub last_round: i32, + /// A result object for each transaction group that was simulated. + #[serde(rename = "txn-groups")] + pub txn_groups: Vec, + /// The version of this response object. + #[serde(rename = "version")] + pub version: i32, +} + +impl SimulateTransaction200Response { + pub fn new(last_round: i32, txn_groups: Vec, version: i32) -> SimulateTransaction200Response { + SimulateTransaction200Response { + eval_overrides: None, + exec_trace_config: None, + initial_states: None, + last_round, + txn_groups, + version, + } + } +} + diff --git a/crates/algo_fetch/src/models/simulate_transaction_group_result.rs b/crates/algo_fetch/src/models/simulate_transaction_group_result.rs new file mode 100644 index 0000000..7c9f7b6 --- /dev/null +++ b/crates/algo_fetch/src/models/simulate_transaction_group_result.rs @@ -0,0 +1,49 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// SimulateTransactionGroupResult : Simulation result for an atomic transaction group +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct SimulateTransactionGroupResult { + /// Total budget added during execution of app calls in the transaction group. + #[serde(rename = "app-budget-added", skip_serializing_if = "Option::is_none")] + pub app_budget_added: Option, + /// Total budget consumed during execution of app calls in the transaction group. + #[serde(rename = "app-budget-consumed", skip_serializing_if = "Option::is_none")] + pub app_budget_consumed: Option, + /// If present, indicates which transaction in this group caused the failure. This array represents the path to the failing transaction. Indexes are zero based, the first element indicates the top-level transaction, and successive elements indicate deeper inner transactions. + #[serde(rename = "failed-at", skip_serializing_if = "Option::is_none")] + pub failed_at: Option>, + /// If present, indicates that the transaction group failed and specifies why that happened + #[serde(rename = "failure-message", skip_serializing_if = "Option::is_none")] + pub failure_message: Option, + /// Simulation result for individual transactions + #[serde(rename = "txn-results")] + pub txn_results: Vec, + #[serde(rename = "unnamed-resources-accessed", skip_serializing_if = "Option::is_none")] + pub unnamed_resources_accessed: Option>, +} + +impl SimulateTransactionGroupResult { + /// Simulation result for an atomic transaction group + pub fn new(txn_results: Vec) -> SimulateTransactionGroupResult { + SimulateTransactionGroupResult { + app_budget_added: None, + app_budget_consumed: None, + failed_at: None, + failure_message: None, + txn_results, + unnamed_resources_accessed: None, + } + } +} + diff --git a/crates/algo_fetch/src/models/simulate_transaction_result.rs b/crates/algo_fetch/src/models/simulate_transaction_result.rs new file mode 100644 index 0000000..102d2a1 --- /dev/null +++ b/crates/algo_fetch/src/models/simulate_transaction_result.rs @@ -0,0 +1,47 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// SimulateTransactionResult : Simulation result for an individual transaction +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct SimulateTransactionResult { + /// Budget used during execution of an app call transaction. This value includes budged used by inner app calls spawned by this transaction. + #[serde(rename = "app-budget-consumed", skip_serializing_if = "Option::is_none")] + pub app_budget_consumed: Option, + #[serde(rename = "exec-trace", skip_serializing_if = "Option::is_none")] + pub exec_trace: Option>, + /// The account that needed to sign this transaction when no signature was provided and the provided signer was incorrect. + #[serde(rename = "fixed-signer", skip_serializing_if = "Option::is_none")] + pub fixed_signer: Option, + /// Budget used during execution of a logic sig transaction. + #[serde(rename = "logic-sig-budget-consumed", skip_serializing_if = "Option::is_none")] + pub logic_sig_budget_consumed: Option, + #[serde(rename = "txn-result")] + pub txn_result: Box, + #[serde(rename = "unnamed-resources-accessed", skip_serializing_if = "Option::is_none")] + pub unnamed_resources_accessed: Option>, +} + +impl SimulateTransactionResult { + /// Simulation result for an individual transaction + pub fn new(txn_result: models::PendingTransactionResponse) -> SimulateTransactionResult { + SimulateTransactionResult { + app_budget_consumed: None, + exec_trace: None, + fixed_signer: None, + logic_sig_budget_consumed: None, + txn_result: Box::new(txn_result), + unnamed_resources_accessed: None, + } + } +} + diff --git a/crates/algo_fetch/src/models/simulate_unnamed_resources_accessed.rs b/crates/algo_fetch/src/models/simulate_unnamed_resources_accessed.rs new file mode 100644 index 0000000..fc56f86 --- /dev/null +++ b/crates/algo_fetch/src/models/simulate_unnamed_resources_accessed.rs @@ -0,0 +1,54 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// SimulateUnnamedResourcesAccessed : These are resources that were accessed by this group that would normally have caused failure, but were allowed in simulation. Depending on where this object is in the response, the unnamed resources it contains may or may not qualify for group resource sharing. If this is a field in SimulateTransactionGroupResult, the resources do qualify, but if this is a field in SimulateTransactionResult, they do not qualify. In order to make this group valid for actual submission, resources that qualify for group sharing can be made available by any transaction of the group; otherwise, resources must be placed in the same transaction which accessed them. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct SimulateUnnamedResourcesAccessed { + /// The unnamed accounts that were referenced. The order of this array is arbitrary. + #[serde(rename = "accounts", skip_serializing_if = "Option::is_none")] + pub accounts: Option>, + /// The unnamed application local states that were referenced. The order of this array is arbitrary. + #[serde(rename = "app-locals", skip_serializing_if = "Option::is_none")] + pub app_locals: Option>, + /// The unnamed applications that were referenced. The order of this array is arbitrary. + #[serde(rename = "apps", skip_serializing_if = "Option::is_none")] + pub apps: Option>, + /// The unnamed asset holdings that were referenced. The order of this array is arbitrary. + #[serde(rename = "asset-holdings", skip_serializing_if = "Option::is_none")] + pub asset_holdings: Option>, + /// The unnamed assets that were referenced. The order of this array is arbitrary. + #[serde(rename = "assets", skip_serializing_if = "Option::is_none")] + pub assets: Option>, + /// The unnamed boxes that were referenced. The order of this array is arbitrary. + #[serde(rename = "boxes", skip_serializing_if = "Option::is_none")] + pub boxes: Option>, + /// The number of extra box references used to increase the IO budget. This is in addition to the references defined in the input transaction group and any referenced to unnamed boxes. + #[serde(rename = "extra-box-refs", skip_serializing_if = "Option::is_none")] + pub extra_box_refs: Option, +} + +impl SimulateUnnamedResourcesAccessed { + /// These are resources that were accessed by this group that would normally have caused failure, but were allowed in simulation. Depending on where this object is in the response, the unnamed resources it contains may or may not qualify for group resource sharing. If this is a field in SimulateTransactionGroupResult, the resources do qualify, but if this is a field in SimulateTransactionResult, they do not qualify. In order to make this group valid for actual submission, resources that qualify for group sharing can be made available by any transaction of the group; otherwise, resources must be placed in the same transaction which accessed them. + pub fn new() -> SimulateUnnamedResourcesAccessed { + SimulateUnnamedResourcesAccessed { + accounts: None, + app_locals: None, + apps: None, + asset_holdings: None, + assets: None, + boxes: None, + extra_box_refs: None, + } + } +} + diff --git a/crates/algo_fetch/src/models/simulation_eval_overrides.rs b/crates/algo_fetch/src/models/simulation_eval_overrides.rs new file mode 100644 index 0000000..2f30ed9 --- /dev/null +++ b/crates/algo_fetch/src/models/simulation_eval_overrides.rs @@ -0,0 +1,50 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// SimulationEvalOverrides : The set of parameters and limits override during simulation. If this set of parameters is present, then evaluation parameters may differ from standard evaluation in certain ways. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct SimulationEvalOverrides { + /// If true, transactions without signatures are allowed and simulated as if they were properly signed. + #[serde(rename = "allow-empty-signatures", skip_serializing_if = "Option::is_none")] + pub allow_empty_signatures: Option, + /// If true, allows access to unnamed resources during simulation. + #[serde(rename = "allow-unnamed-resources", skip_serializing_if = "Option::is_none")] + pub allow_unnamed_resources: Option, + /// The extra opcode budget added to each transaction group during simulation + #[serde(rename = "extra-opcode-budget", skip_serializing_if = "Option::is_none")] + pub extra_opcode_budget: Option, + /// If true, signers for transactions that are missing signatures will be fixed during evaluation. + #[serde(rename = "fix-signers", skip_serializing_if = "Option::is_none")] + pub fix_signers: Option, + /// The maximum log calls one can make during simulation + #[serde(rename = "max-log-calls", skip_serializing_if = "Option::is_none")] + pub max_log_calls: Option, + /// The maximum byte number to log during simulation + #[serde(rename = "max-log-size", skip_serializing_if = "Option::is_none")] + pub max_log_size: Option, +} + +impl SimulationEvalOverrides { + /// The set of parameters and limits override during simulation. If this set of parameters is present, then evaluation parameters may differ from standard evaluation in certain ways. + pub fn new() -> SimulationEvalOverrides { + SimulationEvalOverrides { + allow_empty_signatures: None, + allow_unnamed_resources: None, + extra_opcode_budget: None, + fix_signers: None, + max_log_calls: None, + max_log_size: None, + } + } +} + diff --git a/crates/algo_fetch/src/models/simulation_opcode_trace_unit.rs b/crates/algo_fetch/src/models/simulation_opcode_trace_unit.rs new file mode 100644 index 0000000..44fd19a --- /dev/null +++ b/crates/algo_fetch/src/models/simulation_opcode_trace_unit.rs @@ -0,0 +1,50 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// SimulationOpcodeTraceUnit : The set of trace information and effect from evaluating a single opcode. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct SimulationOpcodeTraceUnit { + /// The program counter of the current opcode being evaluated. + #[serde(rename = "pc")] + pub pc: i32, + /// The writes into scratch slots. + #[serde(rename = "scratch-changes", skip_serializing_if = "Option::is_none")] + pub scratch_changes: Option>, + /// The indexes of the traces for inner transactions spawned by this opcode, if any. + #[serde(rename = "spawned-inners", skip_serializing_if = "Option::is_none")] + pub spawned_inners: Option>, + /// The values added by this opcode to the stack. + #[serde(rename = "stack-additions", skip_serializing_if = "Option::is_none")] + pub stack_additions: Option>, + /// The number of deleted stack values by this opcode. + #[serde(rename = "stack-pop-count", skip_serializing_if = "Option::is_none")] + pub stack_pop_count: Option, + /// The operations against the current application's states. + #[serde(rename = "state-changes", skip_serializing_if = "Option::is_none")] + pub state_changes: Option>, +} + +impl SimulationOpcodeTraceUnit { + /// The set of trace information and effect from evaluating a single opcode. + pub fn new(pc: i32) -> SimulationOpcodeTraceUnit { + SimulationOpcodeTraceUnit { + pc, + scratch_changes: None, + spawned_inners: None, + stack_additions: None, + stack_pop_count: None, + state_changes: None, + } + } +} + diff --git a/crates/algo_fetch/src/models/simulation_transaction_exec_trace.rs b/crates/algo_fetch/src/models/simulation_transaction_exec_trace.rs new file mode 100644 index 0000000..5f3661d --- /dev/null +++ b/crates/algo_fetch/src/models/simulation_transaction_exec_trace.rs @@ -0,0 +1,68 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +use serde_with::serde_as; + +/// SimulationTransactionExecTrace : The execution trace of calling an app or a logic sig, containing the inner app call trace in a recursive way. +#[serde_as] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct SimulationTransactionExecTrace { + /// SHA512_256 hash digest of the approval program executed in transaction. + #[serde_as(as = "Option")] + #[serde(rename = "approval-program-hash", skip_serializing_if = "Option::is_none")] + pub approval_program_hash: Option>, + /// Program trace that contains a trace of opcode effects in an approval program. + #[serde(rename = "approval-program-trace", skip_serializing_if = "Option::is_none")] + pub approval_program_trace: Option>, + /// SHA512_256 hash digest of the clear state program executed in transaction. + #[serde_as(as = "Option")] + #[serde(rename = "clear-state-program-hash", skip_serializing_if = "Option::is_none")] + pub clear_state_program_hash: Option>, + /// Program trace that contains a trace of opcode effects in a clear state program. + #[serde(rename = "clear-state-program-trace", skip_serializing_if = "Option::is_none")] + pub clear_state_program_trace: Option>, + /// If true, indicates that the clear state program failed and any persistent state changes it produced should be reverted once the program exits. + #[serde(rename = "clear-state-rollback", skip_serializing_if = "Option::is_none")] + pub clear_state_rollback: Option, + /// The error message explaining why the clear state program failed. This field will only be populated if clear-state-rollback is true and the failure was due to an execution error. + #[serde(rename = "clear-state-rollback-error", skip_serializing_if = "Option::is_none")] + pub clear_state_rollback_error: Option, + /// An array of SimulationTransactionExecTrace representing the execution trace of any inner transactions executed. + #[serde(rename = "inner-trace", skip_serializing_if = "Option::is_none")] + pub inner_trace: Option>, + /// SHA512_256 hash digest of the logic sig executed in transaction. + #[serde_as(as = "Option")] + #[serde(rename = "logic-sig-hash", skip_serializing_if = "Option::is_none")] + pub logic_sig_hash: Option>, + /// Program trace that contains a trace of opcode effects in a logic sig. + #[serde(rename = "logic-sig-trace", skip_serializing_if = "Option::is_none")] + pub logic_sig_trace: Option>, +} + +impl SimulationTransactionExecTrace { + /// The execution trace of calling an app or a logic sig, containing the inner app call trace in a recursive way. + pub fn new() -> SimulationTransactionExecTrace { + SimulationTransactionExecTrace { + approval_program_hash: None, + approval_program_trace: None, + clear_state_program_hash: None, + clear_state_program_trace: None, + clear_state_rollback: None, + clear_state_rollback_error: None, + inner_trace: None, + logic_sig_hash: None, + logic_sig_trace: None, + } + } +} + diff --git a/crates/algo_fetch/src/models/start_catchup_200_response.rs b/crates/algo_fetch/src/models/start_catchup_200_response.rs new file mode 100644 index 0000000..ae1d9da --- /dev/null +++ b/crates/algo_fetch/src/models/start_catchup_200_response.rs @@ -0,0 +1,30 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// StartCatchup200Response : An catchpoint start response. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct StartCatchup200Response { + /// Catchup start response string + #[serde(rename = "catchup-message")] + pub catchup_message: String, +} + +impl StartCatchup200Response { + /// An catchpoint start response. + pub fn new(catchup_message: String) -> StartCatchup200Response { + StartCatchup200Response { + catchup_message, + } + } +} + diff --git a/crates/algo_fetch/src/models/state_proof.rs b/crates/algo_fetch/src/models/state_proof.rs new file mode 100644 index 0000000..e3ea3b5 --- /dev/null +++ b/crates/algo_fetch/src/models/state_proof.rs @@ -0,0 +1,37 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +use serde_with::serde_as; + +/// StateProof : Represents a state proof and its corresponding message +#[serde_as] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct StateProof { + #[serde(rename = "Message")] + pub message: Box, + /// The encoded StateProof for the message. + #[serde_as(as = "serde_with::base64::Base64")] + #[serde(rename = "StateProof")] + pub state_proof: Vec, +} + +impl StateProof { + /// Represents a state proof and its corresponding message + pub fn new(message: models::StateProofMessage, state_proof: Vec) -> StateProof { + StateProof { + message: Box::new(message), + state_proof, + } + } +} + diff --git a/crates/algo_fetch/src/models/state_proof_message.rs b/crates/algo_fetch/src/models/state_proof_message.rs new file mode 100644 index 0000000..2fc58ff --- /dev/null +++ b/crates/algo_fetch/src/models/state_proof_message.rs @@ -0,0 +1,51 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +use serde_with::serde_as; + +/// StateProofMessage : Represents the message that the state proofs are attesting to. +#[serde_as] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct StateProofMessage { + /// The vector commitment root on all light block headers within a state proof interval. + #[serde_as(as = "serde_with::base64::Base64")] + #[serde(rename = "BlockHeadersCommitment")] + pub block_headers_commitment: Vec, + /// The first round the message attests to. + #[serde(rename = "FirstAttestedRound")] + pub first_attested_round: i32, + /// The last round the message attests to. + #[serde(rename = "LastAttestedRound")] + pub last_attested_round: i32, + /// An integer value representing the natural log of the proven weight with 16 bits of precision. This value would be used to verify the next state proof. + #[serde(rename = "LnProvenWeight")] + pub ln_proven_weight: i32, + /// The vector commitment root of the top N accounts to sign the next StateProof. + #[serde_as(as = "serde_with::base64::Base64")] + #[serde(rename = "VotersCommitment")] + pub voters_commitment: Vec, +} + +impl StateProofMessage { + /// Represents the message that the state proofs are attesting to. + pub fn new(block_headers_commitment: Vec, first_attested_round: i32, last_attested_round: i32, ln_proven_weight: i32, voters_commitment: Vec) -> StateProofMessage { + StateProofMessage { + block_headers_commitment, + first_attested_round, + last_attested_round, + ln_proven_weight, + voters_commitment, + } + } +} + diff --git a/crates/algo_fetch/src/models/teal_compile_200_response.rs b/crates/algo_fetch/src/models/teal_compile_200_response.rs new file mode 100644 index 0000000..19d3891 --- /dev/null +++ b/crates/algo_fetch/src/models/teal_compile_200_response.rs @@ -0,0 +1,36 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct TealCompile200Response { + /// base32 SHA512_256 of program bytes (Address style) + #[serde(rename = "hash")] + pub hash: String, + /// base64 encoded program bytes + #[serde(rename = "result")] + pub result: String, + /// JSON of the source map + #[serde(rename = "sourcemap", skip_serializing_if = "Option::is_none")] + pub sourcemap: Option, +} + +impl TealCompile200Response { + pub fn new(hash: String, result: String) -> TealCompile200Response { + TealCompile200Response { + hash, + result, + sourcemap: None, + } + } +} + diff --git a/crates/algo_fetch/src/models/teal_disassemble_200_response.rs b/crates/algo_fetch/src/models/teal_disassemble_200_response.rs new file mode 100644 index 0000000..176f2e0 --- /dev/null +++ b/crates/algo_fetch/src/models/teal_disassemble_200_response.rs @@ -0,0 +1,28 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct TealDisassemble200Response { + /// disassembled Teal code + #[serde(rename = "result")] + pub result: String, +} + +impl TealDisassemble200Response { + pub fn new(result: String) -> TealDisassemble200Response { + TealDisassemble200Response { + result, + } + } +} + diff --git a/crates/algo_fetch/src/models/teal_dryrun_200_response.rs b/crates/algo_fetch/src/models/teal_dryrun_200_response.rs new file mode 100644 index 0000000..66a246a --- /dev/null +++ b/crates/algo_fetch/src/models/teal_dryrun_200_response.rs @@ -0,0 +1,34 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct TealDryrun200Response { + #[serde(rename = "error")] + pub error: String, + /// Protocol version is the protocol version Dryrun was operated under. + #[serde(rename = "protocol-version")] + pub protocol_version: String, + #[serde(rename = "txns")] + pub txns: Vec, +} + +impl TealDryrun200Response { + pub fn new(error: String, protocol_version: String, txns: Vec) -> TealDryrun200Response { + TealDryrun200Response { + error, + protocol_version, + txns, + } + } +} + diff --git a/crates/algo_fetch/src/models/teal_key_value.rs b/crates/algo_fetch/src/models/teal_key_value.rs new file mode 100644 index 0000000..b7b988d --- /dev/null +++ b/crates/algo_fetch/src/models/teal_key_value.rs @@ -0,0 +1,32 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// TealKeyValue : Represents a key-value pair in an application store. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct TealKeyValue { + #[serde(rename = "key")] + pub key: String, + #[serde(rename = "value")] + pub value: Box, +} + +impl TealKeyValue { + /// Represents a key-value pair in an application store. + pub fn new(key: String, value: models::TealValue) -> TealKeyValue { + TealKeyValue { + key, + value: Box::new(value), + } + } +} + diff --git a/crates/algo_fetch/src/models/teal_value.rs b/crates/algo_fetch/src/models/teal_value.rs new file mode 100644 index 0000000..f540d3e --- /dev/null +++ b/crates/algo_fetch/src/models/teal_value.rs @@ -0,0 +1,38 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// TealValue : Represents a TEAL value. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct TealValue { + /// \\[tb\\] bytes value. + #[serde(rename = "bytes")] + pub bytes: String, + /// \\[tt\\] value type. Value `1` refers to **bytes**, value `2` refers to **uint** + #[serde(rename = "type")] + pub r#type: i32, + /// \\[ui\\] uint value. + #[serde(rename = "uint")] + pub uint: i32, +} + +impl TealValue { + /// Represents a TEAL value. + pub fn new(bytes: String, r#type: i32, uint: i32) -> TealValue { + TealValue { + bytes, + r#type, + uint, + } + } +} + diff --git a/crates/algo_fetch/src/models/transaction_params_200_response.rs b/crates/algo_fetch/src/models/transaction_params_200_response.rs new file mode 100644 index 0000000..d77d5e2 --- /dev/null +++ b/crates/algo_fetch/src/models/transaction_params_200_response.rs @@ -0,0 +1,54 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +use serde_with::serde_as; + +/// TransactionParams200Response : TransactionParams contains the parameters that help a client construct a new transaction. +#[serde_as] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct TransactionParams200Response { + /// ConsensusVersion indicates the consensus protocol version as of LastRound. + #[serde(rename = "consensus-version")] + pub consensus_version: String, + /// Fee is the suggested transaction fee Fee is in units of micro-Algos per byte. Fee may fall to zero but transactions must still have a fee of at least MinTxnFee for the current network protocol. + #[serde(rename = "fee")] + pub fee: i32, + /// GenesisHash is the hash of the genesis block. + #[serde_as(as = "serde_with::base64::Base64")] + #[serde(rename = "genesis-hash")] + pub genesis_hash: Vec, + /// GenesisID is an ID listed in the genesis block. + #[serde(rename = "genesis-id")] + pub genesis_id: String, + /// LastRound indicates the last round seen + #[serde(rename = "last-round")] + pub last_round: i32, + /// The minimum transaction fee (not per byte) required for the txn to validate for the current network protocol. + #[serde(rename = "min-fee")] + pub min_fee: i32, +} + +impl TransactionParams200Response { + /// TransactionParams contains the parameters that help a client construct a new transaction. + pub fn new(consensus_version: String, fee: i32, genesis_hash: Vec, genesis_id: String, last_round: i32, min_fee: i32) -> TransactionParams200Response { + TransactionParams200Response { + consensus_version, + fee, + genesis_hash, + genesis_id, + last_round, + min_fee, + } + } +} + diff --git a/crates/algo_fetch/src/models/version.rs b/crates/algo_fetch/src/models/version.rs new file mode 100644 index 0000000..4ff8014 --- /dev/null +++ b/crates/algo_fetch/src/models/version.rs @@ -0,0 +1,42 @@ +/* + * Algod REST API. + * + * API endpoint for algod operations. + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +use serde_with::serde_as; + +/// Version : algod version information. +#[serde_as] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct Version { + #[serde(rename = "build")] + pub build: Box, + #[serde_as(as = "serde_with::base64::Base64")] + #[serde(rename = "genesis_hash_b64")] + pub genesis_hash_b64: Vec, + #[serde(rename = "genesis_id")] + pub genesis_id: String, + #[serde(rename = "versions")] + pub versions: Vec, +} + +impl Version { + /// algod version information. + pub fn new(build: models::BuildVersion, genesis_hash_b64: Vec, genesis_id: String, versions: Vec) -> Version { + Version { + build: Box::new(build), + genesis_hash_b64, + genesis_id, + versions, + } + } +} + diff --git a/crates/algo_models/tests/js/bun.lockb b/crates/algo_models/tests/js/bun.lockb deleted file mode 100755 index caf4e6c..0000000 Binary files a/crates/algo_models/tests/js/bun.lockb and /dev/null differ diff --git a/crates/algo_models/tests/js/index.ts b/crates/algo_models/tests/js/index.ts index b4343d6..347773b 100644 --- a/crates/algo_models/tests/js/index.ts +++ b/crates/algo_models/tests/js/index.ts @@ -4,11 +4,17 @@ import init, { attachSignature, } from "./pkg/algo_models"; +import {AlgodClient} from "@awesome-algorand/algod-fetch"; + let { AlgorandTransactionCrafter } = require("@algorandfoundation/algo-models"); import * as ed from "@noble/ed25519"; import * as msgpack from "algo-msgpack-with-bigint"; +const client = new AlgodClient({BASE: "https://testnet-api.algonode.cloud"}) + +const data = await client.public.getBlock({round: 400}) +console.log(data) async function main() { // Generate a ed25519 keypair const privKey = ed.utils.randomPrivateKey(); diff --git a/crates/algo_models/tests/js/package.json b/crates/algo_models/tests/js/package.json index 9b1301f..12a3ca8 100644 --- a/crates/algo_models/tests/js/package.json +++ b/crates/algo_models/tests/js/package.json @@ -7,12 +7,15 @@ "algo_models.js", "algo_models.d.ts" ], - "main": "algo_models.js", - "types": "algo_models.d.ts", + "main": "pkg/algo_models.js", + "types": "pkg/algo_models.d.ts", "sideEffects": [ "./snippets/*" ], "dependencies": { + "@awesome-algorand/algod-fetch" : "^3.27.0", + "@algorandfoundation/algo-models": "^0.0.2", + "algo-msgpack-with-bigint":"^2.1.1", "@noble/ed25519": "^2.1.0" } } diff --git a/docs/decisions/0001-api-implementation.md b/docs/decisions/0001-api-implementation.md new file mode 100644 index 0000000..37146cd --- /dev/null +++ b/docs/decisions/0001-api-implementation.md @@ -0,0 +1,64 @@ +--- +# These are optional metadata elements. Feel free to remove any of them. +status: proposed +date: 2024-12-19 +decision-makers: Michael Feher, Bruno Martins, Joe Polny, David Rojas +consulted: Algorand Foundation CTO office, MakerX engineering team +--- + +# API Client Implementation + +## Context and Problem Statement + +A core part of interacting with the Algorand network is using the APIs provided by `algod`. The endpoints are used for crucial actions such as sending transactions and reading active state. There are also developer-focused APIs such as disassembly and simulate. A comprehensive suite of libraries for Algorand must include a way to interact with nodes via the HTTP API. + +## Decision Drivers + +- Should have a low maintenance cost +- Should have cross-language consistency +- Should allow control of HTTP requests and responses + +## Considered Options + +- Language-specific [OpenAPI Generator bindings](https://github.com/OpenAPITools/openapi-generator) +- Rust implementation for making HTTP calls with FFI bindings +- Rust implementation for constructing/parsing HTTP requests/responses with FFI bindings + +## Decision Outcome + +TBD + +### Confirmation + +The decided implementation should have an initial spike that makes use of various critical and developer-related APIs + +## Pros and Cons of the Options + +### Language-specific OpenAPI Generator bindings + + + +- Good, because it supports a huge list of languages/clients +- Good, because there is essential zero maintenance cost (assuming well-maintained OAPI spec) +- Neutral, because it will require better OAPI specs upstream in `go-algorand` +- Bad, because it doesn't give us control over the interfaces meaning we won't be able to provide useful abstractions +- Bad, because it might not integrate seamlessly with other core modules + +### Rust implementation for making HTTP calls with FFI bindings + +- Good, because we have direct control over the interfaces and can provide useful abstractions +- Good, because we can ensure it integrates well with other core modules +- Bad, because of the FFI overhead cost +- Bad, because it might be difficult to provide low-level control of HTTP requests and responses +- Bad, because it might not enable idiomatic HTTP requests + +### Rust implementation for constructing/parsing HTTP requests/responses with FFI bindings + +- Good, because we have direct control over the interfaces and can provide useful abstractions +- Good, because we can ensure it integrates well with other core modules +- Good, because it allows clients to use whichever HTTP client they'd like +- Bad, because of the FFI overhead cost + +## More Information + +This ADR is specifically focused on `algod` APIs, but the same strategy can and will likely be used for KMD and Indexer APIs as well. diff --git a/docs/research/ffi_the_rpc_bindagen.md b/docs/research/ffi_the_rpc_bindagen.md new file mode 100644 index 0000000..7060bdb --- /dev/null +++ b/docs/research/ffi_the_rpc_bindagen.md @@ -0,0 +1,31 @@ +# FFI RPC Bindings + +Lets see if we can't generate ourselves out of this problem! + +Run this in the root directory to generate `algo_fetch` + +```bash +npx @openapitools/openapi-generator-cli generate \ + -i https://raw.githubusercontent.com/algorand/go-algorand/v3.26.0-stable/daemon/algod/api/algod.oas3.yml \ + -g rust \ + -o ./crates/algo_fetch \ + --skip-validate-spec \ + --additional-properties=packageName=algo_fetch,supportAsync=true +``` + +Thoughts: + +- Uses Serde/compatible with FFI approach +- Conforms to the specification/shared type system +- Allows all options (one off generated RPC clients ala-carte) +- Unix philosophy(also package principles) + +Strong Thoughts(Regardless of approach): + +- We should not own the RPC contract (the service should) +- RPC should not have any abstractions (no more statusAfterBlock vs waitForBlock) + +Luke Warm Thoughts: + +We should be able to design the interfaces in a way where all boundaries are respected. +The POST endpoints for RPC accept Bytes. This requires no integration nor special knowledge. diff --git a/examples/next.js/src/components/TestClient.tsx b/examples/next.js/src/components/TestClient.tsx new file mode 100644 index 0000000..d722547 --- /dev/null +++ b/examples/next.js/src/components/TestClient.tsx @@ -0,0 +1,9 @@ +"use client"; +import {main} from "@/lib/test" +import {useEffect} from "react"; +export function TestClient() { + useEffect(() => { + main() + }, []) + return
Hello
+} \ No newline at end of file diff --git a/examples/next.js/src/components/TestServer.tsx b/examples/next.js/src/components/TestServer.tsx new file mode 100644 index 0000000..c909a7e --- /dev/null +++ b/examples/next.js/src/components/TestServer.tsx @@ -0,0 +1,6 @@ +"use server"; +import {main} from "@/lib/test" +export async function TestServer() { + await main() + return
Hello
+} \ No newline at end of file diff --git a/examples/next.js/src/lib/db.ts b/examples/next.js/src/lib/db.ts new file mode 100644 index 0000000..02c429f --- /dev/null +++ b/examples/next.js/src/lib/db.ts @@ -0,0 +1,62 @@ +import { KeyPairRecord } from "./types"; +import {getAddress} from "./wallet"; + +/** + * Wrapper around IDBRequest to return a promise + * @param request + */ +export function asyncRequest(request: IDBRequest){ + return new Promise((resolve, reject) => { + request.onsuccess = function () { + resolve(request.result) + } + request.onerror = function () { + reject(request.error) + } + }) +} + +/** + * Save a key pair to the database + * @param keyPair + */ +export async function saveKeyPair(keyPair: CryptoKeyPair){ + const address = await getAddress(keyPair) + const store = await open() + return asyncRequest(store.put({keyPair, id: address})) +} + +/** + * Get a key pair from the database + * @param address + */ +export async function getKeyPair(address: IDBValidKey | IDBKeyRange){ + const store = await open() + return asyncRequest(store.get(address)) +} + +/** + * Open the database and return the object store + * @param dbName + * @param storeName + */ +export async function open(dbName = 'Algorand', storeName = "KeyStore") { + return new Promise((resolve, reject) => { + if(typeof window === 'undefined') return reject(new Error('window is undefined')) + const dbOpenDBRequest = indexedDB.open(dbName, 1); + dbOpenDBRequest.onupgradeneeded = function() { + dbOpenDBRequest.result.createObjectStore(storeName, {keyPath: "id"}); + }; + dbOpenDBRequest.onsuccess = function() { + const db = dbOpenDBRequest.result; + const dbTransaction = db.transaction(storeName, "readwrite"); + resolve(dbTransaction.objectStore(storeName)) + dbTransaction.oncomplete = function() { + db.close(); + }; + } + dbOpenDBRequest.onerror = function() { + reject(dbOpenDBRequest.error) + } + }) +} \ No newline at end of file diff --git a/examples/next.js/src/lib/hi-base32.ts b/examples/next.js/src/lib/hi-base32.ts new file mode 100644 index 0000000..f267470 --- /dev/null +++ b/examples/next.js/src/lib/hi-base32.ts @@ -0,0 +1,431 @@ +/* + * [hi-base32]{@link https://github.com/emn178/hi-base32} + * + * @version 0.5.1 + * @author Chen, Yi-Cyuan [emn178@gmail.com] + * @copyright Chen, Yi-Cyuan 2015-2021 + * @license MIT + */ +const BASE32_ENCODE_CHAR = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'.split(''); +const BASE32_DECODE_CHAR: {[k: string]: number} = { + 'A': 0, 'B': 1, 'C': 2, 'D': 3, 'E': 4, 'F': 5, 'G': 6, 'H': 7, 'I': 8, + 'J': 9, 'K': 10, 'L': 11, 'M': 12, 'N': 13, 'O': 14, 'P': 15, 'Q': 16, + 'R': 17, 'S': 18, 'T': 19, 'U': 20, 'V': 21, 'W': 22, 'X': 23, 'Y': 24, + 'Z': 25, '2': 26, '3': 27, '4': 28, '5': 29, '6': 30, '7': 31 +}; + +const blocks = [0, 0, 0, 0, 0, 0, 0, 0]; + +const throwInvalidUtf8 = function (position: number, partial:string) { + if (partial.length > 10) { + partial = '...' + partial.substr(-10); + } + var err: Error & {position?: any} = new Error('Decoded data is not valid UTF-8.' + + ' Maybe try base32.decode.asBytes()?' + + ' Partial data after reading ' + position + ' bytes: ' + partial + ' <-'); + err.position = position; + throw err; +}; + +const toUtf8String = function (bytes: number[]) { + let str = '', length = bytes.length, i = 0, followingChars = 0, b, c; + while (i < length) { + b = bytes[i++]; + if (b <= 0x7F) { + str += String.fromCharCode(b); + continue; + } else if (b > 0xBF && b <= 0xDF) { + c = b & 0x1F; + followingChars = 1; + } else if (b <= 0xEF) { + c = b & 0x0F; + followingChars = 2; + } else if (b <= 0xF7) { + c = b & 0x07; + followingChars = 3; + } else { + throwInvalidUtf8(i, str); + } + + if(typeof c === 'undefined') throw new Error('c is undefined') + + for (var j = 0; j < followingChars; ++j) { + b = bytes[i++]; + if (b < 0x80 || b > 0xBF) { + throwInvalidUtf8(i, str); + } + c <<= 6; + c += b & 0x3F; + } + if (c >= 0xD800 && c <= 0xDFFF) { + throwInvalidUtf8(i, str); + } + if (c > 0x10FFFF) { + throwInvalidUtf8(i, str); + } + + if (c <= 0xFFFF) { + str += String.fromCharCode(c); + } else { + c -= 0x10000; + str += String.fromCharCode((c >> 10) + 0xD800); + str += String.fromCharCode((c & 0x3FF) + 0xDC00); + } + } + return str; +}; + +const decodeAsBytes = function (base32Str: string): number[] { + if (base32Str === '') { + return []; + } else if (!/^[A-Z2-7=]+$/.test(base32Str)) { + throw new Error('Invalid base32 characters'); + } + base32Str = base32Str.replace(/=/g, ''); + var v1, v2, v3, v4, v5, v6, v7, v8, bytes = [], index = 0, length = base32Str.length; + + // 4 char to 3 bytes + for (var i = 0, count = length >> 3 << 3; i < count;) { + v1 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + v2 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + v3 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + v4 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + v5 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + v6 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + v7 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + v8 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + bytes[index++] = (v1 << 3 | v2 >>> 2) & 255; + bytes[index++] = (v2 << 6 | v3 << 1 | v4 >>> 4) & 255; + bytes[index++] = (v4 << 4 | v5 >>> 1) & 255; + bytes[index++] = (v5 << 7 | v6 << 2 | v7 >>> 3) & 255; + bytes[index++] = (v7 << 5 | v8) & 255; + } + + // remain bytes + var remain = length - count; + if (remain === 2) { + v1 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + v2 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + bytes[index++] = (v1 << 3 | v2 >>> 2) & 255; + } else if (remain === 4) { + v1 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + v2 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + v3 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + v4 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + bytes[index++] = (v1 << 3 | v2 >>> 2) & 255; + bytes[index++] = (v2 << 6 | v3 << 1 | v4 >>> 4) & 255; + } else if (remain === 5) { + v1 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + v2 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + v3 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + v4 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + v5 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + bytes[index++] = (v1 << 3 | v2 >>> 2) & 255; + bytes[index++] = (v2 << 6 | v3 << 1 | v4 >>> 4) & 255; + bytes[index++] = (v4 << 4 | v5 >>> 1) & 255; + } else if (remain === 7) { + v1 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + v2 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + v3 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + v4 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + v5 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + v6 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + v7 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + bytes[index++] = (v1 << 3 | v2 >>> 2) & 255; + bytes[index++] = (v2 << 6 | v3 << 1 | v4 >>> 4) & 255; + bytes[index++] = (v4 << 4 | v5 >>> 1) & 255; + bytes[index++] = (v5 << 7 | v6 << 2 | v7 >>> 3) & 255; + } + return bytes; +}; + +const encodeAscii = function (str: string) { + let v1, v2, v3, v4, v5, base32Str = '', length = str.length; + for (var i = 0, count = parseInt((length / 5) as unknown as string) * 5; i < count;) { + v1 = str.charCodeAt(i++); + v2 = str.charCodeAt(i++); + v3 = str.charCodeAt(i++); + v4 = str.charCodeAt(i++); + v5 = str.charCodeAt(i++); + base32Str += BASE32_ENCODE_CHAR[v1 >>> 3] + + BASE32_ENCODE_CHAR[(v1 << 2 | v2 >>> 6) & 31] + + BASE32_ENCODE_CHAR[(v2 >>> 1) & 31] + + BASE32_ENCODE_CHAR[(v2 << 4 | v3 >>> 4) & 31] + + BASE32_ENCODE_CHAR[(v3 << 1 | v4 >>> 7) & 31] + + BASE32_ENCODE_CHAR[(v4 >>> 2) & 31] + + BASE32_ENCODE_CHAR[(v4 << 3 | v5 >>> 5) & 31] + + BASE32_ENCODE_CHAR[v5 & 31]; + } + + // remain char + const remain = length - count; + if (remain === 1) { + v1 = str.charCodeAt(i); + base32Str += BASE32_ENCODE_CHAR[v1 >>> 3] + + BASE32_ENCODE_CHAR[(v1 << 2) & 31] + + '======'; + } else if (remain === 2) { + v1 = str.charCodeAt(i++); + v2 = str.charCodeAt(i); + base32Str += BASE32_ENCODE_CHAR[v1 >>> 3] + + BASE32_ENCODE_CHAR[(v1 << 2 | v2 >>> 6) & 31] + + BASE32_ENCODE_CHAR[(v2 >>> 1) & 31] + + BASE32_ENCODE_CHAR[(v2 << 4) & 31] + + '===='; + } else if (remain === 3) { + v1 = str.charCodeAt(i++); + v2 = str.charCodeAt(i++); + v3 = str.charCodeAt(i); + base32Str += BASE32_ENCODE_CHAR[v1 >>> 3] + + BASE32_ENCODE_CHAR[(v1 << 2 | v2 >>> 6) & 31] + + BASE32_ENCODE_CHAR[(v2 >>> 1) & 31] + + BASE32_ENCODE_CHAR[(v2 << 4 | v3 >>> 4) & 31] + + BASE32_ENCODE_CHAR[(v3 << 1) & 31] + + '==='; + } else if (remain === 4) { + v1 = str.charCodeAt(i++); + v2 = str.charCodeAt(i++); + v3 = str.charCodeAt(i++); + v4 = str.charCodeAt(i); + base32Str += BASE32_ENCODE_CHAR[v1 >>> 3] + + BASE32_ENCODE_CHAR[(v1 << 2 | v2 >>> 6) & 31] + + BASE32_ENCODE_CHAR[(v2 >>> 1) & 31] + + BASE32_ENCODE_CHAR[(v2 << 4 | v3 >>> 4) & 31] + + BASE32_ENCODE_CHAR[(v3 << 1 | v4 >>> 7) & 31] + + BASE32_ENCODE_CHAR[(v4 >>> 2) & 31] + + BASE32_ENCODE_CHAR[(v4 << 3) & 31] + + '='; + } + return base32Str; +}; + +const encodeUtf8 = function (str: string) { + let v1, v2, v3, v4, v5, code, end = false, base32Str = '', + index = 0, i, start = 0, bytes = 0, length = str.length; + if (str === '') { + return base32Str; + } + do { + blocks[0] = blocks[5]; + blocks[1] = blocks[6]; + blocks[2] = blocks[7]; + for (i = start; index < length && i < 5; ++index) { + code = str.charCodeAt(index); + if (code < 0x80) { + blocks[i++] = code; + } else if (code < 0x800) { + blocks[i++] = 0xc0 | (code >> 6); + blocks[i++] = 0x80 | (code & 0x3f); + } else if (code < 0xd800 || code >= 0xe000) { + blocks[i++] = 0xe0 | (code >> 12); + blocks[i++] = 0x80 | ((code >> 6) & 0x3f); + blocks[i++] = 0x80 | (code & 0x3f); + } else { + code = 0x10000 + (((code & 0x3ff) << 10) | (str.charCodeAt(++index) & 0x3ff)); + blocks[i++] = 0xf0 | (code >> 18); + blocks[i++] = 0x80 | ((code >> 12) & 0x3f); + blocks[i++] = 0x80 | ((code >> 6) & 0x3f); + blocks[i++] = 0x80 | (code & 0x3f); + } + } + bytes += i - start; + start = i - 5; + if (index === length) { + ++index; + } + if (index > length && i < 6) { + end = true; + } + v1 = blocks[0]; + if (i > 4) { + v2 = blocks[1]; + v3 = blocks[2]; + v4 = blocks[3]; + v5 = blocks[4]; + base32Str += BASE32_ENCODE_CHAR[v1 >>> 3] + + BASE32_ENCODE_CHAR[(v1 << 2 | v2 >>> 6) & 31] + + BASE32_ENCODE_CHAR[(v2 >>> 1) & 31] + + BASE32_ENCODE_CHAR[(v2 << 4 | v3 >>> 4) & 31] + + BASE32_ENCODE_CHAR[(v3 << 1 | v4 >>> 7) & 31] + + BASE32_ENCODE_CHAR[(v4 >>> 2) & 31] + + BASE32_ENCODE_CHAR[(v4 << 3 | v5 >>> 5) & 31] + + BASE32_ENCODE_CHAR[v5 & 31]; + } else if (i === 1) { + base32Str += BASE32_ENCODE_CHAR[v1 >>> 3] + + BASE32_ENCODE_CHAR[(v1 << 2) & 31] + + '======'; + } else if (i === 2) { + v2 = blocks[1]; + base32Str += BASE32_ENCODE_CHAR[v1 >>> 3] + + BASE32_ENCODE_CHAR[(v1 << 2 | v2 >>> 6) & 31] + + BASE32_ENCODE_CHAR[(v2 >>> 1) & 31] + + BASE32_ENCODE_CHAR[(v2 << 4) & 31] + + '===='; + } else if (i === 3) { + v2 = blocks[1]; + v3 = blocks[2]; + base32Str += BASE32_ENCODE_CHAR[v1 >>> 3] + + BASE32_ENCODE_CHAR[(v1 << 2 | v2 >>> 6) & 31] + + BASE32_ENCODE_CHAR[(v2 >>> 1) & 31] + + BASE32_ENCODE_CHAR[(v2 << 4 | v3 >>> 4) & 31] + + BASE32_ENCODE_CHAR[(v3 << 1) & 31] + + '==='; + } else { + v2 = blocks[1]; + v3 = blocks[2]; + v4 = blocks[3]; + base32Str += BASE32_ENCODE_CHAR[v1 >>> 3] + + BASE32_ENCODE_CHAR[(v1 << 2 | v2 >>> 6) & 31] + + BASE32_ENCODE_CHAR[(v2 >>> 1) & 31] + + BASE32_ENCODE_CHAR[(v2 << 4 | v3 >>> 4) & 31] + + BASE32_ENCODE_CHAR[(v3 << 1 | v4 >>> 7) & 31] + + BASE32_ENCODE_CHAR[(v4 >>> 2) & 31] + + BASE32_ENCODE_CHAR[(v4 << 3) & 31] + + '='; + } + } while (!end); + return base32Str; +}; + +const encodeBytes = function (bytes: Uint8Array) { + let v1, v2, v3, v4, v5, base32Str = '', length = bytes.length; + for (var i = 0, count = parseInt((length / 5) as unknown as string) * 5; i < count;) { + v1 = bytes[i++]; + v2 = bytes[i++]; + v3 = bytes[i++]; + v4 = bytes[i++]; + v5 = bytes[i++]; + base32Str += BASE32_ENCODE_CHAR[v1 >>> 3] + + BASE32_ENCODE_CHAR[(v1 << 2 | v2 >>> 6) & 31] + + BASE32_ENCODE_CHAR[(v2 >>> 1) & 31] + + BASE32_ENCODE_CHAR[(v2 << 4 | v3 >>> 4) & 31] + + BASE32_ENCODE_CHAR[(v3 << 1 | v4 >>> 7) & 31] + + BASE32_ENCODE_CHAR[(v4 >>> 2) & 31] + + BASE32_ENCODE_CHAR[(v4 << 3 | v5 >>> 5) & 31] + + BASE32_ENCODE_CHAR[v5 & 31]; + } + + // remain char + const remain = length - count; + if (remain === 1) { + v1 = bytes[i]; + base32Str += BASE32_ENCODE_CHAR[v1 >>> 3] + + BASE32_ENCODE_CHAR[(v1 << 2) & 31] + + '======'; + } else if (remain === 2) { + v1 = bytes[i++]; + v2 = bytes[i]; + base32Str += BASE32_ENCODE_CHAR[v1 >>> 3] + + BASE32_ENCODE_CHAR[(v1 << 2 | v2 >>> 6) & 31] + + BASE32_ENCODE_CHAR[(v2 >>> 1) & 31] + + BASE32_ENCODE_CHAR[(v2 << 4) & 31] + + '===='; + } else if (remain === 3) { + v1 = bytes[i++]; + v2 = bytes[i++]; + v3 = bytes[i]; + base32Str += BASE32_ENCODE_CHAR[v1 >>> 3] + + BASE32_ENCODE_CHAR[(v1 << 2 | v2 >>> 6) & 31] + + BASE32_ENCODE_CHAR[(v2 >>> 1) & 31] + + BASE32_ENCODE_CHAR[(v2 << 4 | v3 >>> 4) & 31] + + BASE32_ENCODE_CHAR[(v3 << 1) & 31] + + '==='; + } else if (remain === 4) { + v1 = bytes[i++]; + v2 = bytes[i++]; + v3 = bytes[i++]; + v4 = bytes[i]; + base32Str += BASE32_ENCODE_CHAR[v1 >>> 3] + + BASE32_ENCODE_CHAR[(v1 << 2 | v2 >>> 6) & 31] + + BASE32_ENCODE_CHAR[(v2 >>> 1) & 31] + + BASE32_ENCODE_CHAR[(v2 << 4 | v3 >>> 4) & 31] + + BASE32_ENCODE_CHAR[(v3 << 1 | v4 >>> 7) & 31] + + BASE32_ENCODE_CHAR[(v4 >>> 2) & 31] + + BASE32_ENCODE_CHAR[(v4 << 3) & 31] + + '='; + } + return base32Str; +}; + +export const encode = function (input: string | ArrayBuffer | Uint8Array | number[], asciiOnly?: boolean) { + const notString = typeof (input) !== 'string'; + if (notString && input.constructor === ArrayBuffer) { + input = new Uint8Array(input); + } + if (notString) { + return encodeBytes(input as Uint8Array); + } else if (asciiOnly) { + return encodeAscii(input as string); + } else { + return encodeUtf8(input as string); + } +}; + +export const decode = function (base32Str: string, asciiOnly?: boolean) { + if (!asciiOnly) { + return toUtf8String(decodeAsBytes(base32Str)); + } + if (base32Str === '') { + return ''; + } else if (!/^[A-Z2-7=]+$/.test(base32Str)) { + throw new Error('Invalid base32 characters'); + } + let v1, v2, v3, v4, v5, v6, v7, v8, str = '', length = base32Str.indexOf('='); + if (length === -1) { + length = base32Str.length; + } + + // 8 char to 5 bytes + for (var i = 0, count = length >> 3 << 3; i < count;) { + v1 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + v2 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + v3 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + v4 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + v5 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + v6 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + v7 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + v8 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + str += String.fromCharCode((v1 << 3 | v2 >>> 2) & 255) + + String.fromCharCode((v2 << 6 | v3 << 1 | v4 >>> 4) & 255) + + String.fromCharCode((v4 << 4 | v5 >>> 1) & 255) + + String.fromCharCode((v5 << 7 | v6 << 2 | v7 >>> 3) & 255) + + String.fromCharCode((v7 << 5 | v8) & 255); + } + + // remain bytes + const remain = length - count; + if (remain === 2) { + v1 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + v2 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + str += String.fromCharCode((v1 << 3 | v2 >>> 2) & 255); + } else if (remain === 4) { + v1 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + v2 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + v3 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + v4 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + str += String.fromCharCode((v1 << 3 | v2 >>> 2) & 255) + + String.fromCharCode((v2 << 6 | v3 << 1 | v4 >>> 4) & 255); + } else if (remain === 5) { + v1 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + v2 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + v3 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + v4 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + v5 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + str += String.fromCharCode((v1 << 3 | v2 >>> 2) & 255) + + String.fromCharCode((v2 << 6 | v3 << 1 | v4 >>> 4) & 255) + + String.fromCharCode((v4 << 4 | v5 >>> 1) & 255); + } else if (remain === 7) { + v1 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + v2 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + v3 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + v4 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + v5 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + v6 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + v7 = BASE32_DECODE_CHAR[base32Str.charAt(i++)]; + str += String.fromCharCode((v1 << 3 | v2 >>> 2) & 255) + + String.fromCharCode((v2 << 6 | v3 << 1 | v4 >>> 4) & 255) + + String.fromCharCode((v4 << 4 | v5 >>> 1) & 255) + + String.fromCharCode((v5 << 7 | v6 << 2 | v7 >>> 3) & 255); + } + return str; +}; \ No newline at end of file diff --git a/examples/next.js/src/lib/sha512.ts b/examples/next.js/src/lib/sha512.ts new file mode 100644 index 0000000..4de1eb0 --- /dev/null +++ b/examples/next.js/src/lib/sha512.ts @@ -0,0 +1,873 @@ +// @ts-nocheck +/* + * [js-sha512]{@link https://github.com/emn178/js-sha512} + * + * @version 0.9.0 + * @author Chen, Yi-Cyuan [emn178@gmail.com] + * @copyright Chen, Yi-Cyuan 2014-2024 + * @license MIT + */ +var INPUT_ERROR = 'input is invalid type'; +var FINALIZE_ERROR = 'finalize already called'; + +var ARRAY_BUFFER = typeof ArrayBuffer !== 'undefined'; +var HEX_CHARS = '0123456789abcdef'.split(''); +var EXTRA = [-2147483648, 8388608, 32768, 128]; +var SHIFT = [24, 16, 8, 0]; +var K = [ + 0x428A2F98, 0xD728AE22, 0x71374491, 0x23EF65CD, + 0xB5C0FBCF, 0xEC4D3B2F, 0xE9B5DBA5, 0x8189DBBC, + 0x3956C25B, 0xF348B538, 0x59F111F1, 0xB605D019, + 0x923F82A4, 0xAF194F9B, 0xAB1C5ED5, 0xDA6D8118, + 0xD807AA98, 0xA3030242, 0x12835B01, 0x45706FBE, + 0x243185BE, 0x4EE4B28C, 0x550C7DC3, 0xD5FFB4E2, + 0x72BE5D74, 0xF27B896F, 0x80DEB1FE, 0x3B1696B1, + 0x9BDC06A7, 0x25C71235, 0xC19BF174, 0xCF692694, + 0xE49B69C1, 0x9EF14AD2, 0xEFBE4786, 0x384F25E3, + 0x0FC19DC6, 0x8B8CD5B5, 0x240CA1CC, 0x77AC9C65, + 0x2DE92C6F, 0x592B0275, 0x4A7484AA, 0x6EA6E483, + 0x5CB0A9DC, 0xBD41FBD4, 0x76F988DA, 0x831153B5, + 0x983E5152, 0xEE66DFAB, 0xA831C66D, 0x2DB43210, + 0xB00327C8, 0x98FB213F, 0xBF597FC7, 0xBEEF0EE4, + 0xC6E00BF3, 0x3DA88FC2, 0xD5A79147, 0x930AA725, + 0x06CA6351, 0xE003826F, 0x14292967, 0x0A0E6E70, + 0x27B70A85, 0x46D22FFC, 0x2E1B2138, 0x5C26C926, + 0x4D2C6DFC, 0x5AC42AED, 0x53380D13, 0x9D95B3DF, + 0x650A7354, 0x8BAF63DE, 0x766A0ABB, 0x3C77B2A8, + 0x81C2C92E, 0x47EDAEE6, 0x92722C85, 0x1482353B, + 0xA2BFE8A1, 0x4CF10364, 0xA81A664B, 0xBC423001, + 0xC24B8B70, 0xD0F89791, 0xC76C51A3, 0x0654BE30, + 0xD192E819, 0xD6EF5218, 0xD6990624, 0x5565A910, + 0xF40E3585, 0x5771202A, 0x106AA070, 0x32BBD1B8, + 0x19A4C116, 0xB8D2D0C8, 0x1E376C08, 0x5141AB53, + 0x2748774C, 0xDF8EEB99, 0x34B0BCB5, 0xE19B48A8, + 0x391C0CB3, 0xC5C95A63, 0x4ED8AA4A, 0xE3418ACB, + 0x5B9CCA4F, 0x7763E373, 0x682E6FF3, 0xD6B2B8A3, + 0x748F82EE, 0x5DEFB2FC, 0x78A5636F, 0x43172F60, + 0x84C87814, 0xA1F0AB72, 0x8CC70208, 0x1A6439EC, + 0x90BEFFFA, 0x23631E28, 0xA4506CEB, 0xDE82BDE9, + 0xBEF9A3F7, 0xB2C67915, 0xC67178F2, 0xE372532B, + 0xCA273ECE, 0xEA26619C, 0xD186B8C7, 0x21C0C207, + 0xEADA7DD6, 0xCDE0EB1E, 0xF57D4F7F, 0xEE6ED178, + 0x06F067AA, 0x72176FBA, 0x0A637DC5, 0xA2C898A6, + 0x113F9804, 0xBEF90DAE, 0x1B710B35, 0x131C471B, + 0x28DB77F5, 0x23047D84, 0x32CAAB7B, 0x40C72493, + 0x3C9EBE0A, 0x15C9BEBC, 0x431D67C4, 0x9C100D4C, + 0x4CC5D4BE, 0xCB3E42B6, 0x597F299C, 0xFC657E2A, + 0x5FCB6FAB, 0x3AD6FAEC, 0x6C44198C, 0x4A475817 +]; + +var OUTPUT_TYPES = ['hex', 'array', 'digest', 'arrayBuffer']; + +var blocks = []; + +var isArray = Array.isArray; +var isView = ArrayBuffer.isView; + +// [message: string, isString: bool] +const formatMessage = function (message: string | ArrayBuffer | ArrayBufferView) { + const type = typeof message; + if (type === 'string') { + return [message, true]; + } + if (type !== 'object' || message === null) { + throw new Error(INPUT_ERROR); + } + if (ARRAY_BUFFER && message.constructor === ArrayBuffer) { + return [new Uint8Array(message), false]; + } + if (!isArray(message) && !isView(message)) { + throw new Error(INPUT_ERROR); + } + return [message, false]; +}; + +const createOutputMethod = function (outputType, bits) { + return function (message) { + return new (Sha512 as any)(bits, true).update(message)[outputType](); + }; +}; + +export const createMethod = function (bits): {array: (d: Uint8Array)=>Uint8Array} { + var method = createOutputMethod('hex', bits); + method.create = function () { + return new (Sha512 as any)(bits); + }; + method.update = function (message) { + return method.create().update(message); + }; + for (var i = 0; i < OUTPUT_TYPES.length; ++i) { + var type = OUTPUT_TYPES[i]; + method[type] = createOutputMethod(type, bits); + } + return method; +}; + +var createHmacOutputMethod = function (outputType, bits) { + return function (key, message) { + return new (HmacSha512 as any)(key, bits, true).update(message)[outputType](); + }; +}; + +var createHmacMethod = function (bits) { + var method = createHmacOutputMethod('hex', bits); + method.create = function (key) { + return new (HmacSha512 as any)(key, bits); + }; + method.update = function (key, message) { + return method.create(key).update(message); + }; + for (var i = 0; i < OUTPUT_TYPES.length; ++i) { + var type = OUTPUT_TYPES[i]; + method[type] = createHmacOutputMethod(type, bits); + } + return method; +}; + +/** + * @class + * @param bits + * @param sharedMemory + * @constructor + */ +function Sha512(bits, sharedMemory) { + if (sharedMemory) { + blocks[0] = blocks[1] = blocks[2] = blocks[3] = blocks[4] = + blocks[5] = blocks[6] = blocks[7] = blocks[8] = + blocks[9] = blocks[10] = blocks[11] = blocks[12] = + blocks[13] = blocks[14] = blocks[15] = blocks[16] = + blocks[17] = blocks[18] = blocks[19] = blocks[20] = + blocks[21] = blocks[22] = blocks[23] = blocks[24] = + blocks[25] = blocks[26] = blocks[27] = blocks[28] = + blocks[29] = blocks[30] = blocks[31] = blocks[32] = 0; + this.blocks = blocks; + } else { + this.blocks = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + } + + if (bits == 384) { + this.h0h = 0xCBBB9D5D; + this.h0l = 0xC1059ED8; + this.h1h = 0x629A292A; + this.h1l = 0x367CD507; + this.h2h = 0x9159015A; + this.h2l = 0x3070DD17; + this.h3h = 0x152FECD8; + this.h3l = 0xF70E5939; + this.h4h = 0x67332667; + this.h4l = 0xFFC00B31; + this.h5h = 0x8EB44A87; + this.h5l = 0x68581511; + this.h6h = 0xDB0C2E0D; + this.h6l = 0x64F98FA7; + this.h7h = 0x47B5481D; + this.h7l = 0xBEFA4FA4; + } else if (bits == 256) { + this.h0h = 0x22312194; + this.h0l = 0xFC2BF72C; + this.h1h = 0x9F555FA3; + this.h1l = 0xC84C64C2; + this.h2h = 0x2393B86B; + this.h2l = 0x6F53B151; + this.h3h = 0x96387719; + this.h3l = 0x5940EABD; + this.h4h = 0x96283EE2; + this.h4l = 0xA88EFFE3; + this.h5h = 0xBE5E1E25; + this.h5l = 0x53863992; + this.h6h = 0x2B0199FC; + this.h6l = 0x2C85B8AA; + this.h7h = 0x0EB72DDC; + this.h7l = 0x81C52CA2; + } else if (bits == 224) { + this.h0h = 0x8C3D37C8; + this.h0l = 0x19544DA2; + this.h1h = 0x73E19966; + this.h1l = 0x89DCD4D6; + this.h2h = 0x1DFAB7AE; + this.h2l = 0x32FF9C82; + this.h3h = 0x679DD514; + this.h3l = 0x582F9FCF; + this.h4h = 0x0F6D2B69; + this.h4l = 0x7BD44DA8; + this.h5h = 0x77E36F73; + this.h5l = 0x04C48942; + this.h6h = 0x3F9D85A8; + this.h6l = 0x6A1D36C8; + this.h7h = 0x1112E6AD; + this.h7l = 0x91D692A1; + } else { // 512 + this.h0h = 0x6A09E667; + this.h0l = 0xF3BCC908; + this.h1h = 0xBB67AE85; + this.h1l = 0x84CAA73B; + this.h2h = 0x3C6EF372; + this.h2l = 0xFE94F82B; + this.h3h = 0xA54FF53A; + this.h3l = 0x5F1D36F1; + this.h4h = 0x510E527F; + this.h4l = 0xADE682D1; + this.h5h = 0x9B05688C; + this.h5l = 0x2B3E6C1F; + this.h6h = 0x1F83D9AB; + this.h6l = 0xFB41BD6B; + this.h7h = 0x5BE0CD19; + this.h7l = 0x137E2179; + } + this.bits = bits; + + this.block = this.start = this.bytes = this.hBytes = 0; + this.finalized = this.hashed = false; +} + +Sha512.prototype.update = function (message) { + if (this.finalized) { + throw new Error(FINALIZE_ERROR); + } + var result = formatMessage(message); + message = result[0]; + var isString = result[1]; + var code, index = 0, i, length = message.length, blocks = this.blocks; + + while (index < length) { + if (this.hashed) { + this.hashed = false; + blocks[0] = this.block; + this.block = blocks[1] = blocks[2] = blocks[3] = blocks[4] = + blocks[5] = blocks[6] = blocks[7] = blocks[8] = + blocks[9] = blocks[10] = blocks[11] = blocks[12] = + blocks[13] = blocks[14] = blocks[15] = blocks[16] = + blocks[17] = blocks[18] = blocks[19] = blocks[20] = + blocks[21] = blocks[22] = blocks[23] = blocks[24] = + blocks[25] = blocks[26] = blocks[27] = blocks[28] = + blocks[29] = blocks[30] = blocks[31] = blocks[32] = 0; + } + + if(isString) { + for (i = this.start; index < length && i < 128; ++index) { + code = message.charCodeAt(index); + if (code < 0x80) { + blocks[i >>> 2] |= code << SHIFT[i++ & 3]; + } else if (code < 0x800) { + blocks[i >>> 2] |= (0xc0 | (code >>> 6)) << SHIFT[i++ & 3]; + blocks[i >>> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; + } else if (code < 0xd800 || code >= 0xe000) { + blocks[i >>> 2] |= (0xe0 | (code >>> 12)) << SHIFT[i++ & 3]; + blocks[i >>> 2] |= (0x80 | ((code >>> 6) & 0x3f)) << SHIFT[i++ & 3]; + blocks[i >>> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; + } else { + code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff)); + blocks[i >>> 2] |= (0xf0 | (code >>> 18)) << SHIFT[i++ & 3]; + blocks[i >>> 2] |= (0x80 | ((code >>> 12) & 0x3f)) << SHIFT[i++ & 3]; + blocks[i >>> 2] |= (0x80 | ((code >>> 6) & 0x3f)) << SHIFT[i++ & 3]; + blocks[i >>> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; + } + } + } else { + for (i = this.start; index < length && i < 128; ++index) { + blocks[i >>> 2] |= message[index] << SHIFT[i++ & 3]; + } + } + + this.lastByteIndex = i; + this.bytes += i - this.start; + if (i >= 128) { + this.block = blocks[32]; + this.start = i - 128; + this.hash(); + this.hashed = true; + } else { + this.start = i; + } + } + if (this.bytes > 4294967295) { + this.hBytes += this.bytes / 4294967296 << 0; + this.bytes = this.bytes % 4294967296; + } + return this; +}; + +Sha512.prototype.finalize = function () { + if (this.finalized) { + return; + } + this.finalized = true; + var blocks = this.blocks, i = this.lastByteIndex; + blocks[32] = this.block; + blocks[i >>> 2] |= EXTRA[i & 3]; + this.block = blocks[32]; + if (i >= 112) { + if (!this.hashed) { + this.hash(); + } + blocks[0] = this.block; + blocks[1] = blocks[2] = blocks[3] = blocks[4] = + blocks[5] = blocks[6] = blocks[7] = blocks[8] = + blocks[9] = blocks[10] = blocks[11] = blocks[12] = + blocks[13] = blocks[14] = blocks[15] = blocks[16] = + blocks[17] = blocks[18] = blocks[19] = blocks[20] = + blocks[21] = blocks[22] = blocks[23] = blocks[24] = + blocks[25] = blocks[26] = blocks[27] = blocks[28] = + blocks[29] = blocks[30] = blocks[31] = blocks[32] = 0; + } + blocks[30] = this.hBytes << 3 | this.bytes >>> 29; + blocks[31] = this.bytes << 3; + this.hash(); +}; + +Sha512.prototype.hash = function () { + var h0h = this.h0h, h0l = this.h0l, h1h = this.h1h, h1l = this.h1l, + h2h = this.h2h, h2l = this.h2l, h3h = this.h3h, h3l = this.h3l, + h4h = this.h4h, h4l = this.h4l, h5h = this.h5h, h5l = this.h5l, + h6h = this.h6h, h6l = this.h6l, h7h = this.h7h, h7l = this.h7l, + blocks = this.blocks, j, s0h, s0l, s1h, s1l, c1, c2, c3, c4, + abh, abl, dah, dal, cdh, cdl, bch, bcl, + majh, majl, t1h, t1l, t2h, t2l, chh, chl; + + for (j = 32; j < 160; j += 2) { + t1h = blocks[j - 30]; + t1l = blocks[j - 29]; + s0h = ((t1h >>> 1) | (t1l << 31)) ^ ((t1h >>> 8) | (t1l << 24)) ^ (t1h >>> 7); + s0l = ((t1l >>> 1) | (t1h << 31)) ^ ((t1l >>> 8) | (t1h << 24)) ^ ((t1l >>> 7) | t1h << 25); + + t1h = blocks[j - 4]; + t1l = blocks[j - 3]; + s1h = ((t1h >>> 19) | (t1l << 13)) ^ ((t1l >>> 29) | (t1h << 3)) ^ (t1h >>> 6); + s1l = ((t1l >>> 19) | (t1h << 13)) ^ ((t1h >>> 29) | (t1l << 3)) ^ ((t1l >>> 6) | t1h << 26); + + t1h = blocks[j - 32]; + t1l = blocks[j - 31]; + t2h = blocks[j - 14]; + t2l = blocks[j - 13]; + + c1 = (t2l & 0xFFFF) + (t1l & 0xFFFF) + (s0l & 0xFFFF) + (s1l & 0xFFFF); + c2 = (t2l >>> 16) + (t1l >>> 16) + (s0l >>> 16) + (s1l >>> 16) + (c1 >>> 16); + c3 = (t2h & 0xFFFF) + (t1h & 0xFFFF) + (s0h & 0xFFFF) + (s1h & 0xFFFF) + (c2 >>> 16); + c4 = (t2h >>> 16) + (t1h >>> 16) + (s0h >>> 16) + (s1h >>> 16) + (c3 >>> 16); + + blocks[j] = (c4 << 16) | (c3 & 0xFFFF); + blocks[j + 1] = (c2 << 16) | (c1 & 0xFFFF); + } + + var ah = h0h, al = h0l, bh = h1h, bl = h1l, ch = h2h, cl = h2l, dh = h3h, dl = h3l, eh = h4h, el = h4l, fh = h5h, fl = h5l, gh = h6h, gl = h6l, hh = h7h, hl = h7l; + bch = bh & ch; + bcl = bl & cl; + for (j = 0; j < 160; j += 8) { + s0h = ((ah >>> 28) | (al << 4)) ^ ((al >>> 2) | (ah << 30)) ^ ((al >>> 7) | (ah << 25)); + s0l = ((al >>> 28) | (ah << 4)) ^ ((ah >>> 2) | (al << 30)) ^ ((ah >>> 7) | (al << 25)); + + s1h = ((eh >>> 14) | (el << 18)) ^ ((eh >>> 18) | (el << 14)) ^ ((el >>> 9) | (eh << 23)); + s1l = ((el >>> 14) | (eh << 18)) ^ ((el >>> 18) | (eh << 14)) ^ ((eh >>> 9) | (el << 23)); + + abh = ah & bh; + abl = al & bl; + majh = abh ^ (ah & ch) ^ bch; + majl = abl ^ (al & cl) ^ bcl; + + chh = (eh & fh) ^ (~eh & gh); + chl = (el & fl) ^ (~el & gl); + + t1h = blocks[j]; + t1l = blocks[j + 1]; + t2h = K[j]; + t2l = K[j + 1]; + + c1 = (t2l & 0xFFFF) + (t1l & 0xFFFF) + (chl & 0xFFFF) + (s1l & 0xFFFF) + (hl & 0xFFFF); + c2 = (t2l >>> 16) + (t1l >>> 16) + (chl >>> 16) + (s1l >>> 16) + (hl >>> 16) + (c1 >>> 16); + c3 = (t2h & 0xFFFF) + (t1h & 0xFFFF) + (chh & 0xFFFF) + (s1h & 0xFFFF) + (hh & 0xFFFF) + (c2 >>> 16); + c4 = (t2h >>> 16) + (t1h >>> 16) + (chh >>> 16) + (s1h >>> 16) + (hh >>> 16) + (c3 >>> 16); + + t1h = (c4 << 16) | (c3 & 0xFFFF); + t1l = (c2 << 16) | (c1 & 0xFFFF); + + c1 = (majl & 0xFFFF) + (s0l & 0xFFFF); + c2 = (majl >>> 16) + (s0l >>> 16) + (c1 >>> 16); + c3 = (majh & 0xFFFF) + (s0h & 0xFFFF) + (c2 >>> 16); + c4 = (majh >>> 16) + (s0h >>> 16) + (c3 >>> 16); + + t2h = (c4 << 16) | (c3 & 0xFFFF); + t2l = (c2 << 16) | (c1 & 0xFFFF); + + c1 = (dl & 0xFFFF) + (t1l & 0xFFFF); + c2 = (dl >>> 16) + (t1l >>> 16) + (c1 >>> 16); + c3 = (dh & 0xFFFF) + (t1h & 0xFFFF) + (c2 >>> 16); + c4 = (dh >>> 16) + (t1h >>> 16) + (c3 >>> 16); + + hh = (c4 << 16) | (c3 & 0xFFFF); + hl = (c2 << 16) | (c1 & 0xFFFF); + + c1 = (t2l & 0xFFFF) + (t1l & 0xFFFF); + c2 = (t2l >>> 16) + (t1l >>> 16) + (c1 >>> 16); + c3 = (t2h & 0xFFFF) + (t1h & 0xFFFF) + (c2 >>> 16); + c4 = (t2h >>> 16) + (t1h >>> 16) + (c3 >>> 16); + + dh = (c4 << 16) | (c3 & 0xFFFF); + dl = (c2 << 16) | (c1 & 0xFFFF); + + s0h = ((dh >>> 28) | (dl << 4)) ^ ((dl >>> 2) | (dh << 30)) ^ ((dl >>> 7) | (dh << 25)); + s0l = ((dl >>> 28) | (dh << 4)) ^ ((dh >>> 2) | (dl << 30)) ^ ((dh >>> 7) | (dl << 25)); + + s1h = ((hh >>> 14) | (hl << 18)) ^ ((hh >>> 18) | (hl << 14)) ^ ((hl >>> 9) | (hh << 23)); + s1l = ((hl >>> 14) | (hh << 18)) ^ ((hl >>> 18) | (hh << 14)) ^ ((hh >>> 9) | (hl << 23)); + + dah = dh & ah; + dal = dl & al; + majh = dah ^ (dh & bh) ^ abh; + majl = dal ^ (dl & bl) ^ abl; + + chh = (hh & eh) ^ (~hh & fh); + chl = (hl & el) ^ (~hl & fl); + + t1h = blocks[j + 2]; + t1l = blocks[j + 3]; + t2h = K[j + 2]; + t2l = K[j + 3]; + + c1 = (t2l & 0xFFFF) + (t1l & 0xFFFF) + (chl & 0xFFFF) + (s1l & 0xFFFF) + (gl & 0xFFFF); + c2 = (t2l >>> 16) + (t1l >>> 16) + (chl >>> 16) + (s1l >>> 16) + (gl >>> 16) + (c1 >>> 16); + c3 = (t2h & 0xFFFF) + (t1h & 0xFFFF) + (chh & 0xFFFF) + (s1h & 0xFFFF) + (gh & 0xFFFF) + (c2 >>> 16); + c4 = (t2h >>> 16) + (t1h >>> 16) + (chh >>> 16) + (s1h >>> 16) + (gh >>> 16) + (c3 >>> 16); + + t1h = (c4 << 16) | (c3 & 0xFFFF); + t1l = (c2 << 16) | (c1 & 0xFFFF); + + c1 = (majl & 0xFFFF) + (s0l & 0xFFFF); + c2 = (majl >>> 16) + (s0l >>> 16) + (c1 >>> 16); + c3 = (majh & 0xFFFF) + (s0h & 0xFFFF) + (c2 >>> 16); + c4 = (majh >>> 16) + (s0h >>> 16) + (c3 >>> 16); + + t2h = (c4 << 16) | (c3 & 0xFFFF); + t2l = (c2 << 16) | (c1 & 0xFFFF); + + c1 = (cl & 0xFFFF) + (t1l & 0xFFFF); + c2 = (cl >>> 16) + (t1l >>> 16) + (c1 >>> 16); + c3 = (ch & 0xFFFF) + (t1h & 0xFFFF) + (c2 >>> 16); + c4 = (ch >>> 16) + (t1h >>> 16) + (c3 >>> 16); + + gh = (c4 << 16) | (c3 & 0xFFFF); + gl = (c2 << 16) | (c1 & 0xFFFF); + + c1 = (t2l & 0xFFFF) + (t1l & 0xFFFF); + c2 = (t2l >>> 16) + (t1l >>> 16) + (c1 >>> 16); + c3 = (t2h & 0xFFFF) + (t1h & 0xFFFF) + (c2 >>> 16); + c4 = (t2h >>> 16) + (t1h >>> 16) + (c3 >>> 16); + + ch = (c4 << 16) | (c3 & 0xFFFF); + cl = (c2 << 16) | (c1 & 0xFFFF); + + s0h = ((ch >>> 28) | (cl << 4)) ^ ((cl >>> 2) | (ch << 30)) ^ ((cl >>> 7) | (ch << 25)); + s0l = ((cl >>> 28) | (ch << 4)) ^ ((ch >>> 2) | (cl << 30)) ^ ((ch >>> 7) | (cl << 25)); + + s1h = ((gh >>> 14) | (gl << 18)) ^ ((gh >>> 18) | (gl << 14)) ^ ((gl >>> 9) | (gh << 23)); + s1l = ((gl >>> 14) | (gh << 18)) ^ ((gl >>> 18) | (gh << 14)) ^ ((gh >>> 9) | (gl << 23)); + + cdh = ch & dh; + cdl = cl & dl; + majh = cdh ^ (ch & ah) ^ dah; + majl = cdl ^ (cl & al) ^ dal; + + chh = (gh & hh) ^ (~gh & eh); + chl = (gl & hl) ^ (~gl & el); + + t1h = blocks[j + 4]; + t1l = blocks[j + 5]; + t2h = K[j + 4]; + t2l = K[j + 5]; + + c1 = (t2l & 0xFFFF) + (t1l & 0xFFFF) + (chl & 0xFFFF) + (s1l & 0xFFFF) + (fl & 0xFFFF); + c2 = (t2l >>> 16) + (t1l >>> 16) + (chl >>> 16) + (s1l >>> 16) + (fl >>> 16) + (c1 >>> 16); + c3 = (t2h & 0xFFFF) + (t1h & 0xFFFF) + (chh & 0xFFFF) + (s1h & 0xFFFF) + (fh & 0xFFFF) + (c2 >>> 16); + c4 = (t2h >>> 16) + (t1h >>> 16) + (chh >>> 16) + (s1h >>> 16) + (fh >>> 16) + (c3 >>> 16); + + t1h = (c4 << 16) | (c3 & 0xFFFF); + t1l = (c2 << 16) | (c1 & 0xFFFF); + + c1 = (majl & 0xFFFF) + (s0l & 0xFFFF); + c2 = (majl >>> 16) + (s0l >>> 16) + (c1 >>> 16); + c3 = (majh & 0xFFFF) + (s0h & 0xFFFF) + (c2 >>> 16); + c4 = (majh >>> 16) + (s0h >>> 16) + (c3 >>> 16); + + t2h = (c4 << 16) | (c3 & 0xFFFF); + t2l = (c2 << 16) | (c1 & 0xFFFF); + + c1 = (bl & 0xFFFF) + (t1l & 0xFFFF); + c2 = (bl >>> 16) + (t1l >>> 16) + (c1 >>> 16); + c3 = (bh & 0xFFFF) + (t1h & 0xFFFF) + (c2 >>> 16); + c4 = (bh >>> 16) + (t1h >>> 16) + (c3 >>> 16); + + fh = (c4 << 16) | (c3 & 0xFFFF); + fl = (c2 << 16) | (c1 & 0xFFFF); + + c1 = (t2l & 0xFFFF) + (t1l & 0xFFFF); + c2 = (t2l >>> 16) + (t1l >>> 16) + (c1 >>> 16); + c3 = (t2h & 0xFFFF) + (t1h & 0xFFFF) + (c2 >>> 16); + c4 = (t2h >>> 16) + (t1h >>> 16) + (c3 >>> 16); + + bh = (c4 << 16) | (c3 & 0xFFFF); + bl = (c2 << 16) | (c1 & 0xFFFF); + + s0h = ((bh >>> 28) | (bl << 4)) ^ ((bl >>> 2) | (bh << 30)) ^ ((bl >>> 7) | (bh << 25)); + s0l = ((bl >>> 28) | (bh << 4)) ^ ((bh >>> 2) | (bl << 30)) ^ ((bh >>> 7) | (bl << 25)); + + s1h = ((fh >>> 14) | (fl << 18)) ^ ((fh >>> 18) | (fl << 14)) ^ ((fl >>> 9) | (fh << 23)); + s1l = ((fl >>> 14) | (fh << 18)) ^ ((fl >>> 18) | (fh << 14)) ^ ((fh >>> 9) | (fl << 23)); + + bch = bh & ch; + bcl = bl & cl; + majh = bch ^ (bh & dh) ^ cdh; + majl = bcl ^ (bl & dl) ^ cdl; + + chh = (fh & gh) ^ (~fh & hh); + chl = (fl & gl) ^ (~fl & hl); + + t1h = blocks[j + 6]; + t1l = blocks[j + 7]; + t2h = K[j + 6]; + t2l = K[j + 7]; + + c1 = (t2l & 0xFFFF) + (t1l & 0xFFFF) + (chl & 0xFFFF) + (s1l & 0xFFFF) + (el & 0xFFFF); + c2 = (t2l >>> 16) + (t1l >>> 16) + (chl >>> 16) + (s1l >>> 16) + (el >>> 16) + (c1 >>> 16); + c3 = (t2h & 0xFFFF) + (t1h & 0xFFFF) + (chh & 0xFFFF) + (s1h & 0xFFFF) + (eh & 0xFFFF) + (c2 >>> 16); + c4 = (t2h >>> 16) + (t1h >>> 16) + (chh >>> 16) + (s1h >>> 16) + (eh >>> 16) + (c3 >>> 16); + + t1h = (c4 << 16) | (c3 & 0xFFFF); + t1l = (c2 << 16) | (c1 & 0xFFFF); + + c1 = (majl & 0xFFFF) + (s0l & 0xFFFF); + c2 = (majl >>> 16) + (s0l >>> 16) + (c1 >>> 16); + c3 = (majh & 0xFFFF) + (s0h & 0xFFFF) + (c2 >>> 16); + c4 = (majh >>> 16) + (s0h >>> 16) + (c3 >>> 16); + + t2h = (c4 << 16) | (c3 & 0xFFFF); + t2l = (c2 << 16) | (c1 & 0xFFFF); + + c1 = (al & 0xFFFF) + (t1l & 0xFFFF); + c2 = (al >>> 16) + (t1l >>> 16) + (c1 >>> 16); + c3 = (ah & 0xFFFF) + (t1h & 0xFFFF) + (c2 >>> 16); + c4 = (ah >>> 16) + (t1h >>> 16) + (c3 >>> 16); + + eh = (c4 << 16) | (c3 & 0xFFFF); + el = (c2 << 16) | (c1 & 0xFFFF); + + c1 = (t2l & 0xFFFF) + (t1l & 0xFFFF); + c2 = (t2l >>> 16) + (t1l >>> 16) + (c1 >>> 16); + c3 = (t2h & 0xFFFF) + (t1h & 0xFFFF) + (c2 >>> 16); + c4 = (t2h >>> 16) + (t1h >>> 16) + (c3 >>> 16); + + ah = (c4 << 16) | (c3 & 0xFFFF); + al = (c2 << 16) | (c1 & 0xFFFF); + } + + c1 = (h0l & 0xFFFF) + (al & 0xFFFF); + c2 = (h0l >>> 16) + (al >>> 16) + (c1 >>> 16); + c3 = (h0h & 0xFFFF) + (ah & 0xFFFF) + (c2 >>> 16); + c4 = (h0h >>> 16) + (ah >>> 16) + (c3 >>> 16); + + this.h0h = (c4 << 16) | (c3 & 0xFFFF); + this.h0l = (c2 << 16) | (c1 & 0xFFFF); + + c1 = (h1l & 0xFFFF) + (bl & 0xFFFF); + c2 = (h1l >>> 16) + (bl >>> 16) + (c1 >>> 16); + c3 = (h1h & 0xFFFF) + (bh & 0xFFFF) + (c2 >>> 16); + c4 = (h1h >>> 16) + (bh >>> 16) + (c3 >>> 16); + + this.h1h = (c4 << 16) | (c3 & 0xFFFF); + this.h1l = (c2 << 16) | (c1 & 0xFFFF); + + c1 = (h2l & 0xFFFF) + (cl & 0xFFFF); + c2 = (h2l >>> 16) + (cl >>> 16) + (c1 >>> 16); + c3 = (h2h & 0xFFFF) + (ch & 0xFFFF) + (c2 >>> 16); + c4 = (h2h >>> 16) + (ch >>> 16) + (c3 >>> 16); + + this.h2h = (c4 << 16) | (c3 & 0xFFFF); + this.h2l = (c2 << 16) | (c1 & 0xFFFF); + + c1 = (h3l & 0xFFFF) + (dl & 0xFFFF); + c2 = (h3l >>> 16) + (dl >>> 16) + (c1 >>> 16); + c3 = (h3h & 0xFFFF) + (dh & 0xFFFF) + (c2 >>> 16); + c4 = (h3h >>> 16) + (dh >>> 16) + (c3 >>> 16); + + this.h3h = (c4 << 16) | (c3 & 0xFFFF); + this.h3l = (c2 << 16) | (c1 & 0xFFFF); + + c1 = (h4l & 0xFFFF) + (el & 0xFFFF); + c2 = (h4l >>> 16) + (el >>> 16) + (c1 >>> 16); + c3 = (h4h & 0xFFFF) + (eh & 0xFFFF) + (c2 >>> 16); + c4 = (h4h >>> 16) + (eh >>> 16) + (c3 >>> 16); + + this.h4h = (c4 << 16) | (c3 & 0xFFFF); + this.h4l = (c2 << 16) | (c1 & 0xFFFF); + + c1 = (h5l & 0xFFFF) + (fl & 0xFFFF); + c2 = (h5l >>> 16) + (fl >>> 16) + (c1 >>> 16); + c3 = (h5h & 0xFFFF) + (fh & 0xFFFF) + (c2 >>> 16); + c4 = (h5h >>> 16) + (fh >>> 16) + (c3 >>> 16); + + this.h5h = (c4 << 16) | (c3 & 0xFFFF); + this.h5l = (c2 << 16) | (c1 & 0xFFFF); + + c1 = (h6l & 0xFFFF) + (gl & 0xFFFF); + c2 = (h6l >>> 16) + (gl >>> 16) + (c1 >>> 16); + c3 = (h6h & 0xFFFF) + (gh & 0xFFFF) + (c2 >>> 16); + c4 = (h6h >>> 16) + (gh >>> 16) + (c3 >>> 16); + + this.h6h = (c4 << 16) | (c3 & 0xFFFF); + this.h6l = (c2 << 16) | (c1 & 0xFFFF); + + c1 = (h7l & 0xFFFF) + (hl & 0xFFFF); + c2 = (h7l >>> 16) + (hl >>> 16) + (c1 >>> 16); + c3 = (h7h & 0xFFFF) + (hh & 0xFFFF) + (c2 >>> 16); + c4 = (h7h >>> 16) + (hh >>> 16) + (c3 >>> 16); + + this.h7h = (c4 << 16) | (c3 & 0xFFFF); + this.h7l = (c2 << 16) | (c1 & 0xFFFF); +}; + +Sha512.prototype.hex = function () { + this.finalize(); + + var h0h = this.h0h, h0l = this.h0l, h1h = this.h1h, h1l = this.h1l, + h2h = this.h2h, h2l = this.h2l, h3h = this.h3h, h3l = this.h3l, + h4h = this.h4h, h4l = this.h4l, h5h = this.h5h, h5l = this.h5l, + h6h = this.h6h, h6l = this.h6l, h7h = this.h7h, h7l = this.h7l, + bits = this.bits; + + var hex = HEX_CHARS[(h0h >>> 28) & 0x0F] + HEX_CHARS[(h0h >>> 24) & 0x0F] + + HEX_CHARS[(h0h >>> 20) & 0x0F] + HEX_CHARS[(h0h >>> 16) & 0x0F] + + HEX_CHARS[(h0h >>> 12) & 0x0F] + HEX_CHARS[(h0h >>> 8) & 0x0F] + + HEX_CHARS[(h0h >>> 4) & 0x0F] + HEX_CHARS[h0h & 0x0F] + + HEX_CHARS[(h0l >>> 28) & 0x0F] + HEX_CHARS[(h0l >>> 24) & 0x0F] + + HEX_CHARS[(h0l >>> 20) & 0x0F] + HEX_CHARS[(h0l >>> 16) & 0x0F] + + HEX_CHARS[(h0l >>> 12) & 0x0F] + HEX_CHARS[(h0l >>> 8) & 0x0F] + + HEX_CHARS[(h0l >>> 4) & 0x0F] + HEX_CHARS[h0l & 0x0F] + + HEX_CHARS[(h1h >>> 28) & 0x0F] + HEX_CHARS[(h1h >>> 24) & 0x0F] + + HEX_CHARS[(h1h >>> 20) & 0x0F] + HEX_CHARS[(h1h >>> 16) & 0x0F] + + HEX_CHARS[(h1h >>> 12) & 0x0F] + HEX_CHARS[(h1h >>> 8) & 0x0F] + + HEX_CHARS[(h1h >>> 4) & 0x0F] + HEX_CHARS[h1h & 0x0F] + + HEX_CHARS[(h1l >>> 28) & 0x0F] + HEX_CHARS[(h1l >>> 24) & 0x0F] + + HEX_CHARS[(h1l >>> 20) & 0x0F] + HEX_CHARS[(h1l >>> 16) & 0x0F] + + HEX_CHARS[(h1l >>> 12) & 0x0F] + HEX_CHARS[(h1l >>> 8) & 0x0F] + + HEX_CHARS[(h1l >>> 4) & 0x0F] + HEX_CHARS[h1l & 0x0F] + + HEX_CHARS[(h2h >>> 28) & 0x0F] + HEX_CHARS[(h2h >>> 24) & 0x0F] + + HEX_CHARS[(h2h >>> 20) & 0x0F] + HEX_CHARS[(h2h >>> 16) & 0x0F] + + HEX_CHARS[(h2h >>> 12) & 0x0F] + HEX_CHARS[(h2h >>> 8) & 0x0F] + + HEX_CHARS[(h2h >>> 4) & 0x0F] + HEX_CHARS[h2h & 0x0F] + + HEX_CHARS[(h2l >>> 28) & 0x0F] + HEX_CHARS[(h2l >>> 24) & 0x0F] + + HEX_CHARS[(h2l >>> 20) & 0x0F] + HEX_CHARS[(h2l >>> 16) & 0x0F] + + HEX_CHARS[(h2l >>> 12) & 0x0F] + HEX_CHARS[(h2l >>> 8) & 0x0F] + + HEX_CHARS[(h2l >>> 4) & 0x0F] + HEX_CHARS[h2l & 0x0F] + + HEX_CHARS[(h3h >>> 28) & 0x0F] + HEX_CHARS[(h3h >>> 24) & 0x0F] + + HEX_CHARS[(h3h >>> 20) & 0x0F] + HEX_CHARS[(h3h >>> 16) & 0x0F] + + HEX_CHARS[(h3h >>> 12) & 0x0F] + HEX_CHARS[(h3h >>> 8) & 0x0F] + + HEX_CHARS[(h3h >>> 4) & 0x0F] + HEX_CHARS[h3h & 0x0F]; + if (bits >= 256) { + hex += HEX_CHARS[(h3l >>> 28) & 0x0F] + HEX_CHARS[(h3l >>> 24) & 0x0F] + + HEX_CHARS[(h3l >>> 20) & 0x0F] + HEX_CHARS[(h3l >>> 16) & 0x0F] + + HEX_CHARS[(h3l >>> 12) & 0x0F] + HEX_CHARS[(h3l >>> 8) & 0x0F] + + HEX_CHARS[(h3l >>> 4) & 0x0F] + HEX_CHARS[h3l & 0x0F]; + } + if (bits >= 384) { + hex += HEX_CHARS[(h4h >>> 28) & 0x0F] + HEX_CHARS[(h4h >>> 24) & 0x0F] + + HEX_CHARS[(h4h >>> 20) & 0x0F] + HEX_CHARS[(h4h >>> 16) & 0x0F] + + HEX_CHARS[(h4h >>> 12) & 0x0F] + HEX_CHARS[(h4h >>> 8) & 0x0F] + + HEX_CHARS[(h4h >>> 4) & 0x0F] + HEX_CHARS[h4h & 0x0F] + + HEX_CHARS[(h4l >>> 28) & 0x0F] + HEX_CHARS[(h4l >>> 24) & 0x0F] + + HEX_CHARS[(h4l >>> 20) & 0x0F] + HEX_CHARS[(h4l >>> 16) & 0x0F] + + HEX_CHARS[(h4l >>> 12) & 0x0F] + HEX_CHARS[(h4l >>> 8) & 0x0F] + + HEX_CHARS[(h4l >>> 4) & 0x0F] + HEX_CHARS[h4l & 0x0F] + + HEX_CHARS[(h5h >>> 28) & 0x0F] + HEX_CHARS[(h5h >>> 24) & 0x0F] + + HEX_CHARS[(h5h >>> 20) & 0x0F] + HEX_CHARS[(h5h >>> 16) & 0x0F] + + HEX_CHARS[(h5h >>> 12) & 0x0F] + HEX_CHARS[(h5h >>> 8) & 0x0F] + + HEX_CHARS[(h5h >>> 4) & 0x0F] + HEX_CHARS[h5h & 0x0F] + + HEX_CHARS[(h5l >>> 28) & 0x0F] + HEX_CHARS[(h5l >>> 24) & 0x0F] + + HEX_CHARS[(h5l >>> 20) & 0x0F] + HEX_CHARS[(h5l >>> 16) & 0x0F] + + HEX_CHARS[(h5l >>> 12) & 0x0F] + HEX_CHARS[(h5l >>> 8) & 0x0F] + + HEX_CHARS[(h5l >>> 4) & 0x0F] + HEX_CHARS[h5l & 0x0F]; + } + if (bits == 512) { + hex += HEX_CHARS[(h6h >>> 28) & 0x0F] + HEX_CHARS[(h6h >>> 24) & 0x0F] + + HEX_CHARS[(h6h >>> 20) & 0x0F] + HEX_CHARS[(h6h >>> 16) & 0x0F] + + HEX_CHARS[(h6h >>> 12) & 0x0F] + HEX_CHARS[(h6h >>> 8) & 0x0F] + + HEX_CHARS[(h6h >>> 4) & 0x0F] + HEX_CHARS[h6h & 0x0F] + + HEX_CHARS[(h6l >>> 28) & 0x0F] + HEX_CHARS[(h6l >>> 24) & 0x0F] + + HEX_CHARS[(h6l >>> 20) & 0x0F] + HEX_CHARS[(h6l >>> 16) & 0x0F] + + HEX_CHARS[(h6l >>> 12) & 0x0F] + HEX_CHARS[(h6l >>> 8) & 0x0F] + + HEX_CHARS[(h6l >>> 4) & 0x0F] + HEX_CHARS[h6l & 0x0F] + + HEX_CHARS[(h7h >>> 28) & 0x0F] + HEX_CHARS[(h7h >>> 24) & 0x0F] + + HEX_CHARS[(h7h >>> 20) & 0x0F] + HEX_CHARS[(h7h >>> 16) & 0x0F] + + HEX_CHARS[(h7h >>> 12) & 0x0F] + HEX_CHARS[(h7h >>> 8) & 0x0F] + + HEX_CHARS[(h7h >>> 4) & 0x0F] + HEX_CHARS[h7h & 0x0F] + + HEX_CHARS[(h7l >>> 28) & 0x0F] + HEX_CHARS[(h7l >>> 24) & 0x0F] + + HEX_CHARS[(h7l >>> 20) & 0x0F] + HEX_CHARS[(h7l >>> 16) & 0x0F] + + HEX_CHARS[(h7l >>> 12) & 0x0F] + HEX_CHARS[(h7l >>> 8) & 0x0F] + + HEX_CHARS[(h7l >>> 4) & 0x0F] + HEX_CHARS[h7l & 0x0F]; + } + return hex; +}; + +Sha512.prototype.toString = Sha512.prototype.hex; + +Sha512.prototype.digest = function () { + this.finalize(); + + var h0h = this.h0h, h0l = this.h0l, h1h = this.h1h, h1l = this.h1l, + h2h = this.h2h, h2l = this.h2l, h3h = this.h3h, h3l = this.h3l, + h4h = this.h4h, h4l = this.h4l, h5h = this.h5h, h5l = this.h5l, + h6h = this.h6h, h6l = this.h6l, h7h = this.h7h, h7l = this.h7l, + bits = this.bits; + + var arr = [ + (h0h >>> 24) & 0xFF, (h0h >>> 16) & 0xFF, (h0h >>> 8) & 0xFF, h0h & 0xFF, + (h0l >>> 24) & 0xFF, (h0l >>> 16) & 0xFF, (h0l >>> 8) & 0xFF, h0l & 0xFF, + (h1h >>> 24) & 0xFF, (h1h >>> 16) & 0xFF, (h1h >>> 8) & 0xFF, h1h & 0xFF, + (h1l >>> 24) & 0xFF, (h1l >>> 16) & 0xFF, (h1l >>> 8) & 0xFF, h1l & 0xFF, + (h2h >>> 24) & 0xFF, (h2h >>> 16) & 0xFF, (h2h >>> 8) & 0xFF, h2h & 0xFF, + (h2l >>> 24) & 0xFF, (h2l >>> 16) & 0xFF, (h2l >>> 8) & 0xFF, h2l & 0xFF, + (h3h >>> 24) & 0xFF, (h3h >>> 16) & 0xFF, (h3h >>> 8) & 0xFF, h3h & 0xFF + ]; + + if (bits >= 256) { + arr.push((h3l >>> 24) & 0xFF, (h3l >>> 16) & 0xFF, (h3l >>> 8) & 0xFF, h3l & 0xFF); + } + if (bits >= 384) { + arr.push( + (h4h >>> 24) & 0xFF, (h4h >>> 16) & 0xFF, (h4h >>> 8) & 0xFF, h4h & 0xFF, + (h4l >>> 24) & 0xFF, (h4l >>> 16) & 0xFF, (h4l >>> 8) & 0xFF, h4l & 0xFF, + (h5h >>> 24) & 0xFF, (h5h >>> 16) & 0xFF, (h5h >>> 8) & 0xFF, h5h & 0xFF, + (h5l >>> 24) & 0xFF, (h5l >>> 16) & 0xFF, (h5l >>> 8) & 0xFF, h5l & 0xFF + ); + } + if (bits == 512) { + arr.push( + (h6h >>> 24) & 0xFF, (h6h >>> 16) & 0xFF, (h6h >>> 8) & 0xFF, h6h & 0xFF, + (h6l >>> 24) & 0xFF, (h6l >>> 16) & 0xFF, (h6l >>> 8) & 0xFF, h6l & 0xFF, + (h7h >>> 24) & 0xFF, (h7h >>> 16) & 0xFF, (h7h >>> 8) & 0xFF, h7h & 0xFF, + (h7l >>> 24) & 0xFF, (h7l >>> 16) & 0xFF, (h7l >>> 8) & 0xFF, h7l & 0xFF + ); + } + return arr; +}; + +Sha512.prototype.array = Sha512.prototype.digest; + +Sha512.prototype.arrayBuffer = function () { + this.finalize(); + + var bits = this.bits; + var buffer = new ArrayBuffer(bits / 8); + var dataView = new DataView(buffer); + dataView.setUint32(0, this.h0h); + dataView.setUint32(4, this.h0l); + dataView.setUint32(8, this.h1h); + dataView.setUint32(12, this.h1l); + dataView.setUint32(16, this.h2h); + dataView.setUint32(20, this.h2l); + dataView.setUint32(24, this.h3h); + + if (bits >= 256) { + dataView.setUint32(28, this.h3l); + } + if (bits >= 384) { + dataView.setUint32(32, this.h4h); + dataView.setUint32(36, this.h4l); + dataView.setUint32(40, this.h5h); + dataView.setUint32(44, this.h5l); + } + if (bits == 512) { + dataView.setUint32(48, this.h6h); + dataView.setUint32(52, this.h6l); + dataView.setUint32(56, this.h7h); + dataView.setUint32(60, this.h7l); + } + return buffer; +}; + +Sha512.prototype.clone = function () { + var hash = new Sha512(this.bits, false); + this.copyTo(hash); + return hash; +}; + +Sha512.prototype.copyTo = function (hash) { + var i = 0, attrs = [ + 'h0h', 'h0l', 'h1h', 'h1l', 'h2h', 'h2l', 'h3h', 'h3l', 'h4h', 'h4l', 'h5h', 'h5l', 'h6h', 'h6l', 'h7h', 'h7l', + 'start', 'bytes', 'hBytes', 'finalized', 'hashed', 'lastByteIndex' + ]; + for (i = 0; i < attrs.length; ++i) { + hash[attrs[i]] = this[attrs[i]]; + } + for (i = 0; i < this.blocks.length; ++i) { + hash.blocks[i] = this.blocks[i]; + } +}; + +function HmacSha512(key, bits, sharedMemory) { + var i, result = formatMessage(key); + key = result[0]; + if (result[1]) { + var bytes = [], length = key.length, index = 0, code; + for (var i = 0; i < length; ++i) { + code = key.charCodeAt(i); + if (code < 0x80) { + bytes[index++] = code; + } else if (code < 0x800) { + bytes[index++] = (0xc0 | (code >>> 6)); + bytes[index++] = (0x80 | (code & 0x3f)); + } else if (code < 0xd800 || code >= 0xe000) { + bytes[index++] = (0xe0 | (code >>> 12)); + bytes[index++] = (0x80 | ((code >>> 6) & 0x3f)); + bytes[index++] = (0x80 | (code & 0x3f)); + } else { + code = 0x10000 + (((code & 0x3ff) << 10) | (key.charCodeAt(++i) & 0x3ff)); + bytes[index++] = (0xf0 | (code >>> 18)); + bytes[index++] = (0x80 | ((code >>> 12) & 0x3f)); + bytes[index++] = (0x80 | ((code >>> 6) & 0x3f)); + bytes[index++] = (0x80 | (code & 0x3f)); + } + } + key = bytes; + } + + if (key.length > 128) { + key = (new Sha512(bits, true)).update(key).array(); + } + + var oKeyPad = [], iKeyPad = []; + for (var i = 0; i < 128; ++i) { + var b = key[i] || 0; + oKeyPad[i] = 0x5c ^ b; + iKeyPad[i] = 0x36 ^ b; + } + + Sha512.call(this, bits, sharedMemory); + + this.update(iKeyPad); + this.oKeyPad = oKeyPad; + this.inner = true; + this.sharedMemory = sharedMemory; +} +HmacSha512.prototype = new Sha512(); + +HmacSha512.prototype.finalize = function () { + Sha512.prototype.finalize.call(this); + if (this.inner) { + this.inner = false; + var innerHash = this.array(); + Sha512.call(this, this.bits, this.sharedMemory); + this.update(this.oKeyPad); + this.update(innerHash); + Sha512.prototype.finalize.call(this); + } +}; + +HmacSha512.prototype.clone = function () { + var hash = new HmacSha512([], this.bits, false); + this.copyTo(hash); + hash.inner = this.inner; + for (var i = 0; i < this.oKeyPad.length; ++i) { + hash.oKeyPad[i] = this.oKeyPad[i]; + } + return hash; +}; + +export const sha512_256 = createMethod(256) \ No newline at end of file diff --git a/examples/next.js/src/lib/test.ts b/examples/next.js/src/lib/test.ts new file mode 100644 index 0000000..9ef532f --- /dev/null +++ b/examples/next.js/src/lib/test.ts @@ -0,0 +1,178 @@ +import init, { + type PayTransactionFields, + encodePayment, + attachSignature, +} from "algo_models"; + +let { AlgorandTransactionCrafter } = require("@algorandfoundation/algo-models"); +import * as ed from "@noble/ed25519"; + +import * as msgpack from "algo-msgpack-with-bigint"; +import {encodeAddress, exportKey, generateKey, sign} from "@/lib/wallet"; +import {KeyPairRecord} from "@/lib/types"; +// Generate a ed25519 keypair +const privKey = ed.utils.randomPrivateKey(); +console.log(privKey) +await init(); + +// console.log(encodeAddress()) + +// How many times it should run +const iterations = 2000; + +// Defaults +const genId = "testnet-v1.0"; +const genesisHash = "SGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiI="; +const amount = 1000000; +const from = "TIQ4WPFJQYSP2SKLSCDWTK2IIQQ6FOS6BHYIYDGRUZSSROJC5P3HBCZ67Y"; +const to = "66LKPOMVQJL2YVMTAVULQVZMZZCD5M2YVWA7KRHEOHYOJU5KLH2PB7HRRY"; +const algoCrafter = new AlgorandTransactionCrafter(genId, genesisHash); +const tx = algoCrafter + .pay(amount, from, to) + .addFirstValidRound(1000) + .addLastValidRound(1500) + // .addNote("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla hendrerit quam elit. Ut congue aliquet orci vitae laoreet. Nam pulvinar ex purus, et euismod odio ornare molestie. Nulla laoreet lectus diam, non efficitur arcu consequat id. Sed efficitur orci dui. Maecenas pulvinar massa sit amet auctor suscipit. Ut ipsum nibh, facilisis eget dolor a, egestas rutrum purus. Nulla molestie elit et turpis iaculis pellentesque. Nam augue risus, congue quis mauris ut, finibus auctor enim. Sed id sapien pretium lacus interdum finibus. Ut fermentum, ipsum vel sodales pellentesque, arcu ante tempor nisl, nec sollicitudin purus tellus ut mauris. Vivamus rhoncus, odio sed porta cursus, turpis arcu dictum purus, at hendrerit nisl dui in elit. Mauris gravida gravida lorem, ac aliquam mi pharetra in. Aenean sed malesuada libero. Curabitur sollicitudin nisi in sagittis posuere. Aliquam sit amet ante augue.Nullam vitae bibendum felis. Pellentesque interdum molestie neque eget pretium. Donec non bibendum nisi, sed faucibus nisi") + .get(); + +let nativeKey: KeyPairRecord | undefined; + +async function initNativeKey(){ + if(typeof nativeKey === "undefined"){ + nativeKey = await generateKey(true) + } +} + +export async function nativeTest(){ + await initNativeKey() + if(typeof nativeKey === 'undefined') throw new Error('Native key is undefined. This should not happen.') + + // TODO: Export the key and use the same for everything + //const exportedKey = await exportKey(nativeKey) + + const bytesForSigningNative: Uint8Array = tx.encode() + + console.log("Native", "start"); + const start = performance.now(); + const plist = [] + for (let i = 0; i < iterations; i++) { + plist.push(sign(bytesForSigningNative, nativeKey).then((sigNative)=>algoCrafter.addSignature(bytesForSigningNative, sigNative))); + } + const result = await Promise.all(plist); + const end = performance.now(); + console.log("Native", end - start); + return result +} +export async function nativeWithRustTest(){ + await initNativeKey() + if(typeof nativeKey === 'undefined') throw new Error('Native key is undefined. This should not happen.') + + + + const fields = { + header: { + // note: tx.note, + sender: tx.snd, + fee: tx.fee, + transactionType: "Payment", + firstValid: tx.fv, + lastValid: tx.lv, + genesisHash: tx.gh, + genesisId: tx.gen, + }, + receiver: tx.rcv, + amount: tx.amt, + } as PayTransactionFields; + + + + + // TODO: Export the key and use the same for everything + //const exportedKey = await exportKey(nativeKey) + + const btyesForSigning = encodePayment(fields); + + console.log("Native/Rust Start"); + const start = performance.now(); + const plist = [] + for (let i = 0; i < iterations; i++) { + plist.push(sign(btyesForSigning, nativeKey).then((sigNative)=>attachSignature(btyesForSigning, sigNative))); + } + const result = await Promise.all(plist); + const end = performance.now(); + console.log("Native/Rust Stop", end - start); + return result +} +export async function jsTest(){ + console.log("JS Start"); + const bytesForSigningTs: Uint8Array = tx.encode(); // encoded msg ready - to be signed with EdDSA + + + const start = performance.now(); + const plist = [] + for (let i = 0; i < iterations; i++) { + // The encoding algorithm is a fork of the actual msgpack (https://github.com/EvanJRichard/msgpack-javascript) + // After msgpack encoding a TX TAG is added as a prefix to the result. + plist.push(ed.signAsync(bytesForSigningTs, privKey).then((sigTs)=>algoCrafter.addSignature(bytesForSigningTs, sigTs))); + } + const result = await Promise.all(plist); + const end = performance.now(); + console.log("JS Stop", end - start); + return result +} + +export async function rustTest(){ + + const fields = { + header: { + sender: tx.snd, + fee: tx.fee, + transactionType: "Payment", + firstValid: tx.fv, + lastValid: tx.lv, + genesisHash: tx.gh, + genesisId: tx.gen, + }, + receiver: tx.rcv, + amount: tx.amt, + } as PayTransactionFields; + const btyesForSigning = encodePayment(fields); + + console.log("Rust", "start"); + const start = performance.now(); + const plist = [] + + for (let i = 0; i < iterations; i++) { + // Signing with a ed25519 lib that has no idea about Algorand + plist.push(ed.signAsync(btyesForSigning, privKey).then((sig)=>attachSignature(btyesForSigning, sig))); + } + const result = await Promise.all(plist); + const end = performance.now(); + console.log("Rust", end - start); + return result +} +export async function main() { + const js = await jsTest() + const rust = await rustTest() + const native = await nativeTest() + const nativeWithRust = await nativeWithRustTest() + + if(js.every((sig: Uint8Array, i) => { + return sig.every((v, j) => v === rust[i][j]) + })){ + console.log("JS is equal to Rust") + } else { + console.log("JS is not equal to Rust") + console.log(js) + console.log(rust) + } + + if(native.every((sig: Uint8Array, i) => { + return sig.every((v, j) => v === nativeWithRust[i][j]) + })){ + console.log("Native is equal to NativeRust") + } else { + console.log("Native is not equal to NativeRust") + console.log(native) + console.log(nativeWithRust) + } +} \ No newline at end of file diff --git a/examples/next.js/src/lib/types.ts b/examples/next.js/src/lib/types.ts new file mode 100644 index 0000000..5188bd9 --- /dev/null +++ b/examples/next.js/src/lib/types.ts @@ -0,0 +1,4 @@ +export type KeyPairRecord = { + id: IDBValidKey + keyPair: CryptoKeyPair +} \ No newline at end of file diff --git a/examples/next.js/src/lib/wallet.ts b/examples/next.js/src/lib/wallet.ts new file mode 100644 index 0000000..89cc2bd --- /dev/null +++ b/examples/next.js/src/lib/wallet.ts @@ -0,0 +1,63 @@ +import type { KeyPairRecord } from "./types.js"; + +import {createMethod} from "./sha512"; +import {encode} from "./hi-base32"; +import {saveKeyPair} from "@/lib/db"; + +const sha512_256 = createMethod(256); +const HASH_BYTES_LENGTH = 32; +const ALGORAND_CHECKSUM_BYTE_LENGTH = 4; +const ALGORAND_ADDRESS_LENGTH = 58; + +export async function sign(txnBytes: BufferSource, kpr: KeyPairRecord){ + const sig = await crypto.subtle.sign( + {name: 'Ed25519'}, + kpr.keyPair.privateKey, + txnBytes, + ); + return new Uint8Array(sig) +} +/** + * Get the address of a key pair + * @param keyPair + */ +export async function getAddress(keyPair: CryptoKeyPair){ + const key= new Uint8Array(await crypto.subtle.exportKey("raw", keyPair.publicKey)) + return encodeAddress(key) +} + +export async function exportKey(kpr: KeyPairRecord){ + console.log(kpr) + return await crypto.subtle.exportKey("pkcs8", kpr.keyPair.privateKey) +} +/** + * Create a new key pair + * @param extractable + * @param keyUsages + */ +export async function generateKey(extractable: boolean = false, keyUsages: KeyUsage[] = ["sign"]){ + const keyPair = (await crypto.subtle.generateKey({name: 'Ed25519'}, extractable, keyUsages) as CryptoKeyPair) + await saveKeyPair(keyPair) + return {keyPair, id: await getAddress(keyPair)} as KeyPairRecord +} + +/** + * Encode a public key to an address + * @param publicKey + */ +export function encodeAddress(publicKey: Uint8Array) { + // Concatenate the publicKey and the checksum, remove the extra '====' and return the base32 encoding + return `${encode([...publicKey, ...generateChecksum(publicKey)])}`.slice(0, ALGORAND_ADDRESS_LENGTH); +} + +/** + * Generate the checksum of a public key + * @param publicKey + */ +export function generateChecksum(publicKey: Uint8Array){ + return sha512_256.array(publicKey) + .slice( + HASH_BYTES_LENGTH - ALGORAND_CHECKSUM_BYTE_LENGTH, + HASH_BYTES_LENGTH + ); +} \ No newline at end of file diff --git a/examples/rust-native/Cargo.toml b/examples/rust-native/Cargo.toml new file mode 100644 index 0000000..cd71c74 --- /dev/null +++ b/examples/rust-native/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "rust-native" +version = "0.1.0" +edition = "2021" + +[dependencies] +algo_fetch = {path = "../../crates/algo_fetch"} +algo_models = {path = "../../crates/algo_models"} +tokio = { version = "1.42.0", features = ["rt", "rt-multi-thread", "macros"] } diff --git a/examples/rust-native/src/main.rs b/examples/rust-native/src/main.rs new file mode 100644 index 0000000..b82e87a --- /dev/null +++ b/examples/rust-native/src/main.rs @@ -0,0 +1,15 @@ +#[tokio::main] +async fn main() { + let configuration = algo_fetch::apis::configuration::Configuration{ + base_path: String::from("https://testnet-api.4160.nodely.dev"), + user_agent: None, + client: Default::default(), + basic_auth: None, + oauth_access_token: None, + bearer_access_token: None, + api_key: None, + }; + let round = 500; + let block_result = algo_fetch::apis::public_api::get_block(&configuration, round, None).await; + print!("{:?}", block_result); +} \ No newline at end of file diff --git a/openapitools.json b/openapitools.json new file mode 100644 index 0000000..f8d07ce --- /dev/null +++ b/openapitools.json @@ -0,0 +1,7 @@ +{ + "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json", + "spaces": 2, + "generator-cli": { + "version": "7.10.0" + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..41a3775 --- /dev/null +++ b/package.json @@ -0,0 +1,7 @@ +{ + "name": "ffi-testing", + "workspaces": [ + "./examples/next.js", + "./crates/algo_models/tests/js" + ] +} \ No newline at end of file