diff --git a/CHANGELOG.md b/CHANGELOG.md index 09150a66c2..32f7cfb5f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,18 @@ Changelog ========= +[0.21.1](https://github.com/ordinals/ord/releases/tag/0.21.1) - 2024-10-20 +-------------------------------------------------------------------------- + +### Fixed +- Revert redb to 2.1.3 ([#4003](https://github.com/ordinals/ord/pull/4003) by [raphjaph](https://github.com/raphjaph)) + +### Changed +- Remove /runes/balances API endpoint ([#3980](https://github.com/ordinals/ord/pull/3980) by [lifofifoX](https://github.com/lifofifoX)) + +### Misc +- Update rust-bitcoin in ord ([#3962](https://github.com/ordinals/ord/pull/3962) by [raphjaph](https://github.com/raphjaph)) + [0.21.0](https://github.com/ordinals/ord/releases/tag/0.21.0) - 2024-10-11 -------------------------------------------------------------------------- diff --git a/Cargo.lock b/Cargo.lock index a74aeb4a8e..5247b01bca 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -113,9 +113,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.89" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" +checksum = "c042108f3ed77fd83760a5fd79b53be043192bb3b9dba91d8c574c0ada7850c8" dependencies = [ "backtrace", ] @@ -194,9 +194,9 @@ dependencies = [ [[package]] name = "async-compression" -version = "0.4.14" +version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "998282f8f49ccd6116b0ed8a4de0fbd3151697920e7c7533416d6e25e76434a7" +checksum = "0cb8f1d480b0ea3783ab015936d2a55c87e219676f0c0b7dec61494043f21857" dependencies = [ "brotli", "flate2", @@ -273,7 +273,7 @@ checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.85", ] [[package]] @@ -375,7 +375,7 @@ dependencies = [ "futures-util", "http 0.2.12", "http-body 0.4.6", - "hyper 0.14.30", + "hyper 0.14.31", "itoa", "matchit", "memchr", @@ -422,7 +422,7 @@ dependencies = [ "futures-util", "http 0.2.12", "http-body 0.4.6", - "hyper 0.14.30", + "hyper 0.14.31", "pin-project-lite", "rustls 0.21.12", "rustls-pemfile 1.0.4", @@ -483,11 +483,11 @@ checksum = "d965446196e3b7decd44aa7ee49e31d630118f90ef12f97900f262eb915c951d" [[package]] name = "bip322" version = "0.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e218244320153598ead280c261e603b18ad07d8740fae9c3a5fc809b312ebd2" dependencies = [ "base64 0.22.1", "bitcoin", - "bitcoin-io", - "bitcoin_hashes 0.14.0", "hex", "miniscript", "snafu", @@ -643,7 +643,7 @@ dependencies = [ "new_mime_guess", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.85", ] [[package]] @@ -691,9 +691,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.7.2" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3" +checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da" [[package]] name = "cast" @@ -703,9 +703,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.1.30" +version = "1.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b16803a61b81d9eabb7eae2588776c4c1e584b738ede45fdbb4c972cec1e9945" +checksum = "c2e7962b54006dcfcc61cb72735f4d89bb97061dd6a7ed882ec6b8ee53714c6f" dependencies = [ "shlex", ] @@ -801,7 +801,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.85", ] [[package]] @@ -990,7 +990,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.79", + "syn 2.0.85", ] [[package]] @@ -1001,7 +1001,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn 2.0.79", + "syn 2.0.85", ] [[package]] @@ -1052,7 +1052,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.85", ] [[package]] @@ -1062,7 +1062,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c" dependencies = [ "derive_builder_core", - "syn 2.0.79", + "syn 2.0.85", ] [[package]] @@ -1082,7 +1082,7 @@ checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.85", "unicode-xid", ] @@ -1140,7 +1140,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.85", ] [[package]] @@ -1372,7 +1372,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.85", ] [[package]] @@ -1689,9 +1689,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.30" +version = "0.14.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a152ddd61dfaec7273fe8419ab357f33aee0d914c5f4efbf0d96fa749eea5ec9" +checksum = "8c08302e8fa335b151b788c775ff56e7a03ae64ff85c548ee820fecb70356e85" dependencies = [ "bytes", "futures-channel", @@ -1713,9 +1713,9 @@ dependencies = [ [[package]] name = "hyper" -version = "1.4.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" +checksum = "bbbff0a806a4728c99295b254c8838933b5b082d75e3cb70c8dab21fdfbcfa9a" dependencies = [ "bytes", "futures-channel", @@ -1739,9 +1739,9 @@ checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" dependencies = [ "futures-util", "http 1.1.0", - "hyper 1.4.1", + "hyper 1.5.0", "hyper-util", - "rustls 0.23.14", + "rustls 0.23.15", "rustls-pki-types", "tokio", "tokio-rustls 0.26.0", @@ -1755,7 +1755,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ "bytes", - "hyper 0.14.30", + "hyper 0.14.31", "native-tls", "tokio", "tokio-native-tls", @@ -1769,7 +1769,7 @@ checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" dependencies = [ "bytes", "http-body-util", - "hyper 1.4.1", + "hyper 1.5.0", "hyper-util", "native-tls", "tokio", @@ -1788,7 +1788,7 @@ dependencies = [ "futures-util", "http 1.1.0", "http-body 1.0.1", - "hyper 1.4.1", + "hyper 1.5.0", "pin-project-lite", "socket2 0.5.7", "tokio", @@ -1983,7 +1983,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1dea6e07251d9ce6a552abfb5d7ad6bc290a4596c8dcc3d795fae2bbdc1f3ff" dependencies = [ "futures", - "hyper 0.14.30", + "hyper 0.14.31", "jsonrpc-core", "jsonrpc-server-utils", "log", @@ -2027,9 +2027,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.159" +version = "0.2.161" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" +checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" [[package]] name = "libredox" @@ -2347,9 +2347,9 @@ checksum = "b410bbe7e14ab526a0e86877eb47c6996a2bd7746f027ba551028c925390e4e9" [[package]] name = "openssl" -version = "0.10.66" +version = "0.10.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" +checksum = "6174bc48f102d208783c2c84bf931bb75927a617866870de8a4ea85597f871f5" dependencies = [ "bitflags 2.6.0", "cfg-if 1.0.0", @@ -2368,7 +2368,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.85", ] [[package]] @@ -2379,9 +2379,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.103" +version = "0.9.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" +checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741" dependencies = [ "cc", "libc", @@ -2397,7 +2397,7 @@ checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" [[package]] name = "ord" -version = "0.21.0" +version = "0.21.1" dependencies = [ "anyhow", "async-trait", @@ -2424,7 +2424,7 @@ dependencies = [ "html-escaper", "http 0.2.12", "humantime", - "hyper 0.14.30", + "hyper 0.14.31", "indicatif", "lazy_static", "log", @@ -2561,7 +2561,7 @@ checksum = "a4502d8515ca9f32f1fb543d987f63d95a14934883db45bdb48060b6b69257f8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.85", ] [[package]] @@ -2679,9 +2679,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.87" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3e4daa0dcf6feba26f985457cdf104d4b4256fc5a09547140f3631bb076b19a" +checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" dependencies = [ "unicode-ident", ] @@ -2769,9 +2769,9 @@ dependencies = [ [[package]] name = "redb" -version = "2.1.4" +version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "074373f3e7e5d27d8741d19512232adb47be8622d3daef3a45bcae72050c3d2a" +checksum = "e4760ad04a88ef77075ba86ba9ea79b919e6bab29c1764c5747237cd6eaedcaa" dependencies = [ "libc", ] @@ -2813,7 +2813,7 @@ checksum = "bcc303e793d3734489387d205e9b186fac9c6cfacedd98cbb2e8a5943595f3e6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.85", ] [[package]] @@ -2860,7 +2860,7 @@ dependencies = [ "h2 0.3.26", "http 0.2.12", "http-body 0.4.6", - "hyper 0.14.30", + "hyper 0.14.31", "hyper-tls 0.5.0", "ipnet", "js-sys", @@ -2903,7 +2903,7 @@ dependencies = [ "http 1.1.0", "http-body 1.0.1", "http-body-util", - "hyper 1.4.1", + "hyper 1.5.0", "hyper-rustls", "hyper-tls 0.6.0", "hyper-util", @@ -2993,7 +2993,7 @@ dependencies = [ "proc-macro2", "quote", "rust-embed-utils", - "syn 2.0.79", + "syn 2.0.85", "walkdir", ] @@ -3077,9 +3077,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.14" +version = "0.23.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "415d9944693cb90382053259f89fbb077ea730ad7273047ec63b19bc9b160ba8" +checksum = "5fbb44d7acc4e873d613422379f69f237a1b141928c02f6bc6ccfddddc2d7993" dependencies = [ "once_cell", "rustls-pki-types", @@ -3137,9 +3137,9 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e696e35370c65c9c541198af4543ccd580cf17fc25d8e05c5a242b202488c55" +checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" [[package]] name = "rustls-webpki" @@ -3164,9 +3164,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" +checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" [[package]] name = "ryu" @@ -3254,9 +3254,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.210" +version = "1.0.213" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" +checksum = "3ea7893ff5e2466df8d720bb615088341b295f849602c6956047f8f80f0e9bc1" dependencies = [ "serde_derive", ] @@ -3274,20 +3274,20 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.210" +version = "1.0.213" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" +checksum = "7e85ad2009c50b58e87caa8cd6dac16bdf511bbfb7af6c33df902396aa480fa5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.85", ] [[package]] name = "serde_json" -version = "1.0.128" +version = "1.0.132" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" +checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03" dependencies = [ "indexmap 2.6.0", "itoa", @@ -3345,7 +3345,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.85", ] [[package]] @@ -3430,7 +3430,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.85", ] [[package]] @@ -3512,9 +3512,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.79" +version = "2.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" +checksum = "5023162dfcd14ef8f32034d8bcd4cc5ddc61ef7a247c024a33e24e1f24d21b56" dependencies = [ "proc-macro2", "quote", @@ -3619,22 +3619,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.64" +version = "1.0.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" +checksum = "5d11abd9594d9b38965ef50805c5e469ca9cc6f197f883f717e0269a3057b3d5" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.64" +version = "1.0.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" +checksum = "ae71770322cbd277e69d762a16c444af02aa0575ac0d174f0b9562d3b37f8602" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.85", ] [[package]] @@ -3695,9 +3695,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.40.0" +version = "1.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" +checksum = "145f3413504347a2be84393cc8a7d2fb4d863b375909ea59f2158261aa258bbb" dependencies = [ "backtrace", "bytes", @@ -3717,7 +3717,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.85", ] [[package]] @@ -3746,7 +3746,7 @@ version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" dependencies = [ - "rustls 0.23.14", + "rustls 0.23.15", "rustls-pki-types", "tokio", ] @@ -3884,12 +3884,9 @@ checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "unicase" -version = "2.7.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" -dependencies = [ - "version_check", -] +checksum = "7e51b68083f157f853b6379db119d1c1be0e6e4dec98101079dec41f6f5cf6df" [[package]] name = "unicode-bidi" @@ -4049,7 +4046,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.85", "wasm-bindgen-shared", ] @@ -4083,7 +4080,7 @@ checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.85", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -4180,7 +4177,7 @@ checksum = "9107ddc059d5b6fbfbffdfa7a7fe3e22a226def0b2608f72e9d552763d3e1ad7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.85", ] [[package]] @@ -4191,7 +4188,7 @@ checksum = "29bee4b38ea3cde66011baa44dba677c432a78593e202392d1e9070cf2a7fca7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.85", ] [[package]] @@ -4442,7 +4439,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.85", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 42b869ecaa..8d9f939b3a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "ord" description = "◉ Ordinal wallet and block explorer" -version = "0.21.0" +version = "0.21.1" license = "CC0-1.0" edition = "2021" autotests = false @@ -18,12 +18,12 @@ maintainer = "The Ord Maintainers" members = [".", "crates/*"] [dependencies] -anyhow = { version = "1.0.56", features = ["backtrace"] } +anyhow = { version = "1.0.90", features = ["backtrace"] } async-trait = "0.1.72" axum = { version = "0.6.1", features = ["http2"] } axum-server = "0.5.0" base64 = "0.22.0" -bip322 = { version = "0.0.8", path = "../bip322" } +bip322 = "0.0.8" bip39 = "2.0.0" bitcoin = { version = "0.32.3", features = ["rand"] } bitcoincore-rpc = "0.19.0" @@ -50,7 +50,7 @@ mime_guess = "2.0.4" miniscript = "12.0.0" mp4 = "0.14.0" ordinals = { version = "0.0.11", path = "crates/ordinals" } -redb = "2.1.1" +redb = "=2.1.3" ref-cast = "1.0.23" regex = "1.6.0" reqwest = { version = "0.11.27", features = ["blocking", "json"] } @@ -60,7 +60,7 @@ rustls = "0.22.0" rustls-acme = { version = "0.8.1", features = ["axum"] } serde = { version = "1.0.137", features = ["derive"] } serde-hex = "0.1.0" -serde_json = { version = "1.0.81", features = ["preserve_order"] } +serde_json = { version = "1.0.132", features = ["preserve_order"] } serde_with = "3.7.0" serde_yaml = "0.9.17" sha3 = "0.10.8" diff --git a/bin/install-bitcoin-core-linux b/bin/install-bitcoin-core-linux index f7c35aac84..638bf713b8 100755 --- a/bin/install-bitcoin-core-linux +++ b/bin/install-bitcoin-core-linux @@ -2,7 +2,7 @@ set -euxo pipefail -version=27.1 +version=28.0 wget \ -O bitcoin.tar.gz \ diff --git a/src/index.rs b/src/index.rs index e03ccc280c..73d13f8ee9 100644 --- a/src/index.rs +++ b/src/index.rs @@ -566,7 +566,7 @@ impl Index { .collect::>>() } - pub fn status(&self) -> Result { + pub fn status(&self, json_api: bool) -> Result { let rtx = self.database.begin_read()?; let statistic_to_count = rtx.open_table(STATISTIC_TO_COUNT)?; @@ -602,6 +602,7 @@ impl Index { initial_sync_time: Duration::from_micros(initial_sync_time), inscription_index: self.has_inscription_index(), inscriptions: blessed_inscriptions + cursed_inscriptions, + json_api, lost_sats: statistic(Statistic::LostSats)?, minimum_rune_for_next_block: Rune::minimum_at_height( self.settings.chain().network(), diff --git a/src/options.rs b/src/options.rs index 3dc0062ce3..a3f8d0160d 100644 --- a/src/options.rs +++ b/src/options.rs @@ -49,10 +49,7 @@ pub struct Options { help = "Set index cache size to bytes. [default: 1/4 available RAM]" )] pub(crate) index_cache_size: Option, - #[arg( - long, - help = "Track location of runes. RUNES ARE IN AN UNFINISHED PRE-ALPHA STATE AND SUBJECT TO CHANGE AT ANY TIME." - )] + #[arg(long, help = "Track location of runes.")] pub(crate) index_runes: bool, #[arg(long, help = "Track location of all satoshis.")] pub(crate) index_sats: bool, diff --git a/src/subcommand/server.rs b/src/subcommand/server.rs index c4a247c18a..29daf3388d 100644 --- a/src/subcommand/server.rs +++ b/src/subcommand/server.rs @@ -1108,9 +1108,12 @@ impl Server { ) -> ServerResult { task::block_in_place(|| { Ok(if accept_json { - Json(index.status()?).into_response() + Json(index.status(server_config.json_api_enabled)?).into_response() } else { - index.status()?.page(server_config).into_response() + index + .status(server_config.json_api_enabled)? + .page(server_config) + .into_response() }) }) } @@ -3248,8 +3251,6 @@ mod tests {
no
supply
340282366920938463463374607431768211455\u{A0}%
-
mint progress
-
100%
premine
340282366920938463463374607431768211455\u{A0}%
premine percentage
@@ -3704,6 +3705,8 @@ mod tests {
false
transaction index
false
+
json api
+
true
git branch
.*
git commit
diff --git a/src/templates/rune.rs b/src/templates/rune.rs index b85c477915..3d1671b70d 100644 --- a/src/templates/rune.rs +++ b/src/templates/rune.rs @@ -8,6 +8,28 @@ pub struct RuneHtml { pub parent: Option, } +impl RuneHtml { + fn mint_progress(&self) -> Option { + if !self.mintable { + return None; + } + + let cap = self.entry.terms?.cap?; + + if cap == 0 { + return None; + } + + let progress = self.entry.mints as f64 / cap as f64; + + #[allow(clippy::cast_possible_truncation, clippy::cast_sign_loss)] + Some(Decimal { + value: (progress * 10000.0) as u128, + scale: 2, + }) + } +} + impl PageContent for RuneHtml { fn title(&self) -> String { format!("Rune {}", self.entry.spaced_rune) @@ -40,7 +62,7 @@ mod tests { rune: Rune(u128::MAX), spacers: 1 }, - symbol: Some('%'), + symbol: Some('@'), timestamp: 0, turbo: true, }, @@ -72,7 +94,7 @@ mod tests {
end
11
amount
-
1.000000001 %
+
1.000000001 @
mints
100
cap
@@ -81,22 +103,22 @@ mod tests {
1
mintable
true
+
progress
+
99%
supply
-
100.123456889\u{A0}%
-
mint progress
-
99.01%
+
100.123456889\u{A0}@
premine
-
0.123456789\u{A0}%
+
0.123456789\u{A0}@
premine percentage
0.12%
burned
-
123456789.123456789\u{A0}%
+
123456789.123456789\u{A0}@
divisibility
9
symbol
-
%
+
@
turbo
true
etching
@@ -231,4 +253,82 @@ mod tests { " ); } + + #[test] + fn mint_progress() { + assert_regex_match!( + RuneHtml { + entry: RuneEntry { + block: 0, + burned: 0, + divisibility: 0, + etching: Txid::all_zeros(), + mints: 5555, + terms: Some(Terms { + cap: Some(10000), + offset: (None, None), + height: (None, None), + amount: None, + }), + number: 0, + premine: 0, + spaced_rune: SpacedRune { + rune: Rune(0), + spacers: 0 + }, + symbol: None, + timestamp: 0, + turbo: false, + }, + id: RuneId { block: 0, tx: 0 }, + mintable: false, + parent: Some(InscriptionId { + txid: Txid::all_zeros(), + index: 0, + }), + }, + ".* +
mintable
+
false
+ .*" + ); + + assert_regex_match!( + RuneHtml { + entry: RuneEntry { + block: 0, + burned: 0, + divisibility: 0, + etching: Txid::all_zeros(), + mints: 5555, + terms: Some(Terms { + cap: Some(10000), + offset: (None, None), + height: (None, None), + amount: None, + }), + number: 0, + premine: 0, + spaced_rune: SpacedRune { + rune: Rune(0), + spacers: 0 + }, + symbol: None, + timestamp: 0, + turbo: false, + }, + id: RuneId { block: 0, tx: 0 }, + mintable: true, + parent: Some(InscriptionId { + txid: Txid::all_zeros(), + index: 0, + }), + }, + ".* +
mintable
+
true
+
progress
+
55.55%
.*" + ); + } } diff --git a/src/templates/status.rs b/src/templates/status.rs index 8efe0a2fef..92c4df3f10 100644 --- a/src/templates/status.rs +++ b/src/templates/status.rs @@ -10,6 +10,7 @@ pub struct StatusHtml { pub initial_sync_time: Duration, pub inscription_index: bool, pub inscriptions: u64, + pub json_api: bool, pub lost_sats: u64, pub minimum_rune_for_next_block: Rune, pub rune_index: bool, diff --git a/templates/rune.html b/templates/rune.html index a45aecaff1..e2b4bb4bba 100644 --- a/templates/rune.html +++ b/templates/rune.html @@ -45,6 +45,10 @@

{{ self.entry.spaced_rune }}

{{ terms.cap.unwrap_or_default() - self.entry.mints }}
mintable
{{ self.mintable }}
+%% if let Some(mint_progress) = self.mint_progress() { +
progress
+
{{ mint_progress }}%
+%% } %% } else { @@ -52,8 +56,6 @@

{{ self.entry.spaced_rune }}

%% }
supply
{{ self.entry.pile(self.entry.supply()) }}
-
mint progress
-
{{ Decimal { value: ((self.entry.supply() as f64 / self.entry.max_supply() as f64) * 10000.0) as u128, scale: 2 } }}%
premine
{{ self.entry.pile(self.entry.premine) }}
premine percentage
diff --git a/templates/status.html b/templates/status.html index be47e68ea7..e403777dc3 100644 --- a/templates/status.html +++ b/templates/status.html @@ -38,6 +38,8 @@

Status

{{ self.sat_index }}
transaction index
{{ self.transaction_index }}
+
json api
+
{{ self.json_api }}
%% if !env!("GIT_BRANCH").is_empty() {
git branch
{{ env!("GIT_BRANCH") }}
diff --git a/tests/json_api.rs b/tests/json_api.rs index 8047033127..dd6c0d16c2 100644 --- a/tests/json_api.rs +++ b/tests/json_api.rs @@ -502,6 +502,7 @@ fn get_status() { initial_sync_time: dummy_duration, inscription_index: true, inscriptions: 1, + json_api: true, lost_sats: 0, minimum_rune_for_next_block: Rune(99218849511960410), rune_index: true, diff --git a/tests/lib.rs b/tests/lib.rs index 9415443adf..e6f9647103 100644 --- a/tests/lib.rs +++ b/tests/lib.rs @@ -10,8 +10,8 @@ use { executable_path::executable_path, mockcore::TransactionTemplate, ord::{ - api, chain::Chain, decimal::Decimal, outgoing::Outgoing, subcommand::runes::RuneInfo, - wallet::batch, wallet::ListDescriptorsResult, InscriptionId, RuneEntry, + api, chain::Chain, outgoing::Outgoing, subcommand::runes::RuneInfo, wallet::batch, + wallet::ListDescriptorsResult, InscriptionId, RuneEntry, }, ordinals::{ Artifact, Charm, Edict, Pile, Rarity, Rune, RuneId, Runestone, Sat, SatPoint, SpacedRune, @@ -327,6 +327,11 @@ fn batch(core: &mockcore::Handle, ord: &TestServer, batchfile: batch::File) -> E mint_definition.push("
mintable
".into()); mint_definition.push(format!("
{mintable}
")); + if mintable { + mint_definition.push("
progress
".into()); + mint_definition.push("
0%
".into()); + } + mint_definition.push("".into()); mint_definition.push("".into()); } else { @@ -335,14 +340,6 @@ fn batch(core: &mockcore::Handle, ord: &TestServer, batchfile: batch::File) -> E let RuneId { block, tx } = id; - let supply_int = supply.to_integer(divisibility).unwrap(); - let premine_int = premine.to_integer(divisibility).unwrap(); - - let mint_progress = Decimal { - value: ((premine_int as f64 / supply_int as f64) * 10000.0) as u128, - scale: 2, - }; - ord.assert_response_regex( format!("/rune/{rune}"), format!( @@ -356,8 +353,6 @@ fn batch(core: &mockcore::Handle, ord: &TestServer, batchfile: batch::File) -> E {}
supply
{premine} {symbol}
-
mint progress
-
{mint_progress}%
premine
{premine} {symbol}
premine percentage