use cosmwasm_std::Storage;
use cw_storage_plus::{Item, Map};
use crate::error::ContractError;
pub const CONNECTION_REMOTE_PORT: Item<(String, String)> = Item::new("a");
pub const CHANNEL: Item<String> = Item::new("b");
pub const BLOCK_MAX_GAS: Item<u64> = Item::new("bmg");
const SEQUENCE_NUMBER: Map<String, u64> = Map::new("sn");
pub(crate) fn increment_sequence_number(
storage: &mut dyn Storage,
channel_id: String,
) -> Result<u64, ContractError> {
let seq = SEQUENCE_NUMBER
.may_load(storage, channel_id.clone())?
.unwrap_or_default()
.checked_add(1)
.ok_or(ContractError::SequenceOverflow)?;
SEQUENCE_NUMBER.save(storage, channel_id, &seq)?;
Ok(seq)
}