Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 69a34418ab | |||
| fd00405245 | |||
| 7d77a9231c |
Generated
+61
-36
@@ -1259,12 +1259,12 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cosmos-sdk-proto"
|
name = "cosmos-sdk-proto"
|
||||||
version = "0.22.0-pre"
|
version = "0.26.1"
|
||||||
source = "git+https://github.com/cosmos/cosmos-rust?rev=4b1332e6d8258ac845cef71589c8d362a669675a#4b1332e6d8258ac845cef71589c8d362a669675a"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "462e1f6a8e005acc8835d32d60cbd7973ed65ea2a8d8473830e675f050956427"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"prost 0.12.6",
|
"prost 0.13.5",
|
||||||
"prost-types 0.12.6",
|
"tendermint-proto 0.40.1",
|
||||||
"tendermint-proto 0.37.0",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1289,11 +1289,12 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cosmrs"
|
name = "cosmrs"
|
||||||
version = "0.17.0-pre"
|
version = "0.21.1"
|
||||||
source = "git+https://github.com/cosmos/cosmos-rust?rev=4b1332e6d8258ac845cef71589c8d362a669675a#4b1332e6d8258ac845cef71589c8d362a669675a"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1394c263335da09e8ba8c4b2c675d804e3e0deb44cce0866a5f838d3ddd43d02"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bip32",
|
"bip32",
|
||||||
"cosmos-sdk-proto 0.22.0-pre",
|
"cosmos-sdk-proto 0.26.1",
|
||||||
"ecdsa",
|
"ecdsa",
|
||||||
"eyre",
|
"eyre",
|
||||||
"k256",
|
"k256",
|
||||||
@@ -1302,7 +1303,7 @@ dependencies = [
|
|||||||
"serde_json",
|
"serde_json",
|
||||||
"signature",
|
"signature",
|
||||||
"subtle-encoding",
|
"subtle-encoding",
|
||||||
"tendermint 0.37.0",
|
"tendermint 0.40.1",
|
||||||
"tendermint-rpc",
|
"tendermint-rpc",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
]
|
]
|
||||||
@@ -4314,7 +4315,7 @@ name = "nym-api-requests"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bs58",
|
"bs58",
|
||||||
"cosmrs 0.17.0-pre",
|
"cosmrs 0.21.1",
|
||||||
"cosmwasm-std",
|
"cosmwasm-std",
|
||||||
"ecdsa",
|
"ecdsa",
|
||||||
"getset",
|
"getset",
|
||||||
@@ -4330,7 +4331,7 @@ dependencies = [
|
|||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"sha2 0.10.8",
|
"sha2 0.10.8",
|
||||||
"tendermint 0.37.0",
|
"tendermint 0.40.1",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"time",
|
"time",
|
||||||
"ts-rs",
|
"ts-rs",
|
||||||
@@ -4457,7 +4458,7 @@ name = "nym-bity-integration"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"cosmrs 0.17.0-pre",
|
"cosmrs 0.21.1",
|
||||||
"eyre",
|
"eyre",
|
||||||
"k256",
|
"k256",
|
||||||
"nym-cli-commands",
|
"nym-cli-commands",
|
||||||
@@ -4504,7 +4505,7 @@ dependencies = [
|
|||||||
"clap 4.5.17",
|
"clap 4.5.17",
|
||||||
"colored",
|
"colored",
|
||||||
"comfy-table",
|
"comfy-table",
|
||||||
"cosmrs 0.17.0-pre",
|
"cosmrs 0.21.1",
|
||||||
"cosmwasm-std",
|
"cosmwasm-std",
|
||||||
"csv",
|
"csv",
|
||||||
"cw-utils",
|
"cw-utils",
|
||||||
@@ -4666,7 +4667,7 @@ name = "nym-client-core-gateways-storage"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"cosmrs 0.17.0-pre",
|
"cosmrs 0.21.1",
|
||||||
"log",
|
"log",
|
||||||
"nym-crypto",
|
"nym-crypto",
|
||||||
"nym-gateway-requests",
|
"nym-gateway-requests",
|
||||||
@@ -4913,7 +4914,7 @@ version = "0.1.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"bincode",
|
"bincode",
|
||||||
"bls12_381",
|
"bls12_381",
|
||||||
"cosmrs 0.17.0-pre",
|
"cosmrs 0.21.1",
|
||||||
"log",
|
"log",
|
||||||
"nym-api-requests",
|
"nym-api-requests",
|
||||||
"nym-credentials-interface",
|
"nym-credentials-interface",
|
||||||
@@ -5899,6 +5900,7 @@ version = "0.1.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.22.1",
|
"base64 0.22.1",
|
||||||
"bs58",
|
"bs58",
|
||||||
|
"hex",
|
||||||
"serde",
|
"serde",
|
||||||
"time",
|
"time",
|
||||||
]
|
]
|
||||||
@@ -6272,7 +6274,7 @@ name = "nym-types"
|
|||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.22.1",
|
"base64 0.22.1",
|
||||||
"cosmrs 0.17.0-pre",
|
"cosmrs 0.21.1",
|
||||||
"cosmwasm-std",
|
"cosmwasm-std",
|
||||||
"eyre",
|
"eyre",
|
||||||
"hmac",
|
"hmac",
|
||||||
@@ -6305,7 +6307,7 @@ dependencies = [
|
|||||||
"bip32",
|
"bip32",
|
||||||
"bip39",
|
"bip39",
|
||||||
"colored",
|
"colored",
|
||||||
"cosmrs 0.17.0-pre",
|
"cosmrs 0.21.1",
|
||||||
"cosmwasm-std",
|
"cosmwasm-std",
|
||||||
"cw-controllers",
|
"cw-controllers",
|
||||||
"cw-utils",
|
"cw-utils",
|
||||||
@@ -6329,8 +6331,9 @@ dependencies = [
|
|||||||
"nym-mixnet-contract-common",
|
"nym-mixnet-contract-common",
|
||||||
"nym-multisig-contract-common",
|
"nym-multisig-contract-common",
|
||||||
"nym-network-defaults",
|
"nym-network-defaults",
|
||||||
|
"nym-serde-helpers",
|
||||||
"nym-vesting-contract-common",
|
"nym-vesting-contract-common",
|
||||||
"prost 0.12.6",
|
"prost 0.13.5",
|
||||||
"reqwest 0.12.4",
|
"reqwest 0.12.4",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
@@ -6339,6 +6342,7 @@ dependencies = [
|
|||||||
"thiserror",
|
"thiserror",
|
||||||
"time",
|
"time",
|
||||||
"tokio",
|
"tokio",
|
||||||
|
"tracing",
|
||||||
"ts-rs",
|
"ts-rs",
|
||||||
"url",
|
"url",
|
||||||
"wasmtimer",
|
"wasmtimer",
|
||||||
@@ -6491,14 +6495,14 @@ version = "0.1.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"const_format",
|
"const_format",
|
||||||
"cosmrs 0.17.0-pre",
|
"cosmrs 0.21.1",
|
||||||
"eyre",
|
"eyre",
|
||||||
"futures",
|
"futures",
|
||||||
"humantime 2.1.0",
|
"humantime 2.1.0",
|
||||||
"serde",
|
"serde",
|
||||||
"sha2 0.10.8",
|
"sha2 0.10.8",
|
||||||
"sqlx",
|
"sqlx",
|
||||||
"tendermint 0.37.0",
|
"tendermint 0.40.1",
|
||||||
"tendermint-rpc",
|
"tendermint-rpc",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"time",
|
"time",
|
||||||
@@ -7168,6 +7172,16 @@ dependencies = [
|
|||||||
"prost-derive 0.12.6",
|
"prost-derive 0.12.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "prost"
|
||||||
|
version = "0.13.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2796faa41db3ec313a31f7624d9286acf277b52de526150b7e69f3debf891ee5"
|
||||||
|
dependencies = [
|
||||||
|
"bytes",
|
||||||
|
"prost-derive 0.13.5",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "prost-derive"
|
name = "prost-derive"
|
||||||
version = "0.11.9"
|
version = "0.11.9"
|
||||||
@@ -7194,6 +7208,19 @@ dependencies = [
|
|||||||
"syn 2.0.66",
|
"syn 2.0.66",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "prost-derive"
|
||||||
|
version = "0.13.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8a56d757972c98b346a9b766e3f02746cde6dd1cd1d1d563472929fdd74bec4d"
|
||||||
|
dependencies = [
|
||||||
|
"anyhow",
|
||||||
|
"itertools 0.13.0",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn 2.0.66",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "prost-types"
|
name = "prost-types"
|
||||||
version = "0.11.9"
|
version = "0.11.9"
|
||||||
@@ -8915,9 +8942,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tendermint"
|
name = "tendermint"
|
||||||
version = "0.37.0"
|
version = "0.40.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "954496fbc9716eb4446cdd6d00c071a3e2f22578d62aa03b40c7e5b4fda3ed42"
|
checksum = "d9703e34d940c2a293804752555107f8dbe2b84ec4c6dd5203831235868105d2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"digest 0.10.7",
|
"digest 0.10.7",
|
||||||
@@ -8928,8 +8955,7 @@ dependencies = [
|
|||||||
"k256",
|
"k256",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"prost 0.12.6",
|
"prost 0.13.5",
|
||||||
"prost-types 0.12.6",
|
|
||||||
"ripemd",
|
"ripemd",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_bytes",
|
"serde_bytes",
|
||||||
@@ -8939,21 +8965,21 @@ dependencies = [
|
|||||||
"signature",
|
"signature",
|
||||||
"subtle 2.5.0",
|
"subtle 2.5.0",
|
||||||
"subtle-encoding",
|
"subtle-encoding",
|
||||||
"tendermint-proto 0.37.0",
|
"tendermint-proto 0.40.1",
|
||||||
"time",
|
"time",
|
||||||
"zeroize",
|
"zeroize",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tendermint-config"
|
name = "tendermint-config"
|
||||||
version = "0.37.0"
|
version = "0.40.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f84b11b57d20ee4492a1452faff85f5c520adc36ca9fe5e701066935255bb89f"
|
checksum = "89cc3ea9a39b7ee34eefcff771cc067ecaa0c988c1c5ac08defd878471a06f76"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"flex-error",
|
"flex-error",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"tendermint 0.37.0",
|
"tendermint 0.40.1",
|
||||||
"toml 0.8.14",
|
"toml 0.8.14",
|
||||||
"url",
|
"url",
|
||||||
]
|
]
|
||||||
@@ -8978,14 +9004,13 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tendermint-proto"
|
name = "tendermint-proto"
|
||||||
version = "0.37.0"
|
version = "0.40.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "dc87024548c7f3da479885201e3da20ef29e85a3b13d04606b380ac4c7120d87"
|
checksum = "9ae9e1705aa0fa5ecb2c6aa7fb78c2313c4a31158ea5f02048bf318f849352eb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"flex-error",
|
"flex-error",
|
||||||
"prost 0.12.6",
|
"prost 0.13.5",
|
||||||
"prost-types 0.12.6",
|
|
||||||
"serde",
|
"serde",
|
||||||
"serde_bytes",
|
"serde_bytes",
|
||||||
"subtle-encoding",
|
"subtle-encoding",
|
||||||
@@ -8994,9 +9019,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tendermint-rpc"
|
name = "tendermint-rpc"
|
||||||
version = "0.37.0"
|
version = "0.40.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "dfdc2281e271277fda184d96d874a6fe59f569b130b634289257baacfc95aa85"
|
checksum = "835a52aa504c63ec05519e31348d3f4ba2fe79493c588e2cad5323d5e81b161a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"async-tungstenite",
|
"async-tungstenite",
|
||||||
@@ -9014,9 +9039,9 @@ dependencies = [
|
|||||||
"serde_json",
|
"serde_json",
|
||||||
"subtle 2.5.0",
|
"subtle 2.5.0",
|
||||||
"subtle-encoding",
|
"subtle-encoding",
|
||||||
"tendermint 0.37.0",
|
"tendermint 0.40.1",
|
||||||
"tendermint-config",
|
"tendermint-config",
|
||||||
"tendermint-proto 0.37.0",
|
"tendermint-proto 0.40.1",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"time",
|
"time",
|
||||||
"tokio",
|
"tokio",
|
||||||
|
|||||||
+4
-7
@@ -365,13 +365,10 @@ cw-controllers = { version = "=1.1.0" }
|
|||||||
# cosmrs-related
|
# cosmrs-related
|
||||||
bip32 = { version = "0.5.2", default-features = false }
|
bip32 = { version = "0.5.2", default-features = false }
|
||||||
|
|
||||||
# temporarily using a fork again (yay.) because we need staking and slashing support (which are already on main but not released)
|
cosmrs = { version = "0.21.1" }
|
||||||
# plus response message parsing (which is, as of the time of writing this message, waiting to get merged)
|
tendermint = "0.40.0"
|
||||||
#cosmrs = { path = "../cosmos-rust-fork/cosmos-rust/cosmrs" }
|
tendermint-rpc = "0.40.0"
|
||||||
cosmrs = { git = "https://github.com/cosmos/cosmos-rust", rev = "4b1332e6d8258ac845cef71589c8d362a669675a" } # unfortuntely we need a fork by yours truly to get the staking support
|
prost = { version = "0.13", default-features = false }
|
||||||
tendermint = "0.37.0" # same version as used by cosmrs
|
|
||||||
tendermint-rpc = "0.37.0" # same version as used by cosmrs
|
|
||||||
prost = { version = "0.12", default-features = false }
|
|
||||||
|
|
||||||
# wasm-related dependencies
|
# wasm-related dependencies
|
||||||
gloo-utils = "0.2.0"
|
gloo-utils = "0.2.0"
|
||||||
|
|||||||
@@ -20,11 +20,13 @@ nym-coconut-bandwidth-contract-common = { path = "../../cosmwasm-smart-contracts
|
|||||||
nym-ecash-contract-common = { path = "../../cosmwasm-smart-contracts/ecash-contract" }
|
nym-ecash-contract-common = { path = "../../cosmwasm-smart-contracts/ecash-contract" }
|
||||||
nym-multisig-contract-common = { path = "../../cosmwasm-smart-contracts/multisig-contract" }
|
nym-multisig-contract-common = { path = "../../cosmwasm-smart-contracts/multisig-contract" }
|
||||||
nym-group-contract-common = { path = "../../cosmwasm-smart-contracts/group-contract" }
|
nym-group-contract-common = { path = "../../cosmwasm-smart-contracts/group-contract" }
|
||||||
|
nym-serde-helpers = { path = "../../serde-helpers", features = ["hex", "base64"] }
|
||||||
serde = { workspace = true, features = ["derive"] }
|
serde = { workspace = true, features = ["derive"] }
|
||||||
serde_json = { workspace = true }
|
serde_json = { workspace = true }
|
||||||
nym-http-api-client = { path = "../../../common/http-api-client" }
|
nym-http-api-client = { path = "../../../common/http-api-client" }
|
||||||
thiserror = { workspace = true }
|
thiserror = { workspace = true }
|
||||||
log = { workspace = true }
|
log = { workspace = true }
|
||||||
|
tracing = { workspace = true }
|
||||||
url = { workspace = true, features = ["serde"] }
|
url = { workspace = true, features = ["serde"] }
|
||||||
tokio = { workspace = true, features = ["sync", "time"] }
|
tokio = { workspace = true, features = ["sync", "time"] }
|
||||||
time = { workspace = true, features = ["formatting"] }
|
time = { workspace = true, features = ["formatting"] }
|
||||||
|
|||||||
+78
-14
@@ -5,7 +5,7 @@ use crate::nyxd;
|
|||||||
use crate::nyxd::coin::Coin;
|
use crate::nyxd::coin::Coin;
|
||||||
use crate::nyxd::cosmwasm_client::helpers::{create_pagination, next_page_key};
|
use crate::nyxd::cosmwasm_client::helpers::{create_pagination, next_page_key};
|
||||||
use crate::nyxd::cosmwasm_client::types::{
|
use crate::nyxd::cosmwasm_client::types::{
|
||||||
Account, CodeDetails, Contract, ContractCodeId, SequenceResponse, SimulateResponse,
|
Account, CodeDetails, Contract, ContractCodeId, Model, SequenceResponse, SimulateResponse,
|
||||||
};
|
};
|
||||||
use crate::nyxd::error::NyxdError;
|
use crate::nyxd::error::NyxdError;
|
||||||
use crate::nyxd::Query;
|
use crate::nyxd::Query;
|
||||||
@@ -21,15 +21,14 @@ use cosmrs::proto::cosmos::tx::v1beta1::{
|
|||||||
SimulateRequest, SimulateResponse as ProtoSimulateResponse,
|
SimulateRequest, SimulateResponse as ProtoSimulateResponse,
|
||||||
};
|
};
|
||||||
use cosmrs::proto::cosmwasm::wasm::v1::{
|
use cosmrs::proto::cosmwasm::wasm::v1::{
|
||||||
QueryCodeRequest, QueryCodeResponse, QueryCodesRequest, QueryCodesResponse,
|
QueryAllContractStateRequest, QueryAllContractStateResponse, QueryCodeRequest,
|
||||||
QueryContractHistoryRequest, QueryContractHistoryResponse, QueryContractInfoRequest,
|
QueryCodeResponse, QueryCodesRequest, QueryCodesResponse, QueryContractHistoryRequest,
|
||||||
QueryContractInfoResponse, QueryContractsByCodeRequest, QueryContractsByCodeResponse,
|
QueryContractHistoryResponse, QueryContractInfoRequest, QueryContractInfoResponse,
|
||||||
QueryRawContractStateRequest, QueryRawContractStateResponse, QuerySmartContractStateRequest,
|
QueryContractsByCodeRequest, QueryContractsByCodeResponse, QueryRawContractStateRequest,
|
||||||
QuerySmartContractStateResponse,
|
QueryRawContractStateResponse, QuerySmartContractStateRequest, QuerySmartContractStateResponse,
|
||||||
};
|
};
|
||||||
use cosmrs::tendermint::{block, chain, Hash};
|
use cosmrs::tendermint::{block, chain, Hash};
|
||||||
use cosmrs::{AccountId, Coin as CosmosCoin, Tx};
|
use cosmrs::{AccountId, Coin as CosmosCoin, Tx};
|
||||||
use log::trace;
|
|
||||||
use prost::Message;
|
use prost::Message;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
@@ -68,7 +67,7 @@ pub trait CosmWasmClient: TendermintRpcClient {
|
|||||||
Res: Message + Default,
|
Res: Message + Default,
|
||||||
{
|
{
|
||||||
if let Some(ref abci_path) = path {
|
if let Some(ref abci_path) = path {
|
||||||
trace!("performing query on abci path {abci_path}")
|
tracing::trace!("performing query on abci path {abci_path}")
|
||||||
}
|
}
|
||||||
let mut buf = Vec::with_capacity(req.encoded_len());
|
let mut buf = Vec::with_capacity(req.encoded_len());
|
||||||
req.encode(&mut buf)?;
|
req.encode(&mut buf)?;
|
||||||
@@ -154,13 +153,20 @@ pub trait CosmWasmClient: TendermintRpcClient {
|
|||||||
let req = QueryAllBalancesRequest {
|
let req = QueryAllBalancesRequest {
|
||||||
address: address.to_string(),
|
address: address.to_string(),
|
||||||
pagination,
|
pagination,
|
||||||
|
resolve_denom: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut res = self
|
let mut res = self
|
||||||
.make_abci_query::<_, QueryAllBalancesResponse>(path.clone(), req)
|
.make_abci_query::<_, QueryAllBalancesResponse>(path.clone(), req)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
let early_break = res.balances.is_empty();
|
||||||
raw_balances.append(&mut res.balances);
|
raw_balances.append(&mut res.balances);
|
||||||
|
|
||||||
|
if early_break {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(next_key) = next_page_key(res.pagination) {
|
if let Some(next_key) = next_page_key(res.pagination) {
|
||||||
pagination = Some(create_pagination(next_key))
|
pagination = Some(create_pagination(next_key))
|
||||||
} else {
|
} else {
|
||||||
@@ -188,7 +194,13 @@ pub trait CosmWasmClient: TendermintRpcClient {
|
|||||||
.make_abci_query::<_, QueryTotalSupplyResponse>(path.clone(), req)
|
.make_abci_query::<_, QueryTotalSupplyResponse>(path.clone(), req)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
let early_break = res.supply.is_empty();
|
||||||
supply.append(&mut res.supply);
|
supply.append(&mut res.supply);
|
||||||
|
|
||||||
|
if early_break {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(next_key) = next_page_key(res.pagination) {
|
if let Some(next_key) = next_page_key(res.pagination) {
|
||||||
pagination = Some(create_pagination(next_key))
|
pagination = Some(create_pagination(next_key))
|
||||||
} else {
|
} else {
|
||||||
@@ -218,17 +230,19 @@ pub trait CosmWasmClient: TendermintRpcClient {
|
|||||||
|
|
||||||
loop {
|
loop {
|
||||||
let mut res = self
|
let mut res = self
|
||||||
.tx_search(query.clone(), false, page, 100, Order::Ascending)
|
.tx_search(query.clone(), false, page, per_page, Order::Ascending)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
results.append(&mut res.txs);
|
|
||||||
// sanity check for if tendermint's maximum per_page was modified -
|
// sanity check for if tendermint's maximum per_page was modified -
|
||||||
// we don't want to accidentally be stuck in an infinite loop
|
// we don't want to accidentally be stuck in an infinite loop
|
||||||
if res.total_count == 0 || res.txs.is_empty() {
|
let early_break = res.total_count == 0 || res.txs.is_empty();
|
||||||
|
results.append(&mut res.txs);
|
||||||
|
|
||||||
|
if early_break {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if res.total_count >= per_page {
|
if res.total_count > results.len() as u32 {
|
||||||
page += 1
|
page += 1
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
@@ -295,7 +309,7 @@ pub trait CosmWasmClient: TendermintRpcClient {
|
|||||||
|
|
||||||
let start = Instant::now();
|
let start = Instant::now();
|
||||||
loop {
|
loop {
|
||||||
log::debug!(
|
tracing::debug!(
|
||||||
"Polling for result of including {} in a block...",
|
"Polling for result of including {} in a block...",
|
||||||
broadcasted.hash
|
broadcasted.hash
|
||||||
);
|
);
|
||||||
@@ -327,7 +341,13 @@ pub trait CosmWasmClient: TendermintRpcClient {
|
|||||||
.make_abci_query::<_, QueryCodesResponse>(path.clone(), req)
|
.make_abci_query::<_, QueryCodesResponse>(path.clone(), req)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
let early_break = res.code_infos.is_empty();
|
||||||
raw_codes.append(&mut res.code_infos);
|
raw_codes.append(&mut res.code_infos);
|
||||||
|
|
||||||
|
if early_break {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(next_key) = next_page_key(res.pagination) {
|
if let Some(next_key) = next_page_key(res.pagination) {
|
||||||
pagination = Some(create_pagination(next_key))
|
pagination = Some(create_pagination(next_key))
|
||||||
} else {
|
} else {
|
||||||
@@ -372,7 +392,13 @@ pub trait CosmWasmClient: TendermintRpcClient {
|
|||||||
.make_abci_query::<_, QueryContractsByCodeResponse>(path.clone(), req)
|
.make_abci_query::<_, QueryContractsByCodeResponse>(path.clone(), req)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
let early_break = res.contracts.is_empty();
|
||||||
raw_contracts.append(&mut res.contracts);
|
raw_contracts.append(&mut res.contracts);
|
||||||
|
|
||||||
|
if early_break {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(next_key) = next_page_key(res.pagination) {
|
if let Some(next_key) = next_page_key(res.pagination) {
|
||||||
pagination = Some(create_pagination(next_key))
|
pagination = Some(create_pagination(next_key))
|
||||||
} else {
|
} else {
|
||||||
@@ -428,7 +454,13 @@ pub trait CosmWasmClient: TendermintRpcClient {
|
|||||||
.make_abci_query::<_, QueryContractHistoryResponse>(path.clone(), req)
|
.make_abci_query::<_, QueryContractHistoryResponse>(path.clone(), req)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
let early_break = res.entries.is_empty();
|
||||||
raw_entries.append(&mut res.entries);
|
raw_entries.append(&mut res.entries);
|
||||||
|
|
||||||
|
if early_break {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(next_key) = next_page_key(res.pagination) {
|
if let Some(next_key) = next_page_key(res.pagination) {
|
||||||
pagination = Some(create_pagination(next_key))
|
pagination = Some(create_pagination(next_key))
|
||||||
} else {
|
} else {
|
||||||
@@ -442,6 +474,38 @@ pub trait CosmWasmClient: TendermintRpcClient {
|
|||||||
.collect::<Result<_, _>>()?)
|
.collect::<Result<_, _>>()?)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async fn query_all_contract_state(&self, address: &AccountId) -> Result<Vec<Model>, NyxdError> {
|
||||||
|
let path = Some("/cosmwasm.wasm.v1.Query/AllContractState".to_owned());
|
||||||
|
|
||||||
|
let mut models = Vec::new();
|
||||||
|
let mut pagination = None;
|
||||||
|
|
||||||
|
loop {
|
||||||
|
let req = QueryAllContractStateRequest {
|
||||||
|
address: address.to_string(),
|
||||||
|
pagination,
|
||||||
|
};
|
||||||
|
|
||||||
|
let mut res = self
|
||||||
|
.make_abci_query::<_, QueryAllContractStateResponse>(path.clone(), req)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
let empty_response = res.models.is_empty();
|
||||||
|
models.append(&mut res.models);
|
||||||
|
|
||||||
|
if empty_response {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if let Some(next_key) = next_page_key(res.pagination) {
|
||||||
|
pagination = Some(create_pagination(next_key))
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(models.into_iter().map(Into::into).collect())
|
||||||
|
}
|
||||||
|
|
||||||
async fn query_contract_raw(
|
async fn query_contract_raw(
|
||||||
&self,
|
&self,
|
||||||
address: &AccountId,
|
address: &AccountId,
|
||||||
@@ -488,7 +552,7 @@ pub trait CosmWasmClient: TendermintRpcClient {
|
|||||||
.make_abci_query::<_, QuerySmartContractStateResponse>(path, req)
|
.make_abci_query::<_, QuerySmartContractStateResponse>(path, req)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
trace!("raw query response: {}", String::from_utf8_lossy(&res.data));
|
tracing::trace!("raw query response: {}", String::from_utf8_lossy(&res.data));
|
||||||
Ok(serde_json::from_slice(&res.data)?)
|
Ok(serde_json::from_slice(&res.data)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,13 +27,34 @@ use cosmrs::vesting::{
|
|||||||
};
|
};
|
||||||
use cosmrs::{AccountId, Any, Coin as CosmosCoin};
|
use cosmrs::{AccountId, Any, Coin as CosmosCoin};
|
||||||
use prost::Message;
|
use prost::Message;
|
||||||
use serde::Serialize;
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
pub use cosmrs::abci::GasInfo;
|
pub use cosmrs::abci::GasInfo;
|
||||||
pub use cosmrs::abci::MsgResponse;
|
pub use cosmrs::abci::MsgResponse;
|
||||||
|
|
||||||
pub type ContractCodeId = u64;
|
pub type ContractCodeId = u64;
|
||||||
|
|
||||||
|
// yet another thing to put in cosmrs
|
||||||
|
#[derive(Serialize, Deserialize)]
|
||||||
|
pub struct Model {
|
||||||
|
#[serde(with = "nym_serde_helpers::hex")]
|
||||||
|
pub key: Vec<u8>,
|
||||||
|
|
||||||
|
#[serde(with = "nym_serde_helpers::base64")]
|
||||||
|
pub value: Vec<u8>,
|
||||||
|
}
|
||||||
|
|
||||||
|
// follow the cosmwasm serialisation format, i.e. hex for key and base64 for value
|
||||||
|
|
||||||
|
impl From<cosmrs::proto::cosmwasm::wasm::v1::Model> for Model {
|
||||||
|
fn from(model: cosmrs::proto::cosmwasm::wasm::v1::Model) -> Self {
|
||||||
|
Model {
|
||||||
|
key: model.key,
|
||||||
|
value: model.value,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
pub struct EmptyMsg {}
|
pub struct EmptyMsg {}
|
||||||
|
|
||||||
|
|||||||
@@ -4,9 +4,11 @@
|
|||||||
use crate::rpc::TendermintRpcClient;
|
use crate::rpc::TendermintRpcClient;
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use base64::Engine;
|
use base64::Engine;
|
||||||
|
use cosmrs::tendermint;
|
||||||
use cosmrs::tendermint::{block::Height, evidence::Evidence, Hash};
|
use cosmrs::tendermint::{block::Height, evidence::Evidence, Hash};
|
||||||
use reqwest::header::HeaderMap;
|
use reqwest::header::HeaderMap;
|
||||||
use reqwest::{header, RequestBuilder};
|
use reqwest::{header, RequestBuilder};
|
||||||
|
use tendermint_rpc::dialect::{v0_34, v0_37, v0_38, LatestDialect};
|
||||||
use tendermint_rpc::{
|
use tendermint_rpc::{
|
||||||
client::CompatMode,
|
client::CompatMode,
|
||||||
dialect::{self, Dialect},
|
dialect::{self, Dialect},
|
||||||
@@ -21,8 +23,21 @@ macro_rules! perform_with_compat {
|
|||||||
($self:expr, $request:expr) => {{
|
($self:expr, $request:expr) => {{
|
||||||
let request = $request;
|
let request = $request;
|
||||||
match $self.compat {
|
match $self.compat {
|
||||||
CompatMode::V0_37 => $self.perform_v0_37(request).await,
|
CompatMode::V0_38 => {
|
||||||
CompatMode::V0_34 => $self.perform_v0_34(request).await,
|
$self
|
||||||
|
.perform_request_with_dialect(request, dialect::v0_38::Dialect)
|
||||||
|
.await
|
||||||
|
}
|
||||||
|
CompatMode::V0_37 => {
|
||||||
|
$self
|
||||||
|
.perform_request_with_dialect(request, dialect::v0_37::Dialect)
|
||||||
|
.await
|
||||||
|
}
|
||||||
|
CompatMode::V0_34 => {
|
||||||
|
$self
|
||||||
|
.perform_request_with_dialect(request, dialect::v0_34::Dialect)
|
||||||
|
.await
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
@@ -70,7 +85,11 @@ impl ReqwestRpcClient {
|
|||||||
.headers(headers)
|
.headers(headers)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn perform_request<R, S>(&self, request: R) -> Result<R::Output, Error>
|
async fn perform_request_with_dialect<R, S>(
|
||||||
|
&self,
|
||||||
|
request: R,
|
||||||
|
_dialect: S,
|
||||||
|
) -> Result<R::Output, Error>
|
||||||
where
|
where
|
||||||
R: SimpleRequest<S>,
|
R: SimpleRequest<S>,
|
||||||
S: Dialect,
|
S: Dialect,
|
||||||
@@ -81,26 +100,25 @@ impl ReqwestRpcClient {
|
|||||||
.send()
|
.send()
|
||||||
.await
|
.await
|
||||||
.map_err(TendermintRpcErrorMap::into_rpc_err)?;
|
.map_err(TendermintRpcErrorMap::into_rpc_err)?;
|
||||||
|
let response_status = response.status();
|
||||||
let bytes = response
|
let bytes = response
|
||||||
.bytes()
|
.bytes()
|
||||||
.await
|
.await
|
||||||
.map_err(TendermintRpcErrorMap::into_rpc_err)?;
|
.map_err(TendermintRpcErrorMap::into_rpc_err)?;
|
||||||
|
|
||||||
|
// Successful JSON-RPC requests are expected to return a 200 OK HTTP status.
|
||||||
|
// Otherwise, this means that the HTTP request failed as a whole,
|
||||||
|
// as opposed to the JSON-RPC request returning an error,
|
||||||
|
// and we cannot expect the response body to be a valid JSON-RPC response.
|
||||||
|
if response_status != reqwest::StatusCode::OK {
|
||||||
|
// hehe, that's so nasty but we have to somehow convert between different versions of the same lib
|
||||||
|
return Err(Error::http_request_failed(
|
||||||
|
response_status.as_u16().try_into().unwrap(),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
R::Response::from_string(bytes).map(Into::into)
|
R::Response::from_string(bytes).map(Into::into)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn perform_v0_34<R>(&self, request: R) -> Result<R::Output, Error>
|
|
||||||
where
|
|
||||||
R: SimpleRequest<dialect::v0_34::Dialect>,
|
|
||||||
{
|
|
||||||
self.perform_request(request).await
|
|
||||||
}
|
|
||||||
|
|
||||||
async fn perform_v0_37<R>(&self, request: R) -> Result<R::Output, Error>
|
|
||||||
where
|
|
||||||
R: SimpleRequest<dialect::v0_37::Dialect>,
|
|
||||||
{
|
|
||||||
self.perform_request(request).await
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
trait TendermintRpcErrorMap {
|
trait TendermintRpcErrorMap {
|
||||||
@@ -120,18 +138,50 @@ impl TendermintRpcClient for ReqwestRpcClient {
|
|||||||
where
|
where
|
||||||
R: SimpleRequest,
|
R: SimpleRequest,
|
||||||
{
|
{
|
||||||
self.perform_request(request).await
|
self.perform_request_with_dialect(request, LatestDialect)
|
||||||
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn block_results<H>(&self, height: H) -> Result<block_results::Response, Error>
|
async fn block<H>(&self, height: H) -> Result<endpoint::block::Response, Error>
|
||||||
where
|
where
|
||||||
H: Into<Height> + Send,
|
H: Into<Height> + Send,
|
||||||
{
|
{
|
||||||
perform_with_compat!(self, block_results::Request::new(height.into()))
|
perform_with_compat!(self, endpoint::block::Request::new(height.into()))
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn latest_block_results(&self) -> Result<block_results::Response, Error> {
|
async fn block_by_hash(
|
||||||
perform_with_compat!(self, block_results::Request::default())
|
&self,
|
||||||
|
hash: tendermint::Hash,
|
||||||
|
) -> Result<endpoint::block_by_hash::Response, Error> {
|
||||||
|
perform_with_compat!(self, endpoint::block_by_hash::Request::new(hash))
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn latest_block(&self) -> Result<endpoint::block::Response, Error> {
|
||||||
|
perform_with_compat!(self, endpoint::block::Request::default())
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn block_results<H>(&self, height: H) -> Result<endpoint::block_results::Response, Error>
|
||||||
|
where
|
||||||
|
H: Into<Height> + Send,
|
||||||
|
{
|
||||||
|
perform_with_compat!(self, endpoint::block_results::Request::new(height.into()))
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn latest_block_results(&self) -> Result<endpoint::block_results::Response, Error> {
|
||||||
|
perform_with_compat!(self, endpoint::block_results::Request::default())
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn block_search(
|
||||||
|
&self,
|
||||||
|
query: Query,
|
||||||
|
page: u32,
|
||||||
|
per_page: u8,
|
||||||
|
order: Order,
|
||||||
|
) -> Result<endpoint::block_search::Response, Error> {
|
||||||
|
perform_with_compat!(
|
||||||
|
self,
|
||||||
|
endpoint::block_search::Request::new(query, page, per_page, order)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn header<H>(&self, height: H) -> Result<endpoint::header::Response, Error>
|
async fn header<H>(&self, height: H) -> Result<endpoint::header::Response, Error>
|
||||||
@@ -140,11 +190,26 @@ impl TendermintRpcClient for ReqwestRpcClient {
|
|||||||
{
|
{
|
||||||
let height = height.into();
|
let height = height.into();
|
||||||
match self.compat {
|
match self.compat {
|
||||||
CompatMode::V0_37 => self.perform(endpoint::header::Request::new(height)).await,
|
CompatMode::V0_38 => {
|
||||||
|
self.perform_request_with_dialect(
|
||||||
|
endpoint::header::Request::new(height),
|
||||||
|
v0_38::Dialect,
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
}
|
||||||
|
CompatMode::V0_37 => {
|
||||||
|
self.perform_request_with_dialect(
|
||||||
|
endpoint::header::Request::new(height),
|
||||||
|
v0_37::Dialect,
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
}
|
||||||
CompatMode::V0_34 => {
|
CompatMode::V0_34 => {
|
||||||
// Back-fill with a request to /block endpoint and
|
// Back-fill with a request to /block endpoint and
|
||||||
// taking just the header from the response.
|
// taking just the header from the response.
|
||||||
let resp = self.perform_v0_34(block::Request::new(height)).await?;
|
let resp = self
|
||||||
|
.perform_request_with_dialect(block::Request::new(height), v0_34::Dialect)
|
||||||
|
.await?;
|
||||||
Ok(resp.into())
|
Ok(resp.into())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -152,12 +217,25 @@ impl TendermintRpcClient for ReqwestRpcClient {
|
|||||||
|
|
||||||
async fn header_by_hash(&self, hash: Hash) -> Result<header_by_hash::Response, Error> {
|
async fn header_by_hash(&self, hash: Hash) -> Result<header_by_hash::Response, Error> {
|
||||||
match self.compat {
|
match self.compat {
|
||||||
CompatMode::V0_37 => self.perform(header_by_hash::Request::new(hash)).await,
|
CompatMode::V0_38 => {
|
||||||
|
self.perform_request_with_dialect(
|
||||||
|
header_by_hash::Request::new(hash),
|
||||||
|
v0_38::Dialect,
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
}
|
||||||
|
CompatMode::V0_37 => {
|
||||||
|
self.perform_request_with_dialect(
|
||||||
|
header_by_hash::Request::new(hash),
|
||||||
|
v0_37::Dialect,
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
}
|
||||||
CompatMode::V0_34 => {
|
CompatMode::V0_34 => {
|
||||||
// Back-fill with a request to /block_by_hash endpoint and
|
// Back-fill with a request to /block_by_hash endpoint and
|
||||||
// taking just the header from the response.
|
// taking just the header from the response.
|
||||||
let resp = self
|
let resp = self
|
||||||
.perform_v0_34(block_by_hash::Request::new(hash))
|
.perform_request_with_dialect(block_by_hash::Request::new(hash), v0_34::Dialect)
|
||||||
.await?;
|
.await?;
|
||||||
Ok(resp.into())
|
Ok(resp.into())
|
||||||
}
|
}
|
||||||
@@ -167,8 +245,18 @@ impl TendermintRpcClient for ReqwestRpcClient {
|
|||||||
/// `/broadcast_evidence`: broadcast an evidence.
|
/// `/broadcast_evidence`: broadcast an evidence.
|
||||||
async fn broadcast_evidence(&self, e: Evidence) -> Result<evidence::Response, Error> {
|
async fn broadcast_evidence(&self, e: Evidence) -> Result<evidence::Response, Error> {
|
||||||
match self.compat {
|
match self.compat {
|
||||||
CompatMode::V0_37 => self.perform(evidence::Request::new(e)).await,
|
CompatMode::V0_38 => {
|
||||||
CompatMode::V0_34 => self.perform_v0_34(evidence::Request::new(e)).await,
|
self.perform_request_with_dialect(evidence::Request::new(e), v0_38::Dialect)
|
||||||
|
.await
|
||||||
|
}
|
||||||
|
CompatMode::V0_37 => {
|
||||||
|
self.perform_request_with_dialect(evidence::Request::new(e), v0_37::Dialect)
|
||||||
|
.await
|
||||||
|
}
|
||||||
|
CompatMode::V0_34 => {
|
||||||
|
self.perform_request_with_dialect(evidence::Request::new(e), v0_34::Dialect)
|
||||||
|
.await
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -84,13 +84,7 @@ impl TryFrom<Event> for BlockToProcess {
|
|||||||
|
|
||||||
// TODO: we're losing `result_begin_block` and `result_end_block` here but maybe that's fine?
|
// TODO: we're losing `result_begin_block` and `result_end_block` here but maybe that's fine?
|
||||||
let maybe_block = match event.data {
|
let maybe_block = match event.data {
|
||||||
// we don't care about `NewBlock` until CometBFT 0.38, i.e. until we upgrade to wasmd 0.50
|
EventData::NewBlock { block, .. } => block,
|
||||||
EventData::NewBlock { .. } => {
|
|
||||||
return Err(ScraperError::InvalidSubscriptionEvent {
|
|
||||||
query,
|
|
||||||
kind: "NewBlock".to_string(),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
EventData::LegacyNewBlock { block, .. } => block,
|
EventData::LegacyNewBlock { block, .. } => block,
|
||||||
EventData::Tx { .. } => {
|
EventData::Tx { .. } => {
|
||||||
return Err(ScraperError::InvalidSubscriptionEvent {
|
return Err(ScraperError::InvalidSubscriptionEvent {
|
||||||
|
|||||||
@@ -306,7 +306,13 @@ async fn persist_commits(
|
|||||||
} => (validator_address, timestamp, signature),
|
} => (validator_address, timestamp, signature),
|
||||||
};
|
};
|
||||||
|
|
||||||
let validator = crate::helpers::validator_info(*validator_id, validators)?;
|
let validator = match crate::helpers::validator_info(*validator_id, validators) {
|
||||||
|
Ok(validator_info) => validator_info,
|
||||||
|
Err(err) => {
|
||||||
|
error!("{err}");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
};
|
||||||
let validator_address = crate::helpers::validator_consensus_address(*validator_id)?;
|
let validator_address = crate::helpers::validator_consensus_address(*validator_id)?;
|
||||||
|
|
||||||
if signature.is_none() {
|
if signature.is_none() {
|
||||||
|
|||||||
@@ -13,11 +13,13 @@ license.workspace = true
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
|
|
||||||
serde = { workspace = true }
|
serde = { workspace = true }
|
||||||
|
hex = { workspace = true, optional = true }
|
||||||
bs58 = { workspace = true, optional = true }
|
bs58 = { workspace = true, optional = true }
|
||||||
base64 = { workspace = true, optional = true }
|
base64 = { workspace = true, optional = true }
|
||||||
time = { workspace = true, features = ["formatting", "parsing"], optional = true }
|
time = { workspace = true, features = ["formatting", "parsing"], optional = true }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
hex = ["dep:hex"]
|
||||||
bs58 = ["dep:bs58"]
|
bs58 = ["dep:bs58"]
|
||||||
base64 = ["dep:base64"]
|
base64 = ["dep:base64"]
|
||||||
date = ["time"]
|
date = ["time"]
|
||||||
@@ -32,6 +32,20 @@ pub mod bs58 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "hex")]
|
||||||
|
pub mod hex {
|
||||||
|
use serde::{Deserialize, Deserializer, Serializer};
|
||||||
|
|
||||||
|
pub fn serialize<S: Serializer>(bytes: &[u8], serializer: S) -> Result<S::Ok, S::Error> {
|
||||||
|
serializer.serialize_str(&::hex::encode(bytes))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn deserialize<'de, D: Deserializer<'de>>(deserializer: D) -> Result<Vec<u8>, D::Error> {
|
||||||
|
let s = String::deserialize(deserializer)?;
|
||||||
|
::hex::decode(&s).map_err(serde::de::Error::custom)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(feature = "date")]
|
#[cfg(feature = "date")]
|
||||||
pub mod date {
|
pub mod date {
|
||||||
use serde::ser::Error;
|
use serde::ser::Error;
|
||||||
|
|||||||
Reference in New Issue
Block a user